فهرست منبع

isptelecom provider added

Tony Fernandez 11 ماه پیش
والد
کامیت
33e62dae5b
4فایلهای تغییر یافته به همراه687 افزوده شده و 129 حذف شده
  1. 94 47
      index.php
  2. 26 0
      resources/functions/message_media_builder.php
  3. 445 0
      resources/providers/settings.php
  4. 122 82
      resources/service/message_send_outbound.php

+ 94 - 47
index.php

@@ -7,6 +7,7 @@
 //includes files
 	require_once "resources/require.php";
 	require_once "resources/functions.php";
+	require_once "resources/functions/message_media_builder.php";
 	require_once "resources/pdo.php";
 
 //debug
@@ -25,7 +26,8 @@
 		file_put_contents($log_file, "Remote Address: ".$_SERVER['REMOTE_ADDR']."\n", FILE_APPEND);
 	}
 
-//get the user settings
+
+//get the provider addresses
 	$sql = "select provider_uuid, provider_address_cidr ";
 	$sql .= "from v_provider_addresses ";
 	$sql .= "where provider_address_cidr is not null ";
@@ -100,39 +102,47 @@
 //set the default content type to json
 	$content_type = 'json';
 
-//get the content location for the destinaion numer
+//get the content location for the destination number
 	if (isset($setting['content_type'])) {
 		$content_type = strtolower($setting['content_type']);
 	}
 
-//get the raw input data
-	//if  ($_SERVER['CONTENT_TYPE'] == 'application/json') {
-		//show the content type
-		if ($debug) {
-			file_put_contents($log_file, "Server CONTENT_TYPE ".$_SERVER['CONTENT_TYPE']."\n", FILE_APPEND);
-			file_put_contents($log_file, "content_type ".$content_type."\n", FILE_APPEND);
-		}
+	if ($debug) {
+		file_put_contents($log_file, "Server CONTENT_TYPE ".$_SERVER['CONTENT_TYPE']."\n", FILE_APPEND);
+		file_put_contents($log_file, "content_type: $content_type\n", FILE_APPEND);
+	}
 
-		//get the content
-		if ($content_type == 'json') {
-			$message_json = file_get_contents("php://input");
-		}
-		elseif ($content_type == 'get') {
+//get the content
+	if ($content_type == 'json') {
+		$message_json = file_get_contents("php://input");
+	}
+	elseif ($content_type == 'get') {
+		$message_json = json_encode($_GET);
+	}
+	elseif ($content_type == 'post') {
+		$message_json = json_encode($_POST);
+	}
+	// Used for Providers that send HTTP requests with mixed http method and http variables
+	// For example, a Provider that sends a POST with a query string would populate $_GET, not $_POST
+	elseif ($content_type == 'mixed') {
+		if(!empty($_GET)){
 			$message_json = json_encode($_GET);
-		}
-		elseif ($content_type == 'post') {
+			$content_type = 'get';
+		}elseif(!empty($_POST)){
 			$message_json = json_encode($_POST);
+			$content_type = 'post';
+		}else{
+			$message_json = file_get_contents("php://input");
+			$content_type = 'json';
 		}
+	}
 
-		//write content to the logs
-		if ($debug) {
-			if ($content_type == 'json') {
-				file_put_contents($log_file, $message_json, FILE_APPEND);
-			}
+//write content to the logs
+	if ($debug) {
+		if ($content_type == 'json') {
+			file_put_contents($log_file, $message_json, FILE_APPEND);
 		}
-
-		//$json = json_decode($message_content);
-	//}
+	}
 
 //save the http post to the log
 	if ($debug) {
@@ -245,26 +255,55 @@ if (count($message_content) == 3) {
 		$message_to = get_value($message, $setting['message_to']);
 		$message_content = get_value($message, $setting['message_content']);
 		$message_media_array = !empty($setting['message_media_array']) ? get_value($message, $setting['message_media_array']) : null;
+	
+		//get the message_type options: sms, mms
+		if (isset($setting['message_type'])) {
+			$message_type = strtolower($setting['message_type']);
+		}
+		else {
+			$message_type = !empty($message_media_array) && is_array($message_media_array) ? 'mms' : 'sms';
+		}
 	}
 	elseif ($content_type == 'post') {
-		$message_from = $_POST[$setting['message_from']];
-		$message_to = $_POST[$setting['message_to']];
-		$message_content = $_POST[$setting['message_content']];
-		$message_media_array = !empty($setting['message_media_array']) ? $_POST[$setting['message_media_array']] : null;
+		if(!empty($setting['message_media_array']) && isset($_POST[$setting['message_media_array']])){
+			$message_media_array = $_POST[$setting['message_media_array']] ;
+		}
+		else {
+			$message_media_array = message_media_builder($_POST, [$setting['message_media_url'], $setting['message_media_type']]);
+		}
+
+		//get the message_type options: sms, mms
+		if (isset($setting['message_type'])) {
+			$message_type = strtolower($setting['message_type']);
+		}
+		else {
+			$message_type = !empty($message_media_array) && is_array($message_media_array) ? 'mms' : 'sms';
+		}
+		$message_from = ($message_type == 'mms') ? $_POST[$setting['message_media_from']] : $_POST[$setting['message_from']];
+		$message_to = ($message_type == 'mms') ? $_POST[$setting['message_media_to']] : $_POST[$setting['message_to']];
+		$message_content = ($message_type == 'mms') ? $_POST[$setting['message_media_content']] : $_POST[$setting['message_content']];
+		$message_content = preg_replace('/<smil[^>]*>([\s\S]*?)<\/smil[^>]*>/', '', $message_content);
+
 	}
 	elseif ($content_type == 'get') {
-		$message_from = $_GET[$setting['message_from']];
-		$message_to = $_GET[$setting['message_to']];
-		$message_content = $_GET[$setting['message_content']];
-		$message_media_array = !empty($setting['message_media_array']) ? $_GET[$setting['message_media_array']] : null;
-	}
+		if(!empty($setting['message_media_array']) && isset($_GET[$setting['message_media_array']])){
+			$message_media_array = $_GET[$setting['message_media_array']] ;
+		}
+		else {
+			$message_media_array = message_media_builder($_GET, [$setting['message_media_url'], $setting['message_media_type']]);
+		}
 
-//get the message_type options: sms, mms
-	if (isset($setting['message_type'])) {
-		$message_type = strtolower($setting['message_type']);
-	}
-	else {
-		$message_type = !empty($message_media_array) && is_array($message_media_array) ? 'mms' : 'sms';
+		//get the message_type options: sms, mms
+		if (isset($setting['message_type'])) {
+			$message_type = strtolower($setting['message_type']);
+		}
+		else {
+			$message_type = !empty($message_media_array) && is_array($message_media_array) ? 'mms' : 'sms';
+		}
+		$message_from = ($message_type == 'mms') ? $_GET[$setting['message_media_from']] : $_GET[$setting['message_from']];
+		$message_to = ($message_type == 'mms') ? $_GET[$setting['message_media_to']] : $_GET[$setting['message_to']];
+		$message_content = ($message_type == 'mms') ? $_GET[$setting['message_media_content']] : $_GET[$setting['message_content']];
+		$message_content = preg_replace('/<smil[^>]*>([\s\S]*?)<\/smil[^>]*>/', '', $message_content);
 	}
 
 //message to is an array get first number in the array
@@ -282,11 +321,20 @@ if (count($message_content) == 3) {
 //format the phone numbers
 	foreach ($provider_settings as $row) {
 		if ($row['provider_setting_subcategory'] == 'format') {
-			if ($row['provider_setting_name'] == 'message_from') {
-				$message_from = format_string($row['provider_setting_value'], $message_from);
-			}
-			if ($row['provider_setting_name'] == 'message_to') {
-				$message_to = format_string($row['provider_setting_value'], $message_to);
+			if ($message_type == 'sms'){
+				if ($row['provider_setting_name'] == 'message_from') {
+					$message_from = format_string($row['provider_setting_value'], $message_from);
+				}
+				if ($row['provider_setting_name'] == 'message_to') {
+					$message_to = format_string($row['provider_setting_value'], $message_to);
+				}
+			}else{
+				if ($row['provider_setting_name'] == 'message_media_message_from') {
+					$message_from = format_string($row['provider_setting_value'], $message_from);
+				}
+				if ($row['provider_setting_name'] == 'message_media_message_to') {
+					$message_to = format_string($row['provider_setting_value'], $message_to);
+				}
 			}
 		}
 	}
@@ -487,7 +535,6 @@ if (count($message_content) == 3) {
 		}
 	}
 	else {
-
 		//get the value out of the array using dot notation
 		if (isset($setting['message_media_url'])) {
 			$message_media_url = get_value($message, $setting['message_media_url']);
@@ -517,7 +564,7 @@ if (count($message_content) == 3) {
 			$array['message_media'][$index]['user_uuid'] = $user_uuid;
 			$array['message_media'][$index]['message_media_type'] = $message_media_type;
 			$array['message_media'][$index]['message_media_url'] = $message_media_url;
-			$array['message_media'][$index]['message_media_content'] = base64_encode(file_get_contents($message_media_url));
+			$array['message_media'][$index]['message_media_content'] = base64_encode(url_get_contents($message_media_url));
 		}
 	}
 	//if ($debug) {
@@ -632,4 +679,4 @@ if (count($message_content) == 3) {
 		}
 	}
 
-?>
+?>

+ 26 - 0
resources/functions/message_media_builder.php

@@ -0,0 +1,26 @@
+<?php	
+//Build a media array with keys defined by the elements of the $items array.
+//Each key has an auto-incremented number appended to it, starting from 0 ($index)
+//Only insert into the media array if all elements with the same index exist in $searchArray
+function message_media_builder($searchArray, $keys){
+    $mediaArray = [];
+    $index = 0;
+    while($index >= 0){
+        $insert = true;
+        foreach ($keys as $key){
+            $param = $key.strval($index);
+            if(!isset($searchArray[$param])){
+                $insert = false;
+                break;
+            }
+            $tmp[$key] = $searchArray[$param];
+        }
+
+        if($insert == false){ break; }
+
+        $mediaArray[] = $tmp;
+        $index++;
+    }
+    return $mediaArray;	
+}
+?>

+ 445 - 0
resources/providers/settings.php

@@ -3563,4 +3563,449 @@
 	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
 	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
 
+	//isptelecom.net
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_name'] = 'isptelecom.net';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://www.isptelecom.net/';
+	$array['providers'][$x]['provider_signup'] = 'https://www.isptelecom.net/';
+	$array['providers'][$x]['provider_prices'] = 'https://www.isptelecom.net/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'ISP Telecom is a national provider of advanced telecommunications solutions designed to meet the demanding requirements for wholesale, VOIP and ISDN PRIs. We deliver solutions to our customers, tailor made to their specific needs.';
+
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '019113bf-5e57-75c2-bfa0-7f957fc356d3';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'mixed';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c27f1468-95cf-4978-ae49-a2ef2e63497c';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'msg';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '743fd3ae-33b6-491e-9cbd-38b10ef7baa8';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a20eced0-afd8-498d-a81c-b883978b31f5';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'Body';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'aea1ffc1-3d33-49df-a701-b8120ae8315a';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'From';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cb1d42b1-255c-4ad9-ae75-59f83acb5de7';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'To';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '51d0d0da-7328-4b31-b8ac-38deec3293b4';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'MediaContentType';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e5dd4c87-7129-4182-a1b1-60efc1e6ae38';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_url';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'MediaUrl';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '36a64741-195b-4647-a5fb-5ae560ada7ac';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '469d16ec-bd01-48af-9c23-e0b48aa8898a';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'xxxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f5a2c112-762a-4322-bce1-457285bf19fc';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'rxxxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms - Strip the +';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '0ab5fe8d-f082-4542-8256-e1f2ded2f346';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'rxxxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms - Strip the +';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7c344bdf-95c2-4ce7-bc34-c14a879a908e';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'xxxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ddf6fff6-b063-4532-8fe6-991f3c826a72';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'POST';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f7fba18b-bcfd-46f6-8737-6c434f3de854';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'inbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'response';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'ok';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7edc54fc-8eeb-4f48-9d49-147155d77011';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'POST';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '1f1ad195-317b-4215-a4fb-1899d55aebd0';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_password';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms - Auth Token';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '21e2972a-5c7e-4c04-b40c-cb58747cfce0';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_username';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms - Messaging Account ID';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cc5cf9ad-a694-4e24-8fc7-53bd02cddccf';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'msg';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c93b5959-44c3-45c9-96e4-6ac550fcce71';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'src';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c5ebbcdc-cfcc-48a2-a407-ba5fad611d58';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'POST';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '572c7855-d674-4791-8e60-9759bb0b8490';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'Body';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4b88aabf-ee22-4a95-9794-91b934ff2478';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'From';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b94103d6-84d9-44f8-9312-780f424d32d5';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'To';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '955450ee-8d7e-464f-b897-2ecb0c46b890';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_url';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'MediaUrl[]';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9f712607-6af2-4ac7-a031-a73b274d40e2';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'dst';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2fc2022d-d872-4b41-b489-247a25995546';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'destination';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_destination';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'https://smsc.isptelecom.net/api.php?token=${http_auth_password}&cmd=sendsms&src=${from}&dst=${to}&concat=1&msg=${message_text}';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '89f156c4-a25e-48b3-9bee-4d557761e294';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'destination';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_http_destination';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'https://smsc.isptelecom.net/v2/Accounts/${http_auth_username}/Messages.json';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2bc86cfa-0ab9-4773-aef6-b3d1994993ab';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms - Add 1';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '072c6249-fb51-4899-808c-07099654cf1d';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_from';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '+1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms - Add +1';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '1890cb11-dc66-4f27-b92b-53a9692f2f84';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '+1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms - Add +1';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a2d014b6-c265-44e7-8b3a-e4a57ac2a64b';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'format';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms - Add 1';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '334781ed-9df8-4e3a-b631-201d22ce5f6f';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'GET';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '292bae85-3e4a-49c2-9c36-a7aeb36a7724';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_http_method';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'POST';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2d46dabd-0562-4181-92fd-c87a99ff8a92';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'response';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_content';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'ok';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'true';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '6d8d356e-69eb-42e6-a5d3-8c58042b46a0';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '205.205.22.26/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+	$y++;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = 'ebc20b74-4c28-4b70-ada5-3048f101b4d4';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '127d06ff-6c01-4202-8e2a-cc1b78fb2462';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '205.205.86.26/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+	$y++;
 ?>

+ 122 - 82
resources/service/message_send_outbound.php

@@ -202,23 +202,35 @@
 	//print_r($provider_settings, false);
 	//echo "\n";
 
-//set default values
-	$http_method = 'POST';
-
 //process the provider settings array
 	foreach ($provider_settings as $row) {
 		//format the phone numbers
 		if ($row['provider_setting_subcategory'] == 'format') {
-			if ($row['provider_setting_name'] == 'message_from') {
-				$message_from = format_string($row['provider_setting_value'], $message_from);
-			}
-			if ($row['provider_setting_name'] == 'message_to') {
-				$message_to = format_string($row['provider_setting_value'], $message_to);
-				if ($row['provider_setting_type'] == 'array') {
-					$message_to_type = 'array';
+			if($message_type == 'sms'){
+				if ($row['provider_setting_name'] == 'message_from') {
+					$message_from = format_string($row['provider_setting_value'], $message_from);
+				}
+				if ($row['provider_setting_name'] == 'message_to') {
+					$message_to = format_string($row['provider_setting_value'], $message_to);
+					if ($row['provider_setting_type'] == 'array') {
+						$message_to_type = 'array';
+					}
+					else {
+						$message_to_type = 'text';
+					}
 				}
-				else {
-					$message_to_type = 'text';
+			}else{
+				if ($row['provider_setting_name'] == 'message_media_message_from') {
+					$message_from = format_string($row['provider_setting_value'], $message_from);
+				}
+				if ($row['provider_setting_name'] == 'message_media_message_to') {
+					$message_to = format_string($row['provider_setting_value'], $message_to);
+					if ($row['provider_setting_type'] == 'array') {
+						$message_to_type = 'array';
+					}
+					else {
+						$message_to_type = 'text';
+					}
 				}
 			}
 		}
@@ -227,12 +239,28 @@
 		$setting[$row['provider_setting_name']] = $row['provider_setting_value'];
 	}
 
-//get the content location for the destinaion numer
+//set http_method
+	$http_method = ($message_type == 'sms') ? $setting['http_method'] : $setting['message_media_http_method'];
+	if (empty($http_method)) {
+		$http_method = 'POST';
+	}
+
+//get the content location for the destination number
 	if (isset($setting['type'])) {
 		$content_type = strtolower($setting['type']);
 	}
-	if (isset($setting['content_type'])) {
-		$content_type = strtolower($setting['content_type']);
+	
+	if($message_type == 'sms'){
+		if (isset($setting['content_type'])) {
+			$content_type = strtolower($setting['content_type']);
+		}
+	}else{
+		if (isset($setting['message_media_content_type'])) {
+			$content_type = strtolower($setting['message_media_content_type']);
+		}
+	}
+	if (empty($content_type)) {
+		$content_type = 'post';
 	}
 
 //send information to the console
@@ -257,63 +285,74 @@
 	//		//$outbound_array = build_array($outbound_array, $row['provider_setting_subcategory'], $value);
 	//		$outbound_array = build_array($outbound_array, $row['provider_setting_name'], $value);
 	//}
-
 //process the provider settings array
 	foreach ($provider_settings as $row) {
 		if ($row['provider_setting_subcategory'] == 'content') {
-			if ($row['provider_setting_name'] == 'message_from') {
-				$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_from);
+			if ($message_type == 'sms'){
+				if ($row['provider_setting_name'] == 'message_from') { 
+					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_from);
+				}
 			}
-			if ($row['provider_setting_name'] == 'message_to') {
-				if ($row['provider_setting_type'] == 'array') {
-					//send the message to as an array
-					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], explode(",", $message_to));
+			else {
+				if ($row['provider_setting_name'] == 'message_media_message_from') { 
+					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_from);
 				}
-				else {
-					//sent the message to as text
-					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_to);
+			}
+
+			if ($message_type == 'sms'){
+				if ($row['provider_setting_name'] == 'message_to') {
+					if ($row['provider_setting_type'] == 'array') {
+						//send the message to as an array
+						$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], explode(",", $message_to));
+					}
+					else {
+						$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_to);
+					}
+				}
+			}
+			else {
+				if ($row['provider_setting_name'] == 'message_media_message_to') {
+					if ($row['provider_setting_type'] == 'array') {
+						//send the message to as an array
+						$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], explode(",", $message_to));
+					}
+					else {
+						$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_to);
+					}
 				}
 			}
-			if ($row['provider_setting_name'] == 'message_content') {
-				$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_text);
+
+			if ($message_type == 'sms'){
+				if ($row['provider_setting_name'] == 'message_content') { 
+					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_text);
+				}
+			}else{
+				if ($row['provider_setting_name'] == 'message_media_message_content') { 
+					$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], $message_text);
+				}
 			}
+
+
 			if ($row['provider_setting_name'] == 'message_other') {
 				$outbound_array = build_array($outbound_array ?? [], explode('=', $row['provider_setting_value'])[0], explode('=', $row['provider_setting_value'])[1]);
 			}
-
-			if (is_array($message_media) && @sizeof($message_media) != 0) {
-				//echo __line__."\n";
-				//echo "provider_setting_name ".$row['provider_setting_name']. "\n";
+			if (is_array($message_media) && @sizeof($message_media) != 0) { 
 				if ($row['provider_setting_name'] == 'message_media_other') {
-					//echo __line__."\n";
-					//echo "key".explode('=', $row['provider_setting_value'])[0]." value ".explode('=', $row['provider_setting_value'])[1]."\n";
 					$outbound_array = build_array($outbound_array ?? [], explode('=', $row['provider_setting_value'])[0], explode('=', $row['provider_setting_value'])[1]);
 				}
-				foreach($message_media as $index => $media) {
-					if ($row['provider_setting_name'] == 'message_media_url') {
-						//$media['message_media_uuid']
-						//$media['message_media_type']
-						//$outbound_array = build_array($outbound_array ?? [], $message_content, 'message_content');
-						//$outbound_array = build_array($outbound_array ?? [], 'message_content', $message_text);
-						//$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'], urldecode($media['message_media_url']));
+
+				if ($row['provider_setting_name'] == 'message_media_url') { 
+					foreach($message_media as $index => $media) {
 						$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_value'].".".$index, urldecode($media['message_media_url']));
-					}
+						
+					}	
 				}
 			}
-			//print_r($outbound_array);
-			//$value = str_replace("\${message_from}", $message_from, $value);
-			//$value = str_replace("\${message_to}", $message_to, $value);
-			//$value = str_replace("\${message_content}", $message_text, $value);
-
-			//$value = str_replace("message_from", $message_from, $value);
-			//$value = str_replace("message_to", $message_to, $value);
-			//$value = str_replace("message_content", $message_text, $value);
-
-			//$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_subcategory'], $value);
-			//$outbound_array = build_array($outbound_array ?? [], $row['provider_setting_name'], $value);
 		}
 	}
 
+
+
 //log info
 	//view_array($provider_settings, false);
 	//echo "value ".$value."\n";
@@ -334,42 +373,35 @@
 
 //convert fields into a http get or post query string
 	if ($content_type == 'get' || $content_type == 'post') {
-
-		//process the provider settings array
-		//foreach ($provider_settings as $row) {
-		//	if ($row['provider_setting_subcategory'] == 'content') {
-		//		if ($row['provider_setting_name'] == 'message_from') {
-		//			$url_parameters[$row['provider_setting_value']] = $message_from;
-		//		}
-		//		if ($row['provider_setting_name'] == 'message_to') {
-		//			$url_parameters[$row['provider_setting_value']] = $message_to;
-		//		}
-		//		if ($row['provider_setting_name'] == 'message_content') {
-		//			$url_parameters[$row['provider_setting_value']] = $message_text;
-		//		}
-		//		if ($row['provider_setting_name'] == 'message_other') {
-		//			$url_parameters[explode('=', $row['provider_setting_value'])[0]] = explode('=', $row['provider_setting_value'])[1];
-		//		}
-		//	}
-		//}
-
 		//build the query string
 		$x = 0;
 		$query_string = '';
 		foreach ($outbound_array as $key => $value) {
 			if ($x != 0) { $query_string .= '&'; }
-			$query_string .= $key.'='. urlencode($value);
+			if(is_array($value)){
+				$y = 0;
+				foreach($value as $v){
+					if ($y != 0) { $query_string .= '&'; }
+					$query_string .= $key.'='. urlencode($v);	
+					$y++;
+				}
+			}else{
+				$query_string .= $key.'='. urlencode($value);
+			}
 			$x++;
 		}
+
 		$http_content = $query_string;
 	}
-
 //exchange variable name with their values
-	$setting['http_destination'] = str_replace("\${from}", urlencode($message_from), $setting['http_destination']);
-	$setting['http_destination'] = str_replace("\${message_from}", urlencode($message_from), $setting['http_destination']);
-	$setting['http_destination'] = str_replace("\${to}", urlencode($message_to), $setting['http_destination']);
-	$setting['http_destination'] = str_replace("\${message_to}", urlencode($message_to), $setting['http_destination']);
-	$setting['http_destination'] = str_replace("\${message_text}", urlencode($message_text), $setting['http_destination']);
+	$http_destination = ($message_type == 'sms') ? $setting['http_destination'] : $setting['message_media_http_destination'];
+	$http_destination = str_replace("\${from}", urlencode($message_from), $http_destination);
+	$http_destination = str_replace("\${message_from}", urlencode($message_from), $http_destination);
+	$http_destination = str_replace("\${to}", urlencode($message_to), $http_destination);
+	$http_destination = str_replace("\${message_to}", urlencode($message_to), $http_destination);
+	$http_destination = str_replace("\${message_text}", urlencode($message_text), $http_destination);
+	$http_destination = str_replace("\${http_auth_username}", urlencode($setting['http_auth_username']), $http_destination);
+	$http_destination = str_replace("\${http_auth_password}", urlencode($setting['http_auth_password']), $http_destination);
 
 //logging info
 	//view_array($setting, false);
@@ -414,7 +446,7 @@
 
 //send the message - working
 /*
-	$cmd = "curl ".$setting['http_destination']." -X ".$setting['http_method']." ";
+	$cmd = "curl ".	$http_destination;." -X ".$setting['http_method']." ";
 	if (isset($setting['http_auth_username']) && isset($setting['http_auth_password'])) {
 		$cmd .= "-u ".$setting['http_auth_username'].":".$setting['http_auth_password']." ";
 	}
@@ -435,7 +467,7 @@
 
 //prepare the http headers
 	if (isset($setting['http_content_type'])) {
-		$http_headers[] = 'Content-Type: '.$setting['http_content_type'];
+		$http_headers[] = 'Content-Type: '.$setting['http_content_type'];;
 	}
 	foreach ($provider_settings as $row) {
 		if ($row['provider_setting_subcategory'] == 'header' && $row['provider_setting_name'] != 'http_content_type') {
@@ -446,12 +478,20 @@
 	//echo "headers_array\n";
 	//print_r($http_headers);
 
+	if (isset($debug)) {
+		echo "http_content: ".print_r($http_content, true)."\n";
+		echo "http_destination: $http_destination \n";
+		echo "http_username: {$setting['http_auth_username']} \n";
+		echo "http_token: {$setting['http_auth_password']} \n";
+		echo "http_method: $http_method \n";
+	}
+
 //create the curl resource
 	$ch = curl_init();
 
 //set the curl options
 	curl_setopt($ch, CURLOPT_VERBOSE, 1);
-	curl_setopt($ch, CURLOPT_URL, $setting['http_destination']);
+	curl_setopt($ch, CURLOPT_URL, $http_destination);
 	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 	if (isset($setting['http_auth_username']) && isset($setting['http_auth_password'])) {
 		curl_setopt($ch, CURLOPT_USERPWD, $setting['http_auth_username'] . ':' . $setting['http_auth_password']);
@@ -461,7 +501,7 @@
 		curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);
 	}
 	curl_setopt($ch, CURLOPT_VERBOSE, 1);
-	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $setting['http_method']);
+	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($http_method));
 	curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
 	curl_setopt($ch, CURLOPT_POSTFIELDS, $http_content); // file_get_contents($file_path.'/'.$file_name));
 	curl_setopt($ch, CURLOPT_POST, 1);