Ver código fonte

Release Messages version 1.17

markjcrane 2 anos atrás
pai
commit
03d7f56b91

+ 0 - 1
README.md

@@ -1 +0,0 @@
-# fusionpbx-app-messages

+ 486 - 0
app_config.php

@@ -0,0 +1,486 @@
+<?php
+
+	//application details
+		$apps[$x]['name'] = 'Messages';
+		$apps[$x]['uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+		$apps[$x]['category'] = 'System';
+		$apps[$x]['subcategory'] = 'SMS';
+		$apps[$x]['version'] = '1.17';
+		$apps[$x]['license'] = 'Member';
+		$apps[$x]['url'] = 'http://www.fusionpbx.com';
+		$apps[$x]['description']['en-us'] = 'A browser based SMS and MMS client.';
+
+	//permission details
+		$y = 0;
+		$apps[$x]['permissions'][$y]['name'] = 'message_view';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_add';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_edit';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_delete';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_all';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_media_view';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_media_add';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_media_edit';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_media_delete';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = 'message_key';
+		//$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		$y++;
+
+	//default settings
+		$y=0;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "37bfb42d-6169-4e93-a2ff-3ed77b7289b1";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "message";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "limit";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "50";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the message limit to display.";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "bdde77ec-e7eb-4b0f-8455-9ed46fc2a0ee";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "message";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "notify_sound";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "/app/messages/resources/audio/sounds-1143-clearly.mp3";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the message notify sound file.";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "2825a8af-738f-45a6-bf51-5ed852b24d2c";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_me_background_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#a3e1fd";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "3831edac-24cf-433d-82eb-ab5a653554cd";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_me_border_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#cbf0ff";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "38802918-eb93-4ee0-809b-fa924d37d019";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_me_text_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#000";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "cf96ec30-9848-430b-a998-c4de001c4816";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_em_background_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#b1fda5";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "094ad114-49db-4c91-a511-881d3a7664fa";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_em_border_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#cffec7";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+		$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "8d4ec0bf-7cb9-4ef1-9fb2-f8584e6916e3";
+		$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
+		$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "message_bubble_em_text_color";
+		$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
+		$apps[$x]['default_settings'][$y]['default_setting_value'] = "#000";
+		$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
+		$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
+		$y++;
+
+	//message queues table
+		$y = 0;
+		$apps[$x]['db'][$y]['table']['name'] = 'v_message_queue';
+		$apps[$x]['db'][$y]['table']['parent'] = '';
+		$z = 0;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_queue_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'provider_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_providers';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'provider_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_users';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'user_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_groups';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'group_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'hostname';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the hostname.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_type';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message type.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_status';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message status.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_direction';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message direction.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'timestamp';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message date.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_from'; //alternative: message_source
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message from.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_to'; //alternative: message_destination
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message to.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_text';  //alternative names: message_content
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message text.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_json';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_debug';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+
+	//messages table
+		$y++;
+		$apps[$x]['db'][$y]['table']['name'] = 'v_messages';
+		$apps[$x]['db'][$y]['table']['parent'] = '';
+		$z = 0;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'provider_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_providers';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'provider_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_users';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'user_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_groups';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'group_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'hostname';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the hostname.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_type';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message type.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_direction';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message direction.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'timestamp';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message date.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_read';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'boolean';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'boolean';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'boolean';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message read.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_from'; //alternative: message_source
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message from.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_to'; //alternative: message_destination
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message to.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_text';  //alternative names: message_content
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message text.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_json';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+
+	//message media table
+		$y++;
+		$apps[$x]['db'][$y]['table']['name'] = 'v_message_media';
+		$apps[$x]['db'][$y]['table']['parent'] = 'v_messages';
+		$z = 0;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_messages';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'message_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_users';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'user_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_name';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media name.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_type';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media type.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_url';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media url.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'timestamp';
+		$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media date.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'message_media_content';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the message media content.';
+		$z++;
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_date";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "update_user";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+
+?>

+ 9 - 0
app_defaults.php

@@ -0,0 +1,9 @@
+<?php
+
+//process this code online once
+if ($domains_processed == 1) {
+
+
+}
+
+?>

+ 874 - 0
app_languages.php

@@ -0,0 +1,874 @@
+<?php
+
+	//Messages
+		$text['title-messages']['en-us'] = 'Messages';
+		$text['title-messages']['en-gb'] = 'Messages';
+		$text['title-messages']['ar-eg'] = 'Messages';
+		$text['title-messages']['de-at'] = 'Messages';
+		$text['title-messages']['de-ch'] = 'Messages';
+		$text['title-messages']['de-de'] = 'Messages';
+		$text['title-messages']['es-cl'] = 'Messages';
+		$text['title-messages']['es-mx'] = 'Messages';
+		$text['title-messages']['fr-ca'] = 'Messages';
+		$text['title-messages']['fr-fr'] = 'Messages';
+		$text['title-messages']['he-il'] = 'Messages';
+		$text['title-messages']['it-it'] = 'Messages';
+		$text['title-messages']['nl-nl'] = 'Boodschappen';
+		$text['title-messages']['pl-pl'] = 'Messages';
+		$text['title-messages']['pt-br'] = 'Messages';
+		$text['title-messages']['pt-pt'] = 'Messages';
+		$text['title-messages']['ro-ro'] = 'Messages';
+		$text['title-messages']['ru-ru'] = 'Messages';
+		$text['title-messages']['sv-se'] = 'Messages';
+		$text['title-messages']['uk-ua'] = 'Messages';
+
+		$text['title-message']['en-us'] = 'Message';
+		$text['title-message']['en-gb'] = 'Message';
+		$text['title-message']['ar-eg'] = 'Message';
+		$text['title-message']['de-at'] = 'Message';
+		$text['title-message']['de-ch'] = 'Message';
+		$text['title-message']['de-de'] = 'Message';
+		$text['title-message']['es-cl'] = 'Message';
+		$text['title-message']['es-mx'] = 'Message';
+		$text['title-message']['fr-ca'] = 'Message';
+		$text['title-message']['fr-fr'] = 'Message';
+		$text['title-message']['he-il'] = 'Message';
+		$text['title-message']['it-it'] = 'Message';
+		$text['title-message']['nl-nl'] = 'Boodschap';
+		$text['title-message']['pl-pl'] = 'Message';
+		$text['title-message']['pt-br'] = 'Message';
+		$text['title-message']['pt-pt'] = 'Message';
+		$text['title-message']['ro-ro'] = 'Message';
+		$text['title-message']['ru-ru'] = 'Message';
+		$text['title-message']['sv-se'] = 'Message';
+		$text['title-message']['uk-ua'] = 'Message';
+
+		$text['title-message_log']['en-us'] = 'Message Log';
+		$text['title-message_log']['en-gb'] = 'Message Log';
+		$text['title-message_log']['ar-eg'] = 'Message Log';
+		$text['title-message_log']['de-at'] = 'Message Log';
+		$text['title-message_log']['de-ch'] = 'Message Log';
+		$text['title-message_log']['de-de'] = 'Message Log';
+		$text['title-message_log']['es-cl'] = 'Message Log';
+		$text['title-message_log']['es-mx'] = 'Message Log';
+		$text['title-message_log']['fr-ca'] = 'Message Log';
+		$text['title-message_log']['fr-fr'] = 'Message Log';
+		$text['title-message_log']['he-il'] = 'Message Log';
+		$text['title-message_log']['it-it'] = 'Message Log';
+		$text['title-message_log']['nl-nl'] = 'Boodschap log';
+		$text['title-message_log']['pl-pl'] = 'Message Log';
+		$text['title-message_log']['pt-br'] = 'Message Log';
+		$text['title-message_log']['pt-pt'] = 'Message Log';
+		$text['title-message_log']['ro-ro'] = 'Message Log';
+		$text['title-message_log']['ru-ru'] = 'Message Log';
+		$text['title-message_log']['sv-se'] = 'Message Log';
+		$text['title-message_log']['uk-ua'] = 'Message Log';
+
+		$text['label-message_type']['en-us'] = 'Type';
+		$text['label-message_type']['en-gb'] = 'Type';
+		$text['label-message_type']['ar-eg'] = 'Type';
+		$text['label-message_type']['de-at'] = 'Type';
+		$text['label-message_type']['de-ch'] = 'Type';
+		$text['label-message_type']['de-de'] = 'Type';
+		$text['label-message_type']['es-cl'] = 'Type';
+		$text['label-message_type']['es-mx'] = 'Type';
+		$text['label-message_type']['fr-ca'] = 'Type';
+		$text['label-message_type']['fr-fr'] = 'Type';
+		$text['label-message_type']['he-il'] = 'Type';
+		$text['label-message_type']['it-it'] = 'Type';
+		$text['label-message_type']['nl-nl'] = 'Type';
+		$text['label-message_type']['pl-pl'] = 'Type';
+		$text['label-message_type']['pt-br'] = 'Type';
+		$text['label-message_type']['pt-pt'] = 'Type';
+		$text['label-message_type']['ro-ro'] = 'Type';
+		$text['label-message_type']['ru-ru'] = 'Type';
+		$text['label-message_type']['sv-se'] = 'Type';
+		$text['label-message_type']['uk-ua'] = 'Type';
+
+		$text['description-message_type']['en-us'] = 'Enter the message type.';
+		$text['description-message_type']['en-gb'] = 'Enter the message type.';
+		$text['description-message_type']['ar-eg'] = 'Enter the message type.';
+		$text['description-message_type']['de-at'] = 'Enter the message type.';
+		$text['description-message_type']['de-ch'] = 'Enter the message type.';
+		$text['description-message_type']['de-de'] = 'Enter the message type.';
+		$text['description-message_type']['es-cl'] = 'Enter the message type.';
+		$text['description-message_type']['es-mx'] = 'Enter the message type.';
+		$text['description-message_type']['fr-ca'] = 'Enter the message type.';
+		$text['description-message_type']['fr-fr'] = 'Enter the message type.';
+		$text['description-message_type']['he-il'] = 'Enter the message type.';
+		$text['description-message_type']['it-it'] = 'Enter the message type.';
+		$text['description-message_type']['nl-nl'] = 'Voer boodschap type in.';
+		$text['description-message_type']['pl-pl'] = 'Enter the message type.';
+		$text['description-message_type']['pt-br'] = 'Enter the message type.';
+		$text['description-message_type']['pt-pt'] = 'Enter the message type.';
+		$text['description-message_type']['ro-ro'] = 'Enter the message type.';
+		$text['description-message_type']['ru-ru'] = 'Enter the message type.';
+		$text['description-message_type']['sv-se'] = 'Enter the message type.';
+		$text['description-message_type']['uk-ua'] = 'Enter the message type.';
+
+		$text['label-sms']['en-us'] = 'SMS';
+		$text['label-sms']['en-gb'] = 'SMS';
+		$text['label-sms']['ar-eg'] = 'SMS';
+		$text['label-sms']['de-at'] = 'SMS';
+		$text['label-sms']['de-ch'] = 'SMS';
+		$text['label-sms']['de-de'] = 'SMS';
+		$text['label-sms']['es-mx'] = 'SMS';
+		$text['label-sms']['fr-ca'] = 'SMS';
+		$text['label-sms']['fr-fr'] = 'SMS';
+		$text['label-sms']['he-il'] = 'SMS';
+		$text['label-sms']['it-it'] = 'SMS';
+		$text['label-sms']['nl-nl'] = 'SMS';
+		$text['label-sms']['pl-pl'] = 'SMS';
+		$text['label-sms']['pt-br'] = 'SMS';
+		$text['label-sms']['pt-pt'] = 'SMS';
+		$text['label-sms']['ro-ro'] = 'SMS';
+		$text['label-sms']['ru-ru'] = 'SMS';
+		$text['label-sms']['sv-se'] = 'SMS';
+		$text['label-sms']['uk-ua'] = 'SMS';
+
+		$text['label-mms']['en-us'] = 'MMS';
+		$text['label-mms']['en-gb'] = 'MMS';
+		$text['label-mms']['ar-eg'] = 'MMS';
+		$text['label-mms']['de-at'] = 'MMS';
+		$text['label-mms']['de-ch'] = 'MMS';
+		$text['label-mms']['de-de'] = 'MMS';
+		$text['label-mms']['es-mx'] = 'MMS';
+		$text['label-mms']['fr-ca'] = 'MMS';
+		$text['label-mms']['fr-fr'] = 'MMS';
+		$text['label-mms']['he-il'] = 'MMS';
+		$text['label-mms']['it-it'] = 'MMS';
+		$text['label-mms']['nl-nl'] = 'MMS';
+		$text['label-mms']['pl-pl'] = 'MMS';
+		$text['label-mms']['pt-br'] = 'MMS';
+		$text['label-mms']['pt-pt'] = 'MMS';
+		$text['label-mms']['ro-ro'] = 'MMS';
+		$text['label-mms']['ru-ru'] = 'MMS';
+		$text['label-mms']['sv-se'] = 'MMS';
+		$text['label-mms']['uk-ua'] = 'MMS';
+
+		$text['label-sms']['en-us'] = 'SMS';
+		$text['label-sms']['en-gb'] = 'SMS';
+		$text['label-sms']['ar-eg'] = 'SMS';
+		$text['label-sms']['de-at'] = 'SMS';
+		$text['label-sms']['de-ch'] = 'SMS';
+		$text['label-sms']['de-de'] = 'SMS';
+		$text['label-sms']['es-mx'] = 'SMS';
+		$text['label-sms']['fr-ca'] = 'SMS';
+		$text['label-sms']['fr-fr'] = 'SMS';
+		$text['label-sms']['he-il'] = 'SMS';
+		$text['label-sms']['it-it'] = 'SMS';
+		$text['label-sms']['nl-nl'] = 'SMS';
+		$text['label-sms']['pl-pl'] = 'SMS';
+		$text['label-sms']['pt-br'] = 'SMS';
+		$text['label-sms']['pt-pt'] = 'SMS';
+		$text['label-sms']['ro-ro'] = 'SMS';
+		$text['label-sms']['ru-ru'] = 'SMS';
+		$text['label-sms']['sv-se'] = 'SMS';
+		$text['label-sms']['uk-ua'] = 'SMS';
+
+		$text['label-sip']['en-us'] = 'SIP';
+		$text['label-sip']['en-gb'] = 'SIP';
+		$text['label-sip']['ar-eg'] = 'SIP';
+		$text['label-sip']['de-at'] = 'SIP';
+		$text['label-sip']['de-ch'] = 'SIP';
+		$text['label-sip']['de-de'] = 'SIP';
+		$text['label-sip']['es-mx'] = 'SIP';
+		$text['label-sip']['fr-ca'] = 'SIP';
+		$text['label-sip']['fr-fr'] = 'SIP';
+		$text['label-sip']['he-il'] = 'SIP';
+		$text['label-sip']['it-it'] = 'SIP';
+		$text['label-sip']['nl-nl'] = 'SIP';
+		$text['label-sip']['pl-pl'] = 'SIP';
+		$text['label-sip']['pt-br'] = 'SIP';
+		$text['label-sip']['pt-pt'] = 'SIP';
+		$text['label-sip']['ro-ro'] = 'SIP';
+		$text['label-sip']['ru-ru'] = 'SIP';
+		$text['label-sip']['sv-se'] = 'SIP';
+		$text['label-sip']['uk-ua'] = 'SIP';
+
+		$text['label-chat']['en-us'] = 'Chat';
+		$text['label-chat']['en-gb'] = 'Chat';
+		$text['label-chat']['ar-eg'] = 'Chat';
+		$text['label-chat']['de-at'] = 'Chat';
+		$text['label-chat']['de-ch'] = 'Chat';
+		$text['label-chat']['de-de'] = 'Chat';
+		$text['label-chat']['es-mx'] = 'Chat';
+		$text['label-chat']['fr-ca'] = 'Chat';
+		$text['label-chat']['fr-fr'] = 'Chat';
+		$text['label-chat']['he-il'] = 'Chat';
+		$text['label-chat']['it-it'] = 'Chat';
+		$text['label-chat']['nl-nl'] = 'Chat';
+		$text['label-chat']['pl-pl'] = 'Chat';
+		$text['label-chat']['pt-br'] = 'Chat';
+		$text['label-chat']['pt-pt'] = 'Chat';
+		$text['label-chat']['ro-ro'] = 'Chat';
+		$text['label-chat']['ru-ru'] = 'Chat';
+		$text['label-chat']['sv-se'] = 'Chat';
+		$text['label-chat']['uk-ua'] = 'Chat';
+
+		$text['label-message']['en-us'] = 'Message';
+		$text['label-message']['en-gb'] = 'Message';
+		$text['label-message']['ar-eg'] = 'Message';
+		$text['label-message']['de-at'] = 'Message';
+		$text['label-message']['de-ch'] = 'Message';
+		$text['label-message']['de-de'] = 'Message';
+		$text['label-message']['es-mx'] = 'Message';
+		$text['label-message']['fr-ca'] = 'Message';
+		$text['label-message']['fr-fr'] = 'Message';
+		$text['label-message']['he-il'] = 'Message';
+		$text['label-message']['it-it'] = 'Message';
+		$text['label-message']['nl-nl'] = 'Boodschap';
+		$text['label-message']['pl-pl'] = 'Message';
+		$text['label-message']['pt-br'] = 'Message';
+		$text['label-message']['pt-pt'] = 'Message';
+		$text['label-message']['ro-ro'] = 'Message';
+		$text['label-message']['ru-ru'] = 'Message';
+		$text['label-message']['sv-se'] = 'Message';
+		$text['label-message']['uk-ua'] = 'Message';
+
+		$text['label-messages']['en-us'] = 'Messages';
+		$text['label-messages']['en-gb'] = 'Messages';
+		$text['label-messages']['ar-eg'] = 'Messages';
+		$text['label-messages']['de-at'] = 'Messages';
+		$text['label-messages']['de-ch'] = 'Messages';
+		$text['label-messages']['de-de'] = 'Messages';
+		$text['label-messages']['es-mx'] = 'Messages';
+		$text['label-messages']['fr-ca'] = 'Messages';
+		$text['label-messages']['fr-fr'] = 'Messages';
+		$text['label-messages']['he-il'] = 'Messages';
+		$text['label-messages']['it-it'] = 'Messages';
+		$text['label-messages']['nl-nl'] = 'Boodschappen';
+		$text['label-messages']['pl-pl'] = 'Messages';
+		$text['label-messages']['pt-br'] = 'Messages';
+		$text['label-messages']['pt-pt'] = 'Messages';
+		$text['label-messages']['ro-ro'] = 'Messages';
+		$text['label-messages']['ru-ru'] = 'Messages';
+		$text['label-messages']['sv-se'] = 'Messages';
+		$text['label-messages']['uk-ua'] = 'Messages';
+
+		$text['label-message_direction']['en-us'] = 'Direction';
+		$text['label-message_direction']['en-gb'] = 'Direction';
+		$text['label-message_direction']['ar-eg'] = 'Direction';
+		$text['label-message_direction']['de-at'] = 'Direction';
+		$text['label-message_direction']['de-ch'] = 'Direction';
+		$text['label-message_direction']['de-de'] = 'Direction';
+		$text['label-message_direction']['es-cl'] = 'Direction';
+		$text['label-message_direction']['es-mx'] = 'Direction';
+		$text['label-message_direction']['fr-ca'] = 'Direction';
+		$text['label-message_direction']['fr-fr'] = 'Direction';
+		$text['label-message_direction']['he-il'] = 'Direction';
+		$text['label-message_direction']['it-it'] = 'Direction';
+		$text['label-message_direction']['nl-nl'] = 'Richting';
+		$text['label-message_direction']['pl-pl'] = 'Direction';
+		$text['label-message_direction']['pt-br'] = 'Direction';
+		$text['label-message_direction']['pt-pt'] = 'Direction';
+		$text['label-message_direction']['ro-ro'] = 'Direction';
+		$text['label-message_direction']['ru-ru'] = 'Direction';
+		$text['label-message_direction']['sv-se'] = 'Direction';
+		$text['label-message_direction']['uk-ua'] = 'Direction';
+
+		$text['description-message_direction']['en-us'] = 'Enter the message direction.';
+		$text['description-message_direction']['en-gb'] = 'Enter the message direction.';
+		$text['description-message_direction']['ar-eg'] = 'Enter the message direction.';
+		$text['description-message_direction']['de-at'] = 'Enter the message direction.';
+		$text['description-message_direction']['de-ch'] = 'Enter the message direction.';
+		$text['description-message_direction']['de-de'] = 'Enter the message direction.';
+		$text['description-message_direction']['es-cl'] = 'Enter the message direction.';
+		$text['description-message_direction']['es-mx'] = 'Enter the message direction.';
+		$text['description-message_direction']['fr-ca'] = 'Enter the message direction.';
+		$text['description-message_direction']['fr-fr'] = 'Enter the message direction.';
+		$text['description-message_direction']['he-il'] = 'Enter the message direction.';
+		$text['description-message_direction']['it-it'] = 'Enter the message direction.';
+		$text['description-message_direction']['nl-nl'] = 'Voer de boodschap richting in.';
+		$text['description-message_direction']['pl-pl'] = 'Enter the message direction.';
+		$text['description-message_direction']['pt-br'] = 'Enter the message direction.';
+		$text['description-message_direction']['pt-pt'] = 'Enter the message direction.';
+		$text['description-message_direction']['ro-ro'] = 'Enter the message direction.';
+		$text['description-message_direction']['ru-ru'] = 'Enter the message direction.';
+		$text['description-message_direction']['sv-se'] = 'Enter the message direction.';
+		$text['description-message_direction']['uk-ua'] = 'Enter the message direction.';
+
+		$text['label-outbound']['en-us'] = 'Outbound';
+		$text['label-outbound']['en-gb'] = 'Outbound';
+		$text['label-outbound']['ar-eg'] = 'Outbound';
+		$text['label-outbound']['de-at'] = 'Outbound';
+		$text['label-outbound']['de-ch'] = 'Outbound';
+		$text['label-outbound']['de-de'] = 'Outbound';
+		$text['label-outbound']['es-mx'] = 'Outbound';
+		$text['label-outbound']['fr-ca'] = 'Outbound';
+		$text['label-outbound']['fr-fr'] = 'Outbound';
+		$text['label-outbound']['he-il'] = 'Outbound';
+		$text['label-outbound']['it-it'] = 'Outbound';
+		$text['label-outbound']['nl-nl'] = 'Uitgaand';
+		$text['label-outbound']['pl-pl'] = 'Outbound';
+		$text['label-outbound']['pt-br'] = 'Outbound';
+		$text['label-outbound']['pt-pt'] = 'Outbound';
+		$text['label-outbound']['ro-ro'] = 'Outbound';
+		$text['label-outbound']['ru-ru'] = 'Outbound';
+		$text['label-outbound']['sv-se'] = 'Outbound';
+		$text['label-outbound']['uk-ua'] = 'Outbound';
+
+		$text['label-inbound']['en-us'] = 'Inbound';
+		$text['label-inbound']['en-gb'] = 'Inbound';
+		$text['label-inbound']['ar-eg'] = 'Inbound';
+		$text['label-inbound']['de-at'] = 'Inbound';
+		$text['label-inbound']['de-ch'] = 'Inbound';
+		$text['label-inbound']['de-de'] = 'Inbound';
+		$text['label-inbound']['es-mx'] = 'Inbound';
+		$text['label-inbound']['fr-ca'] = 'Inbound';
+		$text['label-inbound']['fr-fr'] = 'Inbound';
+		$text['label-inbound']['he-il'] = 'Inbound';
+		$text['label-inbound']['it-it'] = 'Inbound';
+		$text['label-inbound']['nl-nl'] = 'Inkomend';
+		$text['label-inbound']['pl-pl'] = 'Inbound';
+		$text['label-inbound']['pt-br'] = 'Inbound';
+		$text['label-inbound']['pt-pt'] = 'Inbound';
+		$text['label-inbound']['ro-ro'] = 'Inbound';
+		$text['label-inbound']['ru-ru'] = 'Inbound';
+		$text['label-inbound']['sv-se'] = 'Inbound';
+		$text['label-inbound']['uk-ua'] = 'Inbound';
+
+		$text['label-new_message']['en-us'] = 'New Message';
+		$text['label-new_message']['en-gb'] = 'New Message';
+		$text['label-new_message']['ar-eg'] = 'New Message';
+		$text['label-new_message']['de-at'] = 'New Message';
+		$text['label-new_message']['de-ch'] = 'New Message';
+		$text['label-new_message']['de-de'] = 'New Message';
+		$text['label-new_message']['es-mx'] = 'New Message';
+		$text['label-new_message']['fr-ca'] = 'New Message';
+		$text['label-new_message']['fr-fr'] = 'New Message';
+		$text['label-new_message']['he-il'] = 'New Message';
+		$text['label-new_message']['it-it'] = 'New Message';
+		$text['label-new_message']['nl-nl'] = 'Nieuwe boodschap';
+		$text['label-new_message']['pl-pl'] = 'New Message';
+		$text['label-new_message']['pt-br'] = 'New Message';
+		$text['label-new_message']['pt-pt'] = 'New Message';
+		$text['label-new_message']['ro-ro'] = 'New Message';
+		$text['label-new_message']['ru-ru'] = 'New Message';
+		$text['label-new_message']['sv-se'] = 'New Message';
+		$text['label-new_message']['uk-ua'] = 'New Message';
+
+		$text['label-log']['en-us'] = 'Log';
+		$text['label-log']['en-gb'] = 'Log';
+		$text['label-log']['ar-eg'] = 'Log';
+		$text['label-log']['de-at'] = 'Log';
+		$text['label-log']['de-ch'] = 'Log';
+		$text['label-log']['de-de'] = 'Log';
+		$text['label-log']['es-mx'] = 'Log';
+		$text['label-log']['fr-ca'] = 'Log';
+		$text['label-log']['fr-fr'] = 'Log';
+		$text['label-log']['he-il'] = 'Log';
+		$text['label-log']['it-it'] = 'Log';
+		$text['label-log']['nl-nl'] = 'Log';
+		$text['label-log']['pl-pl'] = 'Log';
+		$text['label-log']['pt-br'] = 'Log';
+		$text['label-log']['pt-pt'] = 'Log';
+		$text['label-log']['ro-ro'] = 'Log';
+		$text['label-log']['ru-ru'] = 'Log';
+		$text['label-log']['sv-se'] = 'Log';
+		$text['label-log']['uk-ua'] = 'Log';
+
+		$text['label-contacts']['en-us'] = 'Contacts';
+		$text['label-contacts']['en-gb'] = 'Contacts';
+		$text['label-contacts']['ar-eg'] = 'Contacts';
+		$text['label-contacts']['de-at'] = 'Contacts';
+		$text['label-contacts']['de-ch'] = 'Contacts';
+		$text['label-contacts']['de-de'] = 'Contacts';
+		$text['label-contacts']['es-mx'] = 'Contacts';
+		$text['label-contacts']['fr-ca'] = 'Contacts';
+		$text['label-contacts']['fr-fr'] = 'Contacts';
+		$text['label-contacts']['he-il'] = 'Contacts';
+		$text['label-contacts']['it-it'] = 'Contacts';
+		$text['label-contacts']['nl-nl'] = 'Kontacten';
+		$text['label-contacts']['pl-pl'] = 'Contacts';
+		$text['label-contacts']['pt-br'] = 'Contacts';
+		$text['label-contacts']['pt-pt'] = 'Contacts';
+		$text['label-contacts']['ro-ro'] = 'Contacts';
+		$text['label-contacts']['ru-ru'] = 'Contacts';
+		$text['label-contacts']['sv-se'] = 'Contacts';
+		$text['label-contacts']['uk-ua'] = 'Contacts';
+
+		$text['label-message_date']['en-us'] = 'Date';
+		$text['label-message_date']['en-gb'] = 'Date';
+		$text['label-message_date']['ar-eg'] = 'Date';
+		$text['label-message_date']['de-at'] = 'Date';
+		$text['label-message_date']['de-ch'] = 'Date';
+		$text['label-message_date']['de-de'] = 'Date';
+		$text['label-message_date']['es-cl'] = 'Date';
+		$text['label-message_date']['es-mx'] = 'Date';
+		$text['label-message_date']['fr-ca'] = 'Date';
+		$text['label-message_date']['fr-fr'] = 'Date';
+		$text['label-message_date']['he-il'] = 'Date';
+		$text['label-message_date']['it-it'] = 'Date';
+		$text['label-message_date']['nl-nl'] = 'Datum';
+		$text['label-message_date']['pl-pl'] = 'Date';
+		$text['label-message_date']['pt-br'] = 'Date';
+		$text['label-message_date']['pt-pt'] = 'Date';
+		$text['label-message_date']['ro-ro'] = 'Date';
+		$text['label-message_date']['ru-ru'] = 'Date';
+		$text['label-message_date']['sv-se'] = 'Date';
+		$text['label-message_date']['uk-ua'] = 'Date';
+
+		$text['description-message_date']['en-us'] = 'Enter the message date.';
+		$text['description-message_date']['en-gb'] = 'Enter the message date.';
+		$text['description-message_date']['ar-eg'] = 'Enter the message date.';
+		$text['description-message_date']['de-at'] = 'Enter the message date.';
+		$text['description-message_date']['de-ch'] = 'Enter the message date.';
+		$text['description-message_date']['de-de'] = 'Enter the message date.';
+		$text['description-message_date']['es-cl'] = 'Enter the message date.';
+		$text['description-message_date']['es-mx'] = 'Enter the message date.';
+		$text['description-message_date']['fr-ca'] = 'Enter the message date.';
+		$text['description-message_date']['fr-fr'] = 'Enter the message date.';
+		$text['description-message_date']['he-il'] = 'Enter the message date.';
+		$text['description-message_date']['it-it'] = 'Enter the message date.';
+		$text['description-message_date']['nl-nl'] = 'Voer een boodschapdatum in.';
+		$text['description-message_date']['pl-pl'] = 'Enter the message date.';
+		$text['description-message_date']['pt-br'] = 'Enter the message date.';
+		$text['description-message_date']['pt-pt'] = 'Enter the message date.';
+		$text['description-message_date']['ro-ro'] = 'Enter the message date.';
+		$text['description-message_date']['ru-ru'] = 'Enter the message date.';
+		$text['description-message_date']['sv-se'] = 'Enter the message date.';
+		$text['description-message_date']['uk-ua'] = 'Enter the message date.';
+
+		$text['label-message_from']['en-us'] = 'From';
+		$text['label-message_from']['en-gb'] = 'From';
+		$text['label-message_from']['ar-eg'] = 'From';
+		$text['label-message_from']['de-at'] = 'From';
+		$text['label-message_from']['de-ch'] = 'From';
+		$text['label-message_from']['de-de'] = 'From';
+		$text['label-message_from']['es-cl'] = 'From';
+		$text['label-message_from']['es-mx'] = 'From';
+		$text['label-message_from']['fr-ca'] = 'From';
+		$text['label-message_from']['fr-fr'] = 'From';
+		$text['label-message_from']['he-il'] = 'From';
+		$text['label-message_from']['it-it'] = 'From';
+		$text['label-message_from']['nl-nl'] = 'Van';
+		$text['label-message_from']['pl-pl'] = 'From';
+		$text['label-message_from']['pt-br'] = 'From';
+		$text['label-message_from']['pt-pt'] = 'From';
+		$text['label-message_from']['ro-ro'] = 'From';
+		$text['label-message_from']['ru-ru'] = 'From';
+		$text['label-message_from']['sv-se'] = 'From';
+		$text['label-message_from']['uk-ua'] = 'From';
+
+		$text['description-message_from']['en-us'] = 'Enter the message from.';
+		$text['description-message_from']['en-gb'] = 'Enter the message from.';
+		$text['description-message_from']['ar-eg'] = 'Enter the message from.';
+		$text['description-message_from']['de-at'] = 'Enter the message from.';
+		$text['description-message_from']['de-ch'] = 'Enter the message from.';
+		$text['description-message_from']['de-de'] = 'Enter the message from.';
+		$text['description-message_from']['es-cl'] = 'Enter the message from.';
+		$text['description-message_from']['es-mx'] = 'Enter the message from.';
+		$text['description-message_from']['fr-ca'] = 'Enter the message from.';
+		$text['description-message_from']['fr-fr'] = 'Enter the message from.';
+		$text['description-message_from']['he-il'] = 'Enter the message from.';
+		$text['description-message_from']['it-it'] = 'Enter the message from.';
+		$text['description-message_from']['nl-nl'] = 'Voer boodschap van in.';
+		$text['description-message_from']['pl-pl'] = 'Enter the message from.';
+		$text['description-message_from']['pt-br'] = 'Enter the message from.';
+		$text['description-message_from']['pt-pt'] = 'Enter the message from.';
+		$text['description-message_from']['ro-ro'] = 'Enter the message from.';
+		$text['description-message_from']['ru-ru'] = 'Enter the message from.';
+		$text['description-message_from']['sv-se'] = 'Enter the message from.';
+		$text['description-message_from']['uk-ua'] = 'Enter the message from.';
+
+		$text['label-message_to']['en-us'] = 'To';
+		$text['label-message_to']['en-gb'] = 'To';
+		$text['label-message_to']['ar-eg'] = 'To';
+		$text['label-message_to']['de-at'] = 'To';
+		$text['label-message_to']['de-ch'] = 'To';
+		$text['label-message_to']['de-de'] = 'To';
+		$text['label-message_to']['es-cl'] = 'To';
+		$text['label-message_to']['es-mx'] = 'To';
+		$text['label-message_to']['fr-ca'] = 'To';
+		$text['label-message_to']['fr-fr'] = 'To';
+		$text['label-message_to']['he-il'] = 'To';
+		$text['label-message_to']['it-it'] = 'To';
+		$text['label-message_to']['nl-nl'] = 'Aan';
+		$text['label-message_to']['pl-pl'] = 'To';
+		$text['label-message_to']['pt-br'] = 'To';
+		$text['label-message_to']['pt-pt'] = 'To';
+		$text['label-message_to']['ro-ro'] = 'To';
+		$text['label-message_to']['ru-ru'] = 'To';
+		$text['label-message_to']['sv-se'] = 'To';
+		$text['label-message_to']['uk-ua'] = 'To';
+
+		$text['description-message_to']['en-us'] = 'Enter the message to.';
+		$text['description-message_to']['en-gb'] = 'Enter the message to.';
+		$text['description-message_to']['ar-eg'] = 'Enter the message to.';
+		$text['description-message_to']['de-at'] = 'Enter the message to.';
+		$text['description-message_to']['de-ch'] = 'Enter the message to.';
+		$text['description-message_to']['de-de'] = 'Enter the message to.';
+		$text['description-message_to']['es-cl'] = 'Enter the message to.';
+		$text['description-message_to']['es-mx'] = 'Enter the message to.';
+		$text['description-message_to']['fr-ca'] = 'Enter the message to.';
+		$text['description-message_to']['fr-fr'] = 'Enter the message to.';
+		$text['description-message_to']['he-il'] = 'Enter the message to.';
+		$text['description-message_to']['it-it'] = 'Enter the message to.';
+		$text['description-message_to']['nl-nl'] = 'Voer de boodschap aan in.';
+		$text['description-message_to']['pl-pl'] = 'Enter the message to.';
+		$text['description-message_to']['pt-br'] = 'Enter the message to.';
+		$text['description-message_to']['pt-pt'] = 'Enter the message to.';
+		$text['description-message_to']['ro-ro'] = 'Enter the message to.';
+		$text['description-message_to']['ru-ru'] = 'Enter the message to.';
+		$text['description-message_to']['sv-se'] = 'Enter the message to.';
+		$text['description-message_to']['uk-ua'] = 'Enter the message to.';
+
+		$text['label-message_text']['en-us'] = 'Text';
+		$text['label-message_text']['en-gb'] = 'Text';
+		$text['label-message_text']['ar-eg'] = 'Text';
+		$text['label-message_text']['de-at'] = 'Text';
+		$text['label-message_text']['de-ch'] = 'Text';
+		$text['label-message_text']['de-de'] = 'Text';
+		$text['label-message_text']['es-cl'] = 'Text';
+		$text['label-message_text']['es-mx'] = 'Text';
+		$text['label-message_text']['fr-ca'] = 'Text';
+		$text['label-message_text']['fr-fr'] = 'Text';
+		$text['label-message_text']['he-il'] = 'Text';
+		$text['label-message_text']['it-it'] = 'Text';
+		$text['label-message_text']['nl-nl'] = 'Tekst';
+		$text['label-message_text']['pl-pl'] = 'Text';
+		$text['label-message_text']['pt-br'] = 'Text';
+		$text['label-message_text']['pt-pt'] = 'Text';
+		$text['label-message_text']['ro-ro'] = 'Text';
+		$text['label-message_text']['ru-ru'] = 'Text';
+		$text['label-message_text']['sv-se'] = 'Text';
+		$text['label-message_text']['uk-ua'] = 'Text';
+
+		$text['label-message_media']['en-us'] = 'Media';
+		$text['label-message_media']['en-gb'] = 'Media';
+		$text['label-message_media']['ar-eg'] = 'Media';
+		$text['label-message_media']['de-at'] = 'Media';
+		$text['label-message_media']['de-ch'] = 'Media';
+		$text['label-message_media']['de-de'] = 'Media';
+		$text['label-message_media']['es-cl'] = 'Media';
+		$text['label-message_media']['es-mx'] = 'Media';
+		$text['label-message_media']['fr-ca'] = 'Media';
+		$text['label-message_media']['fr-fr'] = 'Media';
+		$text['label-message_media']['he-il'] = 'Media';
+		$text['label-message_media']['it-it'] = 'Media';
+		$text['label-message_media']['nl-nl'] = 'Media';
+		$text['label-message_media']['pl-pl'] = 'Media';
+		$text['label-message_media']['pt-br'] = 'Media';
+		$text['label-message_media']['pt-pt'] = 'Media';
+		$text['label-message_media']['ro-ro'] = 'Media';
+		$text['label-message_media']['ru-ru'] = 'Media';
+		$text['label-message_media']['sv-se'] = 'Media';
+		$text['label-message_media']['uk-ua'] = 'Media';
+
+		$text['description-message_text']['en-us'] = 'Enter the message text.';
+		$text['description-message_text']['en-gb'] = 'Enter the message text.';
+		$text['description-message_text']['ar-eg'] = 'Enter the message text.';
+		$text['description-message_text']['de-at'] = 'Enter the message text.';
+		$text['description-message_text']['de-ch'] = 'Enter the message text.';
+		$text['description-message_text']['de-de'] = 'Enter the message text.';
+		$text['description-message_text']['es-cl'] = 'Enter the message text.';
+		$text['description-message_text']['es-mx'] = 'Enter the message text.';
+		$text['description-message_text']['fr-ca'] = 'Enter the message text.';
+		$text['description-message_text']['fr-fr'] = 'Enter the message text.';
+		$text['description-message_text']['he-il'] = 'Enter the message text.';
+		$text['description-message_text']['it-it'] = 'Enter the message text.';
+		$text['description-message_text']['nl-nl'] = 'Voer de boodschap tekst in.';
+		$text['description-message_text']['pl-pl'] = 'Enter the message text.';
+		$text['description-message_text']['pt-br'] = 'Enter the message text.';
+		$text['description-message_text']['pt-pt'] = 'Enter the message text.';
+		$text['description-message_text']['ro-ro'] = 'Enter the message text.';
+		$text['description-message_text']['ru-ru'] = 'Enter the message text.';
+		$text['description-message_text']['sv-se'] = 'Enter the message text.';
+		$text['description-message_text']['uk-ua'] = 'Enter the message text.';
+
+		$text['label-message_media_type']['en-us'] = 'Media Type';
+		$text['label-message_media_type']['en-gb'] = 'Media Type';
+		$text['label-message_media_type']['ar-eg'] = 'Media Type';
+		$text['label-message_media_type']['de-at'] = 'Media Type';
+		$text['label-message_media_type']['de-ch'] = 'Media Type';
+		$text['label-message_media_type']['de-de'] = 'Media Type';
+		$text['label-message_media_type']['es-cl'] = 'Media Type';
+		$text['label-message_media_type']['es-mx'] = 'Media Type';
+		$text['label-message_media_type']['fr-ca'] = 'Media Type';
+		$text['label-message_media_type']['fr-fr'] = 'Media Type';
+		$text['label-message_media_type']['he-il'] = 'Media Type';
+		$text['label-message_media_type']['it-it'] = 'Media Type';
+		$text['label-message_media_type']['nl-nl'] = 'Media Type';
+		$text['label-message_media_type']['pl-pl'] = 'Media Type';
+		$text['label-message_media_type']['pt-br'] = 'Media Type';
+		$text['label-message_media_type']['pt-pt'] = 'Media Type';
+		$text['label-message_media_type']['ro-ro'] = 'Media Type';
+		$text['label-message_media_type']['ru-ru'] = 'Media Type';
+		$text['label-message_media_type']['sv-se'] = 'Media Type';
+		$text['label-message_media_type']['uk-ua'] = 'Media Type';
+
+		$text['description-message_media_type']['en-us'] = 'Enter the message media type.';
+		$text['description-message_media_type']['en-gb'] = 'Enter the message media type.';
+		$text['description-message_media_type']['ar-eg'] = 'Enter the message media type.';
+		$text['description-message_media_type']['de-at'] = 'Enter the message media type.';
+		$text['description-message_media_type']['de-ch'] = 'Enter the message media type.';
+		$text['description-message_media_type']['de-de'] = 'Enter the message media type.';
+		$text['description-message_media_type']['es-cl'] = 'Enter the message media type.';
+		$text['description-message_media_type']['es-mx'] = 'Enter the message media type.';
+		$text['description-message_media_type']['fr-ca'] = 'Enter the message media type.';
+		$text['description-message_media_type']['fr-fr'] = 'Enter the message media type.';
+		$text['description-message_media_type']['he-il'] = 'Enter the message media type.';
+		$text['description-message_media_type']['it-it'] = 'Enter the message media type.';
+		$text['description-message_media_type']['nl-nl'] = 'Voer de boodschap media type in.';
+		$text['description-message_media_type']['pl-pl'] = 'Enter the message media type.';
+		$text['description-message_media_type']['pt-br'] = 'Enter the message media type.';
+		$text['description-message_media_type']['pt-pt'] = 'Enter the message media type.';
+		$text['description-message_media_type']['ro-ro'] = 'Enter the message media type.';
+		$text['description-message_media_type']['ru-ru'] = 'Enter the message media type.';
+		$text['description-message_media_type']['sv-se'] = 'Enter the message media type.';
+		$text['description-message_media_type']['uk-ua'] = 'Enter the message media type.';
+
+		$text['label-message_media_url']['en-us'] = 'Media URL';
+		$text['label-message_media_url']['en-gb'] = 'Media URL';
+		$text['label-message_media_url']['ar-eg'] = 'Media URL';
+		$text['label-message_media_url']['de-at'] = 'Media URL';
+		$text['label-message_media_url']['de-ch'] = 'Media URL';
+		$text['label-message_media_url']['de-de'] = 'Media URL';
+		$text['label-message_media_url']['es-cl'] = 'Media URL';
+		$text['label-message_media_url']['es-mx'] = 'Media URL';
+		$text['label-message_media_url']['fr-ca'] = 'Media URL';
+		$text['label-message_media_url']['fr-fr'] = 'Media URL';
+		$text['label-message_media_url']['he-il'] = 'Media URL';
+		$text['label-message_media_url']['it-it'] = 'Media URL';
+		$text['label-message_media_url']['nl-nl'] = 'Media URL';
+		$text['label-message_media_url']['pl-pl'] = 'Media URL';
+		$text['label-message_media_url']['pt-br'] = 'Media URL';
+		$text['label-message_media_url']['pt-pt'] = 'Media URL';
+		$text['label-message_media_url']['ro-ro'] = 'Media URL';
+		$text['label-message_media_url']['ru-ru'] = 'Media URL';
+		$text['label-message_media_url']['sv-se'] = 'Media URL';
+		$text['label-message_media_url']['uk-ua'] = 'Media URL';
+
+		$text['description-message_media_url']['en-us'] = 'Enter the message media url.';
+		$text['description-message_media_url']['en-gb'] = 'Enter the message media url.';
+		$text['description-message_media_url']['ar-eg'] = 'Enter the message media url.';
+		$text['description-message_media_url']['de-at'] = 'Enter the message media url.';
+		$text['description-message_media_url']['de-ch'] = 'Enter the message media url.';
+		$text['description-message_media_url']['de-de'] = 'Enter the message media url.';
+		$text['description-message_media_url']['es-cl'] = 'Enter the message media url.';
+		$text['description-message_media_url']['es-mx'] = 'Enter the message media url.';
+		$text['description-message_media_url']['fr-ca'] = 'Enter the message media url.';
+		$text['description-message_media_url']['fr-fr'] = 'Enter the message media url.';
+		$text['description-message_media_url']['he-il'] = 'Enter the message media url.';
+		$text['description-message_media_url']['it-it'] = 'Enter the message media url.';
+		$text['description-message_media_url']['nl-nl'] = 'Voer de boodschap media url in.';
+		$text['description-message_media_url']['pl-pl'] = 'Enter the message media url.';
+		$text['description-message_media_url']['pt-br'] = 'Enter the message media url.';
+		$text['description-message_media_url']['pt-pt'] = 'Enter the message media url.';
+		$text['description-message_media_url']['ro-ro'] = 'Enter the message media url.';
+		$text['description-message_media_url']['ru-ru'] = 'Enter the message media url.';
+		$text['description-message_media_url']['sv-se'] = 'Enter the message media url.';
+		$text['description-message_media_url']['uk-ua'] = 'Enter the message media url.';
+
+		$text['label-message_media_content']['en-us'] = 'Message Media Content';
+		$text['label-message_media_content']['en-gb'] = 'Message Media Content';
+		$text['label-message_media_content']['ar-eg'] = 'Message Media Content';
+		$text['label-message_media_content']['de-at'] = 'Message Media Content';
+		$text['label-message_media_content']['de-ch'] = 'Message Media Content';
+		$text['label-message_media_content']['de-de'] = 'Message Media Content';
+		$text['label-message_media_content']['es-cl'] = 'Message Media Content';
+		$text['label-message_media_content']['es-mx'] = 'Message Media Content';
+		$text['label-message_media_content']['fr-ca'] = 'Message Media Content';
+		$text['label-message_media_content']['fr-fr'] = 'Message Media Content';
+		$text['label-message_media_content']['he-il'] = 'Message Media Content';
+		$text['label-message_media_content']['it-it'] = 'Message Media Content';
+		$text['label-message_media_content']['nl-nl'] = 'Boodschap Media inhoud.';
+		$text['label-message_media_content']['pl-pl'] = 'Message Media Content';
+		$text['label-message_media_content']['pt-br'] = 'Message Media Content';
+		$text['label-message_media_content']['pt-pt'] = 'Message Media Content';
+		$text['label-message_media_content']['ro-ro'] = 'Message Media Content';
+		$text['label-message_media_content']['ru-ru'] = 'Message Media Content';
+		$text['label-message_media_content']['sv-se'] = 'Message Media Content';
+		$text['label-message_media_content']['uk-ua'] = 'Message Media Content';
+
+		$text['description-message_media_content']['en-us'] = 'Enter the message media content.';
+		$text['description-message_media_content']['en-gb'] = 'Enter the message media content.';
+		$text['description-message_media_content']['ar-eg'] = 'Enter the message media content.';
+		$text['description-message_media_content']['de-at'] = 'Enter the message media content.';
+		$text['description-message_media_content']['de-ch'] = 'Enter the message media content.';
+		$text['description-message_media_content']['de-de'] = 'Enter the message media content.';
+		$text['description-message_media_content']['es-cl'] = 'Enter the message media content.';
+		$text['description-message_media_content']['es-mx'] = 'Enter the message media content.';
+		$text['description-message_media_content']['fr-ca'] = 'Enter the message media content.';
+		$text['description-message_media_content']['fr-fr'] = 'Enter the message media content.';
+		$text['description-message_media_content']['he-il'] = 'Enter the message media content.';
+		$text['description-message_media_content']['it-it'] = 'Enter the message media content.';
+		$text['description-message_media_content']['nl-nl'] = 'Voer de boodschap media inhoud in.';
+		$text['description-message_media_content']['pl-pl'] = 'Enter the message media content.';
+		$text['description-message_media_content']['pt-br'] = 'Enter the message media content.';
+		$text['description-message_media_content']['pt-pt'] = 'Enter the message media content.';
+		$text['description-message_media_content']['ro-ro'] = 'Enter the message media content.';
+		$text['description-message_media_content']['ru-ru'] = 'Enter the message media content.';
+		$text['description-message_media_content']['sv-se'] = 'Enter the message media content.';
+		$text['description-message_media_content']['uk-ua'] = 'Enter the message media content.';
+
+		$text['label-message_json']['en-us'] = 'JSON';
+		$text['label-message_json']['en-gb'] = 'JSON';
+		$text['label-message_json']['ar-eg'] = 'JSON';
+		$text['label-message_json']['de-at'] = 'JSON';
+		$text['label-message_json']['de-ch'] = 'JSON';
+		$text['label-message_json']['de-de'] = 'JSON';
+		$text['label-message_json']['es-cl'] = 'JSON';
+		$text['label-message_json']['es-mx'] = 'JSON';
+		$text['label-message_json']['fr-ca'] = 'JSON';
+		$text['label-message_json']['fr-fr'] = 'JSON';
+		$text['label-message_json']['he-il'] = 'JSON';
+		$text['label-message_json']['it-it'] = 'JSON';
+		$text['label-message_json']['nl-nl'] = 'JSON';
+		$text['label-message_json']['pl-pl'] = 'JSON';
+		$text['label-message_json']['pt-br'] = 'JSON';
+		$text['label-message_json']['pt-pt'] = 'JSON';
+		$text['label-message_json']['ro-ro'] = 'JSON';
+		$text['label-message_json']['ru-ru'] = 'JSON';
+		$text['label-message_json']['sv-se'] = 'JSON';
+		$text['label-message_json']['uk-ua'] = 'JSON';
+
+		$text['label-refresh_pause']['en-us'] = "Pause Refresh";
+		$text['label-refresh_pause']['en-gb'] = "Pause Refresh";
+		$text['label-refresh_pause']['ar-eg'] = "Pause Refresh";
+		$text['label-refresh_pause']['de-at'] = "Seite neu laden deaktivieren"; //copied from de-de
+		$text['label-refresh_pause']['de-ch'] = "Seite neu laden deaktivieren"; //copied from de-de
+		$text['label-refresh_pause']['de-de'] = "Seite neu laden deaktivieren";
+		$text['label-refresh_pause']['es-cl'] = "Actualizar Pausa";
+		$text['label-refresh_pause']['es-mx'] = "Actualizar Pausa"; //copied from es-cl
+		$text['label-refresh_pause']['fr-ca'] = "Pause Actualiser"; //copied from fr-fr
+		$text['label-refresh_pause']['fr-fr'] = "Pause Actualiser";
+		$text['label-refresh_pause']['he-il'] = "עצור רענון";
+		$text['label-refresh_pause']['it-it'] = "Pausa";
+		$text['label-refresh_pause']['nl-nl'] = "Ververs pause";
+		$text['label-refresh_pause']['pl-pl'] = "Pauzuj odświeżanie";
+		$text['label-refresh_pause']['pt-br'] = "Pausar atualização";
+		$text['label-refresh_pause']['pt-pt'] = "Pausa Atualizar";
+		$text['label-refresh_pause']['ro-ro'] = "Pause Refresh";
+		$text['label-refresh_pause']['ru-ru'] = "Приостановить обновление";
+		$text['label-refresh_pause']['sv-se'] = "Paus Uppdatera";
+		$text['label-refresh_pause']['uk-ua'] = "пауза Оновити";
+
+		$text['label-refresh_enable']['en-us'] = "Enable Refresh";
+		$text['label-refresh_enable']['en-gb'] = "Enable Refresh";
+		$text['label-refresh_enable']['ar-eg'] = "Enable Refresh";
+		$text['label-refresh_enable']['de-at'] = "Seite neu laden aktivieren"; //copied from de-de
+		$text['label-refresh_enable']['de-ch'] = "Seite neu laden aktivieren"; //copied from de-de
+		$text['label-refresh_enable']['de-de'] = "Seite neu laden aktivieren";
+		$text['label-refresh_enable']['es-cl'] = "Activar Actualizar";
+		$text['label-refresh_enable']['es-mx'] = "Activar Actualizar"; //copied from es-cl
+		$text['label-refresh_enable']['fr-ca'] = "Activer Actualiser"; //copied from fr-fr
+		$text['label-refresh_enable']['fr-fr'] = "Activer Actualiser";
+		$text['label-refresh_enable']['he-il'] = "אפשר רענון";
+		$text['label-refresh_enable']['it-it'] = "Riprendi";
+		$text['label-refresh_enable']['nl-nl'] = "Zet ververs aan";
+		$text['label-refresh_enable']['pl-pl'] = "Włącz odświeżanie";
+		$text['label-refresh_enable']['pt-br'] = "Habilitar atualização";
+		$text['label-refresh_enable']['pt-pt'] = "Habilitar Atualização";
+		$text['label-refresh_enable']['ro-ro'] = "Enable Refresh";
+		$text['label-refresh_enable']['ru-ru'] = "Включить обновление";
+		$text['label-refresh_enable']['sv-se'] = "Aktivera Uppdatering";
+		$text['label-refresh_enable']['uk-ua'] = "включити Оновити";
+
+		$text['description-enter_response']['en-us'] = 'Enter Response...';
+		$text['description-enter_response']['en-gb'] = 'Enter Response...';
+		$text['description-enter_response']['ar-eg'] = 'Enter Response...';
+		$text['description-enter_response']['de-at'] = 'Enter Response...';
+		$text['description-enter_response']['de-ch'] = 'Enter Response...';
+		$text['description-enter_response']['de-de'] = 'Enter Response...';
+		$text['description-enter_response']['es-cl'] = 'Enter Response...';
+		$text['description-enter_response']['es-mx'] = 'Enter Response...';
+		$text['description-enter_response']['fr-ca'] = 'Enter Response...';
+		$text['description-enter_response']['fr-fr'] = 'Enter Response...';
+		$text['description-enter_response']['he-il'] = 'Enter Response...';
+		$text['description-enter_response']['it-it'] = 'Enter Response...';
+		$text['description-enter_response']['nl-nl'] = 'Voer antwoord in...';
+		$text['description-enter_response']['pl-pl'] = 'Enter Response...';
+		$text['description-enter_response']['pt-br'] = 'Enter Response...';
+		$text['description-enter_response']['pt-pt'] = 'Enter Response...';
+		$text['description-enter_response']['ro-ro'] = 'Enter Response...';
+		$text['description-enter_response']['ru-ru'] = 'Enter Response...';
+		$text['description-enter_response']['sv-se'] = 'Enter Response...';
+		$text['description-enter_response']['uk-ua'] = 'Enter Response...';
+
+		$text['label-ctrl_enter']['en-us'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['en-gb'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['ar-eg'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['de-at'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['de-ch'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['de-de'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['es-cl'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['es-mx'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['fr-ca'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['fr-fr'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['he-il'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['it-it'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['nl-nl'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['pl-pl'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['pt-br'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['pt-pt'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['ro-ro'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['ru-ru'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['sv-se'] = 'Ctrl + Enter';
+		$text['label-ctrl_enter']['uk-ua'] = 'Ctrl + Enter';
+
+		$text['button-close']['en-us'] = 'Close';
+		$text['button-close']['en-gb'] = 'Close';
+		$text['button-close']['ar-eg'] = 'Close';
+		$text['button-close']['de-at'] = 'Close';
+		$text['button-close']['de-ch'] = 'Close';
+		$text['button-close']['de-de'] = 'Close';
+		$text['button-close']['es-cl'] = 'Close';
+		$text['button-close']['es-mx'] = 'Close';
+		$text['button-close']['fr-ca'] = 'Close';
+		$text['button-close']['fr-fr'] = 'Close';
+		$text['button-close']['he-il'] = 'Close';
+		$text['button-close']['it-it'] = 'Close';
+		$text['button-close']['nl-nl'] = 'Sluiten';
+		$text['button-close']['pl-pl'] = 'Close';
+		$text['button-close']['pt-br'] = 'Close';
+		$text['button-close']['pt-pt'] = 'Close';
+		$text['button-close']['ro-ro'] = 'Close';
+		$text['button-close']['ru-ru'] = 'Close';
+		$text['button-close']['sv-se'] = 'Close';
+		$text['button-close']['uk-ua'] = 'Close';
+
+		$text['label-view_contact']['en-us'] = 'View Contact';
+		$text['label-view_contact']['en-gb'] = 'View Contact';
+		$text['label-view_contact']['ar-eg'] = 'View Contact';
+		$text['label-view_contact']['de-at'] = 'View Contact';
+		$text['label-view_contact']['de-ch'] = 'View Contact';
+		$text['label-view_contact']['de-de'] = 'View Contact';
+		$text['label-view_contact']['es-cl'] = 'View Contact';
+		$text['label-view_contact']['es-mx'] = 'View Contact';
+		$text['label-view_contact']['fr-ca'] = 'View Contact';
+		$text['label-view_contact']['fr-fr'] = 'View Contact';
+		$text['label-view_contact']['he-il'] = 'View Contact';
+		$text['label-view_contact']['it-it'] = 'View Contact';
+		$text['label-view_contact']['nl-nl'] = 'Toon kontact';
+		$text['label-view_contact']['pl-pl'] = 'View Contact';
+		$text['label-view_contact']['pt-br'] = 'View Contact';
+		$text['label-view_contact']['pt-pt'] = 'View Contact';
+		$text['label-view_contact']['ro-ro'] = 'View Contact';
+		$text['label-view_contact']['ru-ru'] = 'View Contact';
+		$text['label-view_contact']['sv-se'] = 'View Contact';
+		$text['label-view_contact']['uk-ua'] = 'View Contact';
+
+		$text['label-send_email']['en-us'] = 'Send Email';
+		$text['label-send_email']['en-gb'] = 'Send Email';
+		$text['label-send_email']['ar-eg'] = 'Send Email';
+		$text['label-send_email']['de-at'] = 'Send Email';
+		$text['label-send_email']['de-ch'] = 'Send Email';
+		$text['label-send_email']['de-de'] = 'Send Email';
+		$text['label-send_email']['es-cl'] = 'Send Email';
+		$text['label-send_email']['es-mx'] = 'Send Email';
+		$text['label-send_email']['fr-ca'] = 'Send Email';
+		$text['label-send_email']['fr-fr'] = 'Send Email';
+		$text['label-send_email']['he-il'] = 'Send Email';
+		$text['label-send_email']['it-it'] = 'Send Email';
+		$text['label-send_email']['nl-nl'] = 'Zend E-mail';
+		$text['label-send_email']['pl-pl'] = 'Send Email';
+		$text['label-send_email']['pt-br'] = 'Send Email';
+		$text['label-send_email']['pt-pt'] = 'Send Email';
+		$text['label-send_email']['ro-ro'] = 'Send Email';
+		$text['label-send_email']['ru-ru'] = 'Send Email';
+		$text['label-send_email']['sv-se'] = 'Send Email';
+		$text['label-send_email']['uk-ua'] = 'Send Email';
+
+?>

+ 21 - 0
app_menu.php

@@ -0,0 +1,21 @@
+<?php
+
+$apps[$x]['menu'][0]['title']['en-us'] = 'Messages';
+$apps[$x]['menu'][0]['title']['en-gb'] = 'Messages';
+$apps[$x]['menu'][0]['title']['es-cl'] = '';
+$apps[$x]['menu'][0]['title']['fr-fr'] = '';
+$apps[$x]['menu'][0]['title']['fr-ca'] = '';
+$apps[$x]['menu'][0]['title']['nl-nl'] = 'Boodschappen';
+$apps[$x]['menu'][0]['title']['pl'] = '';
+$apps[$x]['menu'][0]['title']['sv-se'] = '';
+$apps[$x]['menu'][0]['title']['uk'] = '';
+$apps[$x]['menu'][0]['title']['de-at'] = '';
+$apps[$x]['menu'][0]['uuid'] = 'b2f6a2e0-cf25-4bd5-8079-6385f6871047';
+$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
+$apps[$x]['menu'][0]['category'] = 'internal';
+$apps[$x]['menu'][0]['path'] = '/app/messages/messages.php';
+$apps[$x]['menu'][0]['groups'][] = 'superadmin';
+//$apps[$x]['menu'][0]['groups'][] = 'admin';
+//$apps[$x]['menu'][0]['groups'][] = 'user';
+
+?>

+ 631 - 0
index.php

@@ -0,0 +1,631 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/functions.php";
+	require_once "resources/pdo.php";
+
+//debug
+	if ($_SESSION['message']['debug']['boolean'] == 'true') {
+		$debug = $_SESSION['message']['debug']['boolean'];
+	}
+	else {
+		$debug = false;
+	}
+
+//log file
+	$log_file = '/tmp/message.log';
+
+//write the remote address to the log
+	if ($debug) {
+		file_put_contents($log_file, "Remote Address: ".$_SERVER['REMOTE_ADDR']."\n", FILE_APPEND);
+	}
+
+//get the user settings
+	$sql = "select provider_uuid, provider_address_cidr ";
+	$sql .= "from v_provider_addresses ";
+	$sql .= "where provider_address_cidr is not null ";
+	$sql .= "and provider_address_enabled = true ";
+	$parameters = null;
+	$database = new database;
+	$provider_addresses = $database->select($sql, $parameters, 'all');
+
+//default authorized to false
+	$authorized = false;
+
+//use the ip address to get the provider uuid and determine if request is authorized
+	foreach($provider_addresses as $row) {
+		if (check_cidr($row['provider_address_cidr'], $_SERVER['REMOTE_ADDR'])) {
+			$provider_uuid = $row['provider_uuid'];
+			$authorized = true;
+			break;
+		}
+	}
+
+//authorization failed
+	if ($authorized) {
+		if ($debug) {
+			file_put_contents($log_file, "authorized\n", FILE_APPEND);
+			file_put_contents($log_file, "provider_uuid ".$provider_uuid."\n", FILE_APPEND);
+		}
+	}
+	else {
+		//log the failed auth attempt to the system, to be available for fail2ban.
+			if ($debug) {
+				file_put_contents($log_file, "unauthorized\n", FILE_APPEND);
+			}
+			openlog('FusionPBX', LOG_NDELAY, LOG_AUTH);
+			syslog(LOG_WARNING, '['.$_SERVER['REMOTE_ADDR']."] authentication failed for ".$_GET['key']);
+			closelog();
+
+		//send http 403
+			header("HTTP/1.0 403 Forbidden");
+			echo "Forbidden\n";
+			//echo "<html>\n";
+			//echo "<head><title>403 Forbidden/title></head>\n";
+			//echo "<body bgcolor=\"white\">\n";
+			//echo "<center><h1>403 Forbidden</h1></center>\n";
+			//echo "<hr><center>nginx/1.12.1</center>\n";
+			//echo "</body>\n";
+			//echo "</html>\n";
+			exit();
+	}
+
+//check if string is url encoded
+	function is_urlencoded($string) {
+		$urlencoded = preg_match('~%[0-9A-F]{2}~i', $string);
+		if ($urlencoded) {
+			return true;
+		}
+		else {
+			return false;
+		}
+	}
+
+//use the provider uuid to get the provider_settings
+	$sql = "select provider_setting_category, provider_setting_subcategory, \n";
+	$sql .= "provider_setting_name, provider_setting_value, provider_setting_order \n";
+	$sql .= "from v_provider_settings \n";
+	$sql .= "where provider_uuid = :provider_uuid \n";
+	$sql .= "and provider_setting_enabled = 'true' \n";
+	$sql .= "and provider_setting_category = 'inbound' \n";
+	$parameters['provider_uuid'] = $provider_uuid;
+	$database = new database;
+	$provider_settings = $database->select($sql, $parameters, 'all');
+	foreach ($provider_settings as $row) {
+		if ($row['provider_setting_subcategory'] == 'content') {
+			$setting[$row['provider_setting_name']] = $row['provider_setting_value'];
+		}
+	}
+	unset($parameters);
+	//view_array($settings, false);
+
+//set the default content type to json
+	$content_type = 'json';
+
+//get the content location for the destinaion numer
+	if (isset($setting['content_type'])) {
+		$content_type = strtolower($setting['content_type']);
+	}
+
+//get the message_type options: sms, mms
+	if (isset($setting['message_type'])) {
+		$message_type = strtolower($setting['message_type']);
+	}
+	else {
+		$message_type = is_array($message_media_array) ? 'mms' : 'sms';
+	}
+
+//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);
+		}
+
+		//get the content
+		if ($content_type == 'json') {
+			$message_json = file_get_contents("php://input");
+		}
+		if ($content_type == 'get') {
+			$message_json = json_encode($_GET);
+		}
+		if ($content_type == 'post') {
+			$message_json = json_encode($_POST);
+		}
+
+		//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) {
+		if (count($_POST)) {
+			file_put_contents($log_file, json_encode($_POST)."\n", FILE_APPEND);
+		}
+		if (count($_GET)) {
+			file_put_contents($log_file, json_encode($_GET)."\n", FILE_APPEND);
+		}
+	}
+
+//decode the json into array
+	if ($content_type == 'json') {
+		$message = json_decode($message_json, true);
+	}
+
+//ignore inbound delivery receipt - used by bulkvs
+	if (isset($message['DeliveryReceipt']) && $message['DeliveryReceipt'] == 'true') {
+		exit;
+	}
+
+//send print_r to the log
+	//if ($debug) {
+	//	file_put_contents($log_file, print_r($message, true)."\n", FILE_APPEND);
+	//}
+
+//get the content location for the destinaion numer
+	$message_to = $setting['content']['message_to'];
+
+//debug info
+	if ($debug) {
+		file_put_contents($log_file, "--------------\n", FILE_APPEND);
+		file_put_contents($log_file, print_r($setting, true)."\n", FILE_APPEND);
+		file_put_contents($log_file, "message_to $message_to\n", FILE_APPEND);
+		file_put_contents($log_file, "--------------\n", FILE_APPEND);
+	}
+
+/*
+	$setting['message_from'] => data.attributes.from
+	$setting['message_to'] => data.attributes.to
+	$setting['message_content'] => data.attributes.body
+
+	$from_array = explode('.', $setting['message_from']);
+	$to_array = explode('.', $setting['message_to']);
+	$content_array = explode('.', $setting['message_content']);
+*/
+
+//version 3 - not working
+	/*
+	function get_value($array, $index) {
+		$keys = explode('.', $index);
+		foreach ($keys as segment) {
+			if (is_array($array[$key])) {
+				return get_value($array[$key], $key);
+			}
+			else {
+				return $array[$key];
+			}
+		}
+		//return $data;
+	}
+	*/
+
+//version 2
+	function get_value($data, $path) {
+		$keys = explode('.', $path);
+		foreach ($keys as $key) {
+			$data = $data[$key];
+		}
+		return $data;
+	}
+
+/*
+//version 1
+	function get_value($data, $path) {
+		$keys = explode('.', $path);
+		if (count($keys) == 1) {
+			return $data[$keys[0]];
+		}
+		if (count($keys) == 2) {
+			return $data[$keys[0]][$keys[1]];
+		}
+		if (count($keys) == 3) {
+			return $data[$keys[0]][$keys[1]][$keys[2]];
+		}
+		if (count($keys) == 4) {
+			return $data[$key_array[0]][$keys[1]][$keys[2]][$keys[3]];
+		}
+		if (count($keys) == 5) {
+			return $data[$keys[0]][$keys[1]][$keys[2]][$keys[3]][$keys[4]];
+		}
+	}
+*/
+
+/*
+if (count($from_array) == 3) {
+	$message_from = $message[$from_array[0]][$from_array[1]][$from_array[2]];
+}
+if (count($to_array) == 3) {
+	$message_to = $message[$to_array[0]][$to_array[1]][$to_array[2]];
+}
+if (count($message_content) == 3) {
+	$message_content = $message[$message_content[0]][$message_content[1]][$message_content[2]];
+}
+*/
+
+//get the values from the message array using the provider settings
+	if ($content_type == 'json') {
+		$message_from = get_value($message, $setting['message_from']);
+		$message_to = get_value($message, $setting['message_to']);
+		$message_content = get_value($message, $setting['message_content']);
+		$message_media_array = get_value($message, $setting['message_media_array']);
+	}
+	if ($content_type == 'post') {
+		$message_from = $_POST[$setting['message_from']];
+		$message_to = $_POST[$setting['message_to']];
+		$message_content = $_POST[$setting['message_content']];
+		$message_media_array = $_POST[$setting['message_media_array']];
+	}
+	if ($content_type == 'get') {
+		$message_from = $_GET[$setting['message_from']];
+		$message_to = $_GET[$setting['message_to']];
+		$message_content = $_GET[$setting['message_content']];
+		$message_media_array = $_GET[$setting['message_media_array']];
+	}
+
+//message to is an array get first number in the array
+	if (is_array($message_to)) {
+		$message_to = $message_to['0'];
+	}
+
+//decode the content if it is encoded
+	if (isset($message_content)) {
+		if (is_urlencoded($message_content)) {
+			$message_content = urldecode($message_content);
+		}
+	}
+
+//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);
+			}
+		}
+	}
+
+//debug info
+	if ($debug) {
+		file_put_contents($log_file, "setting.message_from: ".$setting['message_from']."\n", FILE_APPEND);
+		file_put_contents($log_file, "setting.message_to: ".$setting['message_to']."\n", FILE_APPEND);
+		file_put_contents($log_file, "setting.message_content: ".$setting['message_content']."\n", FILE_APPEND);
+		file_put_contents($log_file, "content_type: $content_type\n", FILE_APPEND);
+		file_put_contents($log_file, "provider_uuid: $provider_uuid\n", FILE_APPEND);
+		file_put_contents($log_file, "from: ".$message_from."\n", FILE_APPEND);
+		file_put_contents($log_file, "to: ".$message_to."\n", FILE_APPEND);
+		file_put_contents($log_file, "content: ".$message_content."\n", FILE_APPEND);
+		file_put_contents($log_file, "message_media_array: ".print_r($message_media_array, true)."\n", FILE_APPEND);
+
+	}
+
+/*
+()
+[data] => Array
+	(
+		[attributes] => Array
+			(
+				[status] => delivered
+				[body] => Ddd
+				[direction] => inbound
+				[amount_nanodollars] => 4000000
+				[message_encoding] => 0
+				[timestamp] => 2021-05-16T06:12:59.88Z
+				[to] => 12089068227
+				[amount_display] => $0.0040
+				[from] => 12088058985
+				[is_mms] => 
+				[message_callback_url] => https://voip.fusionpbx.com/app/messages/index.php
+				[message_type] => longcode
+			)
+		[type] => message
+		[id] => mdr2-c3afc962b60d11ebb748aecb682882cc
+	)
+
+)
+*/
+
+//set the hostname if it wasn't provided
+	$hostname = system('hostname');
+
+//get the source phone number
+	$destination_number = preg_replace('{[\D]}', '', $message_to);
+
+//use the phone number to get the destination details
+	$sql = "SELECT * FROM v_destinations ";
+	$sql .= "WHERE ( ";
+	$sql .= "	destination_prefix || destination_area_code || destination_number = :destination_number ";
+	$sql .= "	OR destination_trunk_prefix || destination_area_code || destination_number = :destination_number ";
+	$sql .= "	OR destination_prefix || destination_number = :destination_number ";
+	$sql .= "	OR '+' || destination_prefix || destination_number = :destination_number ";
+	$sql .= "	OR '+' || destination_prefix || destination_area_code || destination_number = :destination_number ";
+	$sql .= "	OR destination_area_code || destination_number = :destination_number ";
+	$sql .= "	OR destination_number = :destination_number ";
+	$sql .= ") ";
+	$sql .= "and provider_uuid is not null ";
+	$sql .= "and destination_enabled = 'true'; ";
+	$parameters['destination_number'] = $destination_number;
+	if ($debug) {
+		file_put_contents($log_file, "sql: ".$sql."\n", FILE_APPEND);
+		echo $sql."\n";
+		file_put_contents($log_file, print_r($parameters, true)."\n", FILE_APPEND);
+	}
+	$database = new database;
+	$row = $database->select($sql, $parameters, 'row');
+	$domain_uuid = $row['domain_uuid'];
+	$user_uuid = $row['user_uuid'];
+	$group_uuid = $row['group_uuid'];
+	if ($debug) {
+		file_put_contents($log_file, print_r($row, true)."\n", FILE_APPEND);
+	}
+	unset($sql, $parameters, $row);
+
+//get the contact uuid
+	$sql = "select c.contact_uuid ";
+	$sql .= "from v_contacts as c, v_contact_phones as p ";
+	$sql .= "where p.contact_uuid = c.contact_uuid ";
+	$sql .= "and p.phone_number = :phone_number ";
+	$sql .= "and c.domain_uuid = :domain_uuid ";
+	$parameters['phone_number'] = $destination_number;
+	$parameters['domain_uuid'] = $domain_uuid;
+	$database = new database;
+	$contact_uuid = $database->select($sql, $parameters, 'column');
+	unset($sql, $parameters);
+
+//add to the messages array
+	$message_uuid = uuid();
+	$array['messages'][0]['message_uuid'] = $message_uuid;
+	$array['messages'][0]['domain_uuid'] = $domain_uuid;
+	$array['messages'][0]['provider_uuid'] = $provider_uuid;
+	if (is_uuid($user_uuid)) {
+		$array['messages'][0]['user_uuid'] = $user_uuid;
+	}
+	if (is_uuid($group_uuid)) {
+		$array['messages'][0]['group_uuid'] = $group_uuid;
+	}
+	if (is_uuid($contact_uuid)) {
+		$array['messages'][0]['contact_uuid'] = $contact_uuid;
+	}
+	$array['messages'][0]['message_type'] = $message_type;
+	$array['messages'][0]['message_direction'] = 'inbound';
+	$array['messages'][0]['message_date'] = 'now()';
+	$array['messages'][0]['message_from'] = $message_from;
+	$array['messages'][0]['message_to'] = $message_to;
+	$array['messages'][0]['message_text'] = $message_content;
+	$array['messages'][0]['message_json'] = $message_json;
+
+//add to message queue array
+	$message_queue_uuid = uuid();
+	$array['message_queue'][0]['message_queue_uuid'] = $message_queue_uuid;
+	$array['message_queue'][0]['domain_uuid'] = $domain_uuid;
+	if (is_uuid($user_uuid)) {
+		$array['message_queue'][0]['user_uuid'] = $user_uuid;
+	}
+	if (is_uuid($group_uuid)) {
+		$array['message_queue'][0]['group_uuid'] = $group_uuid;
+	}
+	$array['message_queue'][0]['provider_uuid'] = $provider_uuid;
+	$array['message_queue'][0]['hostname'] = $hostname;
+	if (is_uuid($contact_uuid)) {
+		$array['message_queue'][0]['contact_uuid'] = $contact_uuid;
+	}
+	$array['message_queue'][0]['message_type'] = $message_type;
+	$array['message_queue'][0]['message_direction'] = 'inbound';
+	$array['message_queue'][0]['message_status'] = 'waiting';
+	$array['message_queue'][0]['message_date'] = 'now()';
+	$array['message_queue'][0]['message_from'] = $message_from;
+	$array['message_queue'][0]['message_to'] = $message_to;
+	$array['message_queue'][0]['message_text'] = $message_content;
+	$array['message_queue'][0]['message_json'] = $message_json;
+
+//add the required permission
+	$p = new permissions;
+	$p->add("message_add", "temp");
+	$p->add("message_queue_add", "temp");
+	$p->add("message_media_add", "temp");
+
+//build message media array (if necessary)
+	if (is_array($message_media_array)) {
+		foreach($message_media_array as $index => $media_row) {
+			//get the value out of the array using dot notation
+			if (isset($setting['message_media_url'])) {
+				$message_media_url = get_value($media_row, $setting['message_media_url']);
+			}
+			if (isset($setting['message_media_type'])) {
+				$message_media_type = get_value($media_row, $setting['message_media_type']);
+			}
+
+			//get the file extension
+			if (isset($message_media_type)) {
+				if ($message_media_type == 'image/jpg') { $message_media_type = 'jpg'; }
+				if ($message_media_type == 'image/jpeg') { $message_media_type = 'jpg'; }
+				if ($message_media_type == 'image/png') { $message_media_type = 'png'; }
+				if ($message_media_type == 'image/gif') { $message_media_type = 'gif'; }
+			}
+
+			//get the media url
+			if (!isset($message_media_url)) {
+				$message_media_url = $media_row;
+			}
+
+			//get the media type from the URL
+			if (!isset($message_media_type)) {
+				$message_media_type = pathinfo($message_media_url, PATHINFO_EXTENSION);
+			}
+
+			//get the file name from the URL
+			if (!isset($message_media_name)) {
+				$message_media_name = pathinfo($message_media_url, PATHINFO_FILENAME).'.'.$message_media_type;
+			}
+
+			if ($debug) {
+				file_put_contents($log_file, "media_row: ".print_r($media_row, true)."\n", FILE_APPEND);
+				file_put_contents($log_file, "message_media_url: ".$message_media_url."\n", FILE_APPEND);
+				file_put_contents($log_file, "message_media_name: ".$message_media_name."\n", FILE_APPEND);
+				file_put_contents($log_file, "message_media_type: ".$message_media_type."\n", FILE_APPEND);
+			}
+
+			//build the array for the media
+			if ($message_media_type !== 'xml' && strlen($message_media_url) > 0) {
+				$array['message_media'][$index]['message_media_uuid'] = uuid();
+				$array['message_media'][$index]['message_uuid'] = $message_uuid;
+				$array['message_media'][$index]['domain_uuid'] = $domain_uuid;
+				$array['message_media'][$index]['user_uuid'] = $user_uuid;
+				$array['message_media'][$index]['message_media_type'] = $message_media_type;
+
+				$array['message_media'][$index]['message_media_name'] = $message_media_name;
+				$array['message_media'][$index]['message_media_date'] = 'now()';
+
+				$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));
+			}
+		}
+	}
+	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']);
+		}
+		if (isset($setting['message_media_type'])) {
+			$message_media_type = get_value($message, $setting['message_media_type']);
+		}
+
+		//get the media type from the URL
+		if (!isset($message_media_type)) {
+			$message_media_type = pathinfo($message_media_url, PATHINFO_EXTENSION);
+		}
+
+		//get the file extension
+		if (strlen($message_media_type) > 0) {
+			if ($message_media_type == 'image/jpeg') { $message_media_type = 'jpg'; }
+			if ($message_media_type == 'image/png') { $message_media_type = 'png'; }
+			if ($message_media_type == 'image/gif') { $message_media_type = 'gif'; }
+		}
+
+		//build the array for the media
+		if (strlen($message_media_url) > 0 && $message_media_type !== 'xml') {
+			$index = 0;
+			$array['message_media'][$index]['message_media_uuid'] = uuid();
+			$array['message_media'][$index]['message_uuid'] = $message_uuid;
+			$array['message_media'][$index]['domain_uuid'] = $domain_uuid;
+			$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));
+		}
+	}
+	//if ($debug) {
+	//	file_put_contents($log_file, print_r($array, true), FILE_APPEND);
+	//}
+
+//save message to the database
+	$database = new database;
+	$database->app_name = 'messages';
+	$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+	$database->save($array, false);
+	$result = $database->message;
+	//if ($debug) {
+	//	file_put_contents($log_file, print_r($result, true), FILE_APPEND);
+	//}
+
+//remove the temporary permission
+	$p->delete("message_add", "temp");
+	$p->delete("message_queue_add", "temp");
+	$p->delete("message_media_add", "temp");
+
+//convert the array to json
+	//$array_json = json_encode($array);
+
+//get the list of extensions using the user_uuid
+	$sql = "select * from v_domains as d, v_extensions as e ";
+	$sql .= "where extension_uuid in ( ";
+	$sql .= "	select extension_uuid ";
+	$sql .= "	from v_extension_users ";
+	$sql .= "	where user_uuid = :user_uuid ";
+	$sql .= ") ";
+	$sql .= "and e.domain_uuid = d.domain_uuid ";
+	$sql .= "and e.enabled = 'true' ";
+	$parameters['user_uuid'] = $user_uuid;
+	$database = new database;
+	$extensions = $database->select($sql, $parameters, 'all');
+	unset($sql, $parameters);
+
+//send the sip message
+	if (is_array($extensions) && @sizeof($extensions) != 0) {
+		//create the event socket connection
+		$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+
+		//loop through assigned extensions
+		foreach ($extensions as $row) {
+			//get variables from the array
+			$domain_name = $row['domain_name'];
+			$extension = $row['extension'];
+			$number_alias = $row['number_alias'];
+
+			//get the sip profile
+			$command = "sofia_contact ".$extension."@".$domain_name;
+			$response = event_socket_request($fp, "api ".$command);
+			if ($response != 'error/user_not_registered') {
+				$sip_profile = explode("/", $response)[1];
+			}
+
+			//send the sip messages
+			//$command = "luarun app/messages/resources/send.lua ".$message["from"]."@".$domain_name." ".$extension."@".$domain_name."  '".$message["text"]."'";
+
+			//$message_from_orig = $message_from;
+
+			//original number with the domain name
+			$message_from = $message_from .'@'.$domain_name;
+			//$message_to_orig = $message_to;
+
+			//send to the assigned extension(s)
+			$message_to = $extension . '@'.$domain_name;
+			//$message_to = '[email protected]';
+
+			//add debug info to the message
+			//$message_content = $message_content . ' - ' .$message_to_orig;
+
+			//send the SIP message  (working)
+			$event = "sendevent CUSTOM\n";
+			$event .= "Event-Subclass: SMS::SEND_MESSAGE\n";
+			$event .= "proto: sip\n";
+			$event .= "dest_proto: sip\n";
+			$event .= "from: ".$message_from."\n";
+			$event .= "from_full: sip:".$message_from."\n";
+			$event .= "to: ".$message_to."\n";
+			$event .= "subject: sip:".$message_to."\n";
+			//$event .= "type: text/html\n";
+			$event .= "type: text/plain\n";
+			$event .= "hint: the hint\n";
+			$event .= "replying: true\n";
+			$event .= "sip_profile: ".$sip_profile."\n";
+			$event .= "_body: ". $message_content;
+			event_socket_request($fp, $event);
+		}
+	}
+
+//set the file
+	//$file = '/tmp/sms.txt';
+
+//save the file
+	//file_put_contents($file, $json);
+
+//save the data to the file system
+	//file_put_contents($file, $json."\n");
+	//file_put_contents($file, $array_json."\nfrom: ".$message["from"]." to: ".$message["to"]." text: ".$message["text"]."\n$sql_test\njson: ".$json."\n".$saved_result."\n");
+
+?>

+ 366 - 0
message_edit.php

@@ -0,0 +1,366 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (permission_exists('message_add') || permission_exists('message_edit')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//action add or update
+	if (is_uuid($_REQUEST["id"])) {
+		$action = "update";
+		$message_uuid = $_REQUEST["id"];
+	}
+	else {
+		$action = "add";
+	}
+
+//get http post variables and set them to php variables
+	if (is_array($_POST)) {
+		$message_uuid = $_POST["message_uuid"];
+		$user_uuid = $_POST["user_uuid"];
+		$message_type = $_POST["message_type"];
+		$message_direction = $_POST["message_direction"];
+		$message_date = $_POST["message_date"];
+		$message_from = $_POST["message_from"];
+		$message_to = $_POST["message_to"];
+		$message_text = $_POST["message_text"];
+		$message_media_type = $_POST["message_media_type"];
+		$message_media_url = $_POST["message_media_url"];
+		$message_media_content = $_POST["message_media_content"];
+		$message_json = $_POST["message_json"];
+	}
+
+//process the user data and save it to the database
+	if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+
+		//get the uuid from the POST
+			if ($action == "update") {
+				$message_uuid = $_POST["message_uuid"];
+			}
+
+		//process the http post data by submitted action
+			if ($_POST['action'] != '' && is_uuid($message_uuid)) {
+				$array[0]['checked'] = 'true';
+				$array[0]['uuid'] = $message_uuid;
+
+				switch ($_POST['action']) {
+					case 'delete':
+						if (permission_exists('message_delete')) {
+							$obj = new messages;
+							$obj->delete($array);
+						}
+						break;
+				}
+
+				header('Location: message_logs.php');
+				exit;
+			}
+
+		//validate the token
+			$token = new token;
+			if (!$token->validate($_SERVER['PHP_SELF'])) {
+				message::add($text['message-invalid_token'],'negative');
+				header('Location: messages_log.php');
+				exit;
+			}
+
+		//check for all required data
+			$msg = '';
+			if (strlen($message_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_type']."<br>\n"; }
+			if (strlen($message_direction) == 0) { $msg .= $text['message-required']." ".$text['label-message_direction']."<br>\n"; }
+			if (strlen($message_date) == 0) { $msg .= $text['message-required']." ".$text['label-message_date']."<br>\n"; }
+			if (strlen($message_from) == 0) { $msg .= $text['message-required']." ".$text['label-message_from']."<br>\n"; }
+			if (strlen($message_to) == 0) { $msg .= $text['message-required']." ".$text['label-message_to']."<br>\n"; }
+			//if (strlen($message_text) == 0) { $msg .= $text['message-required']." ".$text['label-message_text']."<br>\n"; }
+			//if (strlen($message_media_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_type']."<br>\n"; }
+			//if (strlen($message_media_url) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_url']."<br>\n"; }
+			//if (strlen($message_media_content) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_content']."<br>\n"; }
+			//if (strlen($message_json) == 0) { $msg .= $text['message-required']." ".$text['label-message_json']."<br>\n"; }
+			if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
+				require_once "resources/header.php";
+				require_once "resources/persist_form_var.php";
+				echo "<div align='center'>\n";
+				echo "<table><tr><td>\n";
+				echo $msg."<br />";
+				echo "</td></tr></table>\n";
+				persistformvar($_POST);
+				echo "</div>\n";
+				require_once "resources/footer.php";
+				return;
+			}
+
+		//add the message_uuid
+			if (!is_uuid($_POST["message_uuid"])) {
+				$message_uuid = uuid();
+			}
+
+		//prepare the array
+			$array['messages'][0]['domain_uuid'] = $_SESSION["domain_uuid"];;
+			$array['messages'][0]['user_uuid'] = $user_uuid;
+			$array['messages'][0]['message_uuid'] = $message_uuid;
+			$array['messages'][0]['message_type'] = $message_type;
+			$array['messages'][0]['message_direction'] = $message_direction;
+			$array['messages'][0]['message_date'] = $message_date;
+			$array['messages'][0]['message_from'] = $message_from;
+			$array['messages'][0]['message_to'] = $message_to;
+			$array['messages'][0]['message_text'] = $message_text;
+			$array['messages'][0]['message_uuid'] = $message_uuid;
+
+		//save to the data
+			$database = new database;
+			$database->app_name = 'messages';
+			$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+			$database->save($array);
+
+		//redirect the user
+			if (isset($action)) {
+				if ($action == "add") {
+					message::add($text['message-add']);
+				}
+				if ($action == "update") {
+					message::add($text['message-update']);
+				}
+				header('Location: message_edit.php?id='.$message_uuid);
+				exit;
+			}
+	}
+
+//pre-populate the form
+	if (is_array($_GET) && $_POST["persistformvar"] != "true") {
+		$message_uuid = $_GET["id"];
+		$sql = "select * from v_messages ";
+		$sql .= "where message_uuid = :message_uuid ";
+		$parameters['message_uuid'] = $message_uuid;
+		$database = new database;
+		$row = $database->select($sql, $parameters, 'row');
+		if (is_array($row) && @sizeof($row) != 0) {
+			$user_uuid = $row["user_uuid"];
+			$message_type = $row["message_type"];
+			$message_direction = $row["message_direction"];
+			$message_date = $row["message_date"];
+			$message_from = $row["message_from"];
+			$message_to = $row["message_to"];
+			$message_text = $row["message_text"];
+			$message_media_type = $row["message_media_type"];
+			$message_media_url = $row["message_media_url"];
+			$message_media_content = $row["message_media_content"];
+			$message_json = $row["message_json"];
+		}
+		unset($sql, $parameters);
+	}
+
+//get the users
+	$sql = "select user_uuid, username from v_users ";
+	$sql .= "where domain_uuid = :domain_uuid ";
+	$sql .= "and user_enabled = 'true' ";
+	$sql .= "order by username asc ";
+	$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+	$database = new database;
+	$users = $database->select($sql, $parameters, 'all');
+	unset($sql, $parameters);
+
+//create token
+	$object = new token;
+	$token = $object->create($_SERVER['PHP_SELF']);
+
+//include the header
+	$document['title'] = $text['title-message'];
+	require_once "resources/header.php";
+
+//show the content
+	echo "<form name='frm' id='frm' method='post'>\n";
+
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['title-message']."</b></div>\n";
+	echo "	<div class='actions'>\n";
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'message_logs.php']);
+	if ($action == 'update' && permission_exists('message_delete')) {
+		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>'margin-left: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
+	}
+	echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	if ($action == 'update' && permission_exists('message_delete')) {
+		echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
+	}
+
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+
+	echo "<tr>\n";
+	echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-username']."\n";
+	echo "</td>\n";
+	echo "<td width='70%' class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<select class='formfld' name='user_uuid'>\n";
+	echo "		<option value=''></option>\n";
+	foreach($users as $row) {
+		echo "		<option value='".escape($row['user_uuid'])."' ".($row['user_uuid'] == $user_uuid ? "selected='selected'" : null).">".escape($row['username'])."</option>\n";
+	}
+	echo "	</select>\n";
+	echo "<br />\n";
+	echo $text['description-username']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_type']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<select class='formfld' name='message_type'>\n";
+	echo "		<option value='sms' ".($message_type == 'sms' ? "selected='selected'" : null).">".$text['label-sms']."</option>\n";
+	echo "		<option value='mms' ".($message_type == 'mms' ? "selected='selected'" : null).">".$text['label-mms']."</option>\n";
+	echo "		<option value='chat' ".($message_type == 'chat' ? "selected='selected'" : null).">".$text['label-chat']."</option>\n";
+	echo "	</select>\n";
+	echo "<br />\n";
+	echo $text['description-message_type']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_direction']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<select class='formfld' name='message_direction'>\n";
+	echo "		<option value='inbound' ".($message_direction == 'inbound' ? "selected='selected'" : null).">".$text['label-inbound']."</option>\n";
+	echo "		<option value='outbound' ".($message_direction == 'outbound' ? "selected='selected'" : null).">".$text['label-outbound']."</option>\n";
+	echo "	</select>\n";
+	echo "<br />\n";
+	echo $text['description-message_direction']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_date']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<input class='formfld' type='text' name='message_date' maxlength='255' value=\"".escape($message_date)."\">\n";
+	echo "<br />\n";
+	echo $text['description-message_date']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_from']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<input class='formfld' type='text' name='message_from' maxlength='255' value=\"".escape($message_from)."\">\n";
+	echo "<br />\n";
+	echo $text['description-message_from']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_to']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<input class='formfld' type='text' name='message_to' maxlength='255' value=\"".escape($message_to)."\">\n";
+	echo "<br />\n";
+	echo $text['description-message_to']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+	echo "	".$text['label-message_text']."\n";
+	echo "</td>\n";
+	echo "<td class='vtable' style='position: relative;' align='left'>\n";
+	echo "	<textarea class='formfld' style='min-width: 40%; height: 100px;' name='message_text'>".escape($message_text)."</textarea>\n";
+	echo "<br />\n";
+	echo $text['description-message_text']."\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	if (strlen($message_media_type) > 0) {
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	&nbsp;\n";
+		echo "</td>\n";
+		echo "<td class='vtable' style='position: relative;' align='left'>\n";
+		$image_source = 'data: '.mime_content_type($message_media_type).';base64,'.$message_media_content;
+		echo "<img src='".$image_source."' width='100%'>";
+		echo "<br />\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+	}
+
+	if ($_GET['debug'] == 'true') {
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	".$text['label-message_media_type']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' style='position: relative;' align='left'>\n";
+		echo "	<input class='formfld' type='text' name='message_media_type' maxlength='255' value=\"".escape($message_media_type)."\">\n";
+		echo "<br />\n";
+		echo $text['description-message_media_type']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	".$text['label-message_media_url']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' style='position: relative;' align='left'>\n";
+		echo "	<input class='formfld' type='text' name='message_media_url' maxlength='255' value=\"".escape($message_media_url)."\">\n";
+		echo "<br />\n";
+		echo $text['description-message_media_url']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	".$text['label-message_media_content']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' style='position: relative;' align='left'>\n";
+		echo "	<input class='formfld' type='text' name='message_media_content' maxlength='255' value=\"".escape($message_media_content)."\">\n";
+		echo "<br />\n";
+		echo $text['description-message_media_content']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+
+		echo "<tr>\n";
+		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
+		echo "	".$text['label-message_json']."\n";
+		echo "</td>\n";
+		echo "<td class='vtable' style='position: relative;' align='left'>\n";
+		echo "	<input class='formfld' type='text' name='message_json' maxlength='255' value=\"".escape($message_json)."\">\n";
+		echo "<br />\n";
+		echo $text['description-message_json']."\n";
+		echo "</td>\n";
+		echo "</tr>\n";
+	}
+
+	echo "</table>\n";
+	echo "<br /><br />\n";
+
+	echo "<input type='hidden' name='message_uuid' value='".escape($message_uuid)."'>\n";
+	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
+
+	echo "</form>";
+
+//include the footer
+	require_once "resources/footer.php";
+
+?>

+ 242 - 0
message_logs.php

@@ -0,0 +1,242 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//check permissions
+	if (permission_exists('message_view')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http post data
+	if (is_array($_POST['messages'])) {
+		$action = $_POST['action'];
+		$search = $_POST['search'];
+		$messages = $_POST['messages'];
+	}
+
+//process the http post data by action
+	if ($action != '' && is_array($messages) && @sizeof($messages) != 0) {
+		switch ($action) {
+			case 'delete':
+				if (permission_exists('message_delete')) {
+					$obj = new messages;
+					$obj->delete($messages);
+				}
+				break;
+		}
+
+		header('Location: message_logs.php'.($search != '' ? '?search='.urlencode($search) : null));
+		exit;
+	}
+
+//get variables used to control the order
+	$order_by = $_GET["order_by"];
+	$order = $_GET["order"];
+
+//add the search term
+	$search = strtolower($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_search = " (";
+		$sql_search .= "lower(message_type) like :search ";
+		$sql_search .= "or lower(message_direction) like :search ";
+		$sql_search .= "or lower(message_from) like :search ";
+		$sql_search .= "or lower(message_to) like :search ";
+		$sql_search .= "or lower(message_text) like :search ";
+		$sql_search .= ") ";
+		$parameters['search'] = '%'.$search.'%';
+	}
+
+//prepare to page the results
+	$sql = "select count(*) from v_messages ";
+	if ($_GET['show'] == "all" && permission_exists('message_all')) {
+		if (isset($sql_search)) {
+			$sql .= "where ".$sql_search;
+		}
+	}
+	else {
+		$sql .= "where user_uuid = :user_uuid ";
+		$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+		if (isset($sql_search)) {
+			$sql .= "and ".$sql_search;
+		}
+		$parameters['user_uuid'] = $_SESSION['user_uuid'];
+		$parameters['domain_uuid'] = $domain_uuid;
+	}
+	$database = new database;
+	$num_rows = $database->select($sql, $parameters, 'column');
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search;
+	if ($_GET['show'] == "all" && permission_exists('message_all')) {
+		$param .= "&show=all";
+	}
+	if (isset($_GET['page'])) {
+		$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
+		list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
+		list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
+		$offset = $rows_per_page * $page;
+	}
+
+//get the list
+	$sql = str_replace('count(*)', '*', $sql);
+	$sql .= "order by message_date desc ";
+	$sql .= limit_offset($rows_per_page, $offset);
+	$database = new database;
+	$messages = $database->select($sql, $parameters, 'all');
+	unset($sql, $parameters);
+
+//create token
+	$object = new token;
+	$token = $object->create($_SERVER['PHP_SELF']);
+
+//include header
+	$document['title'] = $text['title-message_log'];
+	require_once "resources/header.php";
+
+//define the checkbox_toggle function
+	echo "<script type=\"text/javascript\">\n";
+	echo "	function checkbox_toggle(item) {\n";
+	echo "		var inputs = document.getElementsByTagName(\"input\");\n";
+	echo "		for (var i = 0, max = inputs.length; i < max; i++) {\n";
+	echo "		    if (inputs[i].type === 'checkbox') {\n";
+	echo "		       	if (document.getElementById('checkbox_all').checked == true) {\n";
+	echo "				inputs[i].checked = true;\n";
+	echo "			}\n";
+	echo "				else {\n";
+	echo "					inputs[i].checked = false;\n";
+	echo "				}\n";
+	echo "			}\n";
+	echo "		}\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+//show the content
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['title-message_log']." (".$num_rows.")</b></div>\n";
+	echo "	<div class='actions'>\n";
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'messages.php']);
+	if (permission_exists('message_delete') && $messages) {
+		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>'margin-left: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
+	}
+	echo 		"<form id='form_search' class='inline' method='get'>\n";
+	if (permission_exists('message_all')) {
+		if ($_GET['show'] == 'all') {
+			echo "		<input type='hidden' name='show' value='all'>\n";
+		}
+		else {
+			echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
+		}
+	}
+	echo 		"<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
+	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
+	echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'messages_log.php','style'=>($search == '' ? 'display: none;' : null)]);
+	if ($paging_controls_mini != '') {
+		echo 	"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "		</form>\n";
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	if (permission_exists('message_delete') && $messages) {
+		echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
+	}
+
+	echo "<form id='form_list' method='post'>\n";
+	echo "<input type='hidden' id='action' name='action' value=''>\n";
+	echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
+
+	echo "<table class='list'>\n";
+	echo "<tr class='list-header'>\n";
+	if (permission_exists('message_delete')) {
+		echo "	<th class='checkbox'>\n";
+		echo "		<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($messages ?: "style='visibility: hidden;'").">\n";
+		echo "	</th>\n";
+	}
+	echo th_order_by('message_type', $text['label-message_type'], $order_by, $order);
+	echo th_order_by('message_direction', $text['label-message_direction'], $order_by, $order);
+	echo th_order_by('message_date', $text['label-message_date'], $order_by, $order);
+	echo th_order_by('message_from', $text['label-message_from'], $order_by, $order);
+	echo th_order_by('message_to', $text['label-message_to'], $order_by, $order);
+	echo th_order_by('message_text', $text['label-message_text'], $order_by, $order, null, "class='pct-20 hide-xs'");
+	if (permission_exists('message_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+		echo "	<td class='action-button'>&nbsp;</td>\n";
+	}
+	echo "</tr>\n";
+
+	if (is_array($messages) && @sizeof($messages) != 0) {
+		$x = 0;
+		foreach ($messages as $row) {
+			if (permission_exists('message_edit')) {
+				$list_row_url = "message_edit.php?id=".urlencode($row['message_uuid']);
+			}
+			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			if (permission_exists('message_delete')) {
+				echo "	<td class='checkbox'>\n";
+				echo "		<input type='checkbox' name='messages[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
+				echo "		<input type='hidden' name='messages[$x][uuid]' value='".escape($row['message_uuid'])."' />\n";
+				echo "	</td>\n";
+			}
+			echo "	<td>";
+			switch ($row['message_type']) {
+				case 'sms': echo $text['label-sms']; break;
+				case 'mms': echo $text['label-mms']; break;
+				case 'chat': echo $text['label-chat']; break;
+			}
+			echo "	</td>\n";
+			echo "	<td>";
+			switch ($row['message_direction']) {
+				case "inbound": echo $text['label-inbound']; break;
+				case "outbound": echo $text['label-outbound']; break;
+			}
+			echo "	</td>\n";
+			echo "	<td>";
+			$message_date = explode(' ', $row['message_date']);
+			$message_date = escape($message_date[0])." <span class='hide-sm-dn'>".$message_date[1]."</span>";
+			if (permission_exists('message_edit')) {
+				echo "<a href='".$list_row_url."'>".$message_date."</a>";
+			}
+			else {
+				echo $message_date;
+			}
+			echo "	</td>\n";
+			echo "	<td>".escape(format_phone($row['message_from']))."&nbsp;</td>\n";
+			echo "	<td>".escape(format_phone($row['message_to']))."&nbsp;</td>\n";
+			echo "	<td class='description overflow hide-xs'>".escape($row['message_text'])."&nbsp;</td>\n";
+			if (permission_exists('message_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+				echo "	<td class='action-button'>\n";
+				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+				echo "	</td>\n";
+			}
+			echo "</tr>\n";
+			$x++;
+		}
+		unset($messages);
+	}
+
+	echo "</table>\n";
+	echo "<br />\n";
+	echo "<div align='center'>".$paging_controls."</div>\n";
+	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
+	echo "</form>\n";
+
+//include the footer
+	require_once "resources/footer.php";
+
+?>

+ 143 - 0
message_media.php

@@ -0,0 +1,143 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+
+//get media uuid
+	$message_media_uuid = $_GET['id'];
+	$action = $_GET['action'];
+	if (is_numeric($_GET['width'])) {
+		$width = $_GET['width'];
+	}
+
+//get media
+	if (is_uuid($message_media_uuid)) {
+
+		$sql = "select message_media_name, message_media_type, message_media_url, message_media_content ";
+		$sql .= "from v_message_media ";
+		$sql .= "where message_media_uuid = :message_media_uuid ";
+		if (is_uuid($_SESSION['user_uuid'])) {
+			$sql .= "and user_uuid = :user_uuid ";
+			$parameters['user_uuid'] = $_SESSION['user_uuid'];
+		}
+		$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+		$parameters['message_media_uuid'] = $message_media_uuid;
+		$parameters['domain_uuid'] = $domain_uuid;
+		$database = new database;
+		$media = $database->select($sql, $parameters, 'row');
+		unset($sql, $parameters);
+
+		switch (strtolower($media['message_media_type'])) {
+			case 'jpg': $content_type = 'image/jpeg'; break;
+			case 'jpeg': $content_type = 'image/jpeg'; break;
+			case 'png': $content_type = 'image/png'; break;
+			case 'gif': $content_type = 'image/gif'; break;
+			case 'aac': $content_type = 'audio/aac'; break;
+			case 'wav': $content_type = 'audio/wav'; break;
+			case 'mp3': $content_type = 'audio/mpeg'; break;
+			case 'mp2': $content_type = 'video/mpeg'; break;
+			case 'm4v': $content_type = 'video/mp4'; break;
+			case 'pdf': $content_type = 'application/pdf'; break;
+			case 'doc': $content_type = 'application/vnd.ms-word'; break;
+			case 'docx': $content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; break;
+			case 'xls': $content_type = 'application/vnd.ms-excel'; break;
+			case 'xlsx': $content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; break;
+			case 'ppt': $content_type = 'application/vnd.ms-powerpoint'; break;
+			case 'pptx': $content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; break;
+			case 'zip': $content_type = 'application/zip'; break;
+			default: $content_type = 'application/octet-stream'; break;
+		}
+
+		switch ($action) {
+			case 'download':
+				//header("Content-type: ".$content_type."; charset=utf-8");
+				//header("Content-Disposition: attachment; filename=\"".$filename."\"");
+
+				header('Content-Description: File Transfer');
+				header('Content-Type: application/octet-stream');
+				header("Content-Disposition: attachment; filename=\"".$media['message_media_name']."\"");
+				header('Content-Transfer-Encoding: binary');
+				header('Expires: 0');
+				header('Cache-Control: must-revalidate');
+				header('Pragma: public');
+				header("Content-Length: ".strlen(base64_decode($media['message_media_content'])));
+
+				echo base64_decode($media['message_media_content']);
+				break;
+			case 'download-inline':
+				//header("Content-type: ".$content_type."; charset=utf-8");
+				//header("Content-Disposition: attachment; filename=\"".$filename."\"");
+				header("Content-Type: ".$content_type);
+				header("Content-Disposition: inline; filename=\"".$media['message_media_name']."\"");
+				header("Content-Length: ".strlen(base64_decode($media['message_media_content'])));
+				echo base64_decode($media['message_media_content']);
+				break;
+			case 'download-original':
+				header("Content-type: ".$content_type."; charset=utf-8");
+				header("Content-Disposition: attachment; filename=\"".$media['message_media_name']."\"");
+				header("Content-Length: ".strlen(base64_decode($media['message_media_content'])));
+				echo base64_decode($media['message_media_content']);
+				break;
+			case 'thumbnail':
+				if ($content_type = 'image/jpeg' || $content_type = 'image/png' || $content_type = 'image/gif') {
+
+					//get the image size
+					$image_size = getimagesize('data://application/octet-stream;base64,' . $media['message_media_content']);
+					$source_width = $image_size[0];
+					$source_height = $image_size[1];
+
+					//read the image
+					$source_image = imagecreatefromstring(base64_decode($media['message_media_content']));
+
+					//working
+					//header('Content-Type: image/jpeg');
+					//imagejpeg($source_image);
+
+					//get the image width and height
+					$source_width = imagesx($source_image);
+					$source_height = imagesy($source_image);
+
+					//calculate dimensions for the thumbmail
+					$destination_width = $width;
+					$destination_height = floor($source_height * ($destination_width / $source_width));
+
+					//send content type http header
+					header('Content-Type: '.$content_type);
+
+					//create the image, resample it and then stream binary
+					$destination_image = imagecreatetruecolor($destination_width, $destination_height);
+					//imagealphablending($img_dest, false);
+					//imagesavealpha($img_dest, true);
+					if ($destination_image !== false) {
+						imagecopyresampled($destination_image, $source_image, 0, 0, 0, 0, $destination_width, $destination_height, $source_width, $source_height);
+						if ($content_type = 'image/jpeg') {
+							imagejpeg($destination_image);
+						}
+						if ($content_type = 'image/png') {
+							imagejpeg($destination_image);
+						}
+						if ($content_type = 'image/gif') {
+							imagejpeg($destination_image);
+						}
+					}
+				}
+
+				break;
+			case 'display':
+				echo "	<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>\n";
+				echo "		<tr>\n";
+				echo "			<td align='center' valign='middle'>\n";
+				echo "				<img src=\"data:".$content_type.";base64,".$media['message_media_content']."\" style='width: auto; max-width: 95%; height: auto; max-height: 800px; box-shadow: 0px 1px 20px #888; cursor: pointer;' onclick=\"$('#message_media_layer').fadeOut(200);\" oncontextmenu=\"window.open('message_media.php?id=".$message_media_uuid."&src=".$message_media_source."&action=download'); return false;\" title=\"Click to Close, Right-Click to Save\">\n";
+				echo "			</td>\n";
+				echo "		</tr>\n";
+				echo "	</table>\n";
+				break;
+		}
+
+	}
+
+?>

+ 242 - 0
message_queue.php

@@ -0,0 +1,242 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//check permissions
+	if (permission_exists('message_view')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http post data
+	if (is_array($_POST['messages'])) {
+		$action = $_POST['action'];
+		$search = $_POST['search'];
+		$messages = $_POST['messages'];
+	}
+
+//process the http post data by action
+	if ($action != '' && is_array($messages) && @sizeof($messages) != 0) {
+		switch ($action) {
+			case 'delete':
+				if (permission_exists('message_delete')) {
+					$obj = new messages;
+					$obj->delete($messages);
+				}
+				break;
+		}
+
+		header('Location: messages_log.php'.($search != '' ? '?search='.urlencode($search) : null));
+		exit;
+	}
+
+//get variables used to control the order
+	$order_by = $_GET["order_by"];
+	$order = $_GET["order"];
+
+//add the search term
+	$search = strtolower($_GET["search"]);
+	if (strlen($search) > 0) {
+		$sql_search = " (";
+		$sql_search .= "lower(message_type) like :search ";
+		$sql_search .= "or lower(message_direction) like :search ";
+		$sql_search .= "or lower(message_from) like :search ";
+		$sql_search .= "or lower(message_to) like :search ";
+		$sql_search .= "or lower(message_text) like :search ";
+		$sql_search .= ") ";
+		$parameters['search'] = '%'.$search.'%';
+	}
+
+//prepare to page the results
+	$sql = "select count(*) from v_messages ";
+	if ($_GET['show'] == "all" && permission_exists('message_all')) {
+		if (isset($sql_search)) {
+			$sql .= "where ".$sql_search;
+		}
+	}
+	else {
+		$sql .= "where user_uuid = :user_uuid ";
+		$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+		if (isset($sql_search)) {
+			$sql .= "and ".$sql_search;
+		}
+		$parameters['user_uuid'] = $_SESSION['user_uuid'];
+		$parameters['domain_uuid'] = $domain_uuid;
+	}
+	$database = new database;
+	$num_rows = $database->select($sql, $parameters, 'column');
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search;
+	if ($_GET['show'] == "all" && permission_exists('message_all')) {
+		$param .= "&show=all";
+	}
+	if (isset($_GET['page'])) {
+		$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
+		list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
+		list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
+		$offset = $rows_per_page * $page;
+	}
+
+//get the list
+	$sql = str_replace('count(*)', '*', $sql);
+	$sql .= "order by message_date desc ";
+	$sql .= limit_offset($rows_per_page, $offset);
+	$database = new database;
+	$messages = $database->select($sql, $parameters, 'all');
+	unset($sql, $parameters);
+
+//create token
+	$object = new token;
+	$token = $object->create($_SERVER['PHP_SELF']);
+
+//include header
+	$document['title'] = $text['title-message_log'];
+	require_once "resources/header.php";
+
+//define the checkbox_toggle function
+	echo "<script type=\"text/javascript\">\n";
+	echo "	function checkbox_toggle(item) {\n";
+	echo "		var inputs = document.getElementsByTagName(\"input\");\n";
+	echo "		for (var i = 0, max = inputs.length; i < max; i++) {\n";
+	echo "			if (inputs[i].type === 'checkbox') {\n";
+	echo "				if (document.getElementById('checkbox_all').checked == true) {\n";
+	echo "					inputs[i].checked = true;\n";
+	echo "				}\n";
+	echo "			else {\n";
+	echo "					inputs[i].checked = false;\n";
+	echo "				}\n";
+	echo "			}\n";
+	echo "		}\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+//show the content
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['title-message_log']." (".$num_rows.")</b></div>\n";
+	echo "	<div class='actions'>\n";
+	echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'messages.php']);
+	if (permission_exists('message_delete') && $messages) {
+		echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>'margin-left: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
+	}
+	echo 		"<form id='form_search' class='inline' method='get'>\n";
+	if (permission_exists('message_all')) {
+		if ($_GET['show'] == 'all') {
+			echo "		<input type='hidden' name='show' value='all'>\n";
+		}
+		else {
+			echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
+		}
+	}
+	echo 		"<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
+	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
+	echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'messages_log.php','style'=>($search == '' ? 'display: none;' : null)]);
+	if ($paging_controls_mini != '') {
+		echo 	"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+	}
+	echo "		</form>\n";
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	if (permission_exists('message_delete') && $messages) {
+		echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
+	}
+
+	echo "<form id='form_list' method='post'>\n";
+	echo "<input type='hidden' id='action' name='action' value=''>\n";
+	echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
+
+	echo "<table class='list'>\n";
+	echo "<tr class='list-header'>\n";
+	if (permission_exists('message_delete')) {
+		echo "	<th class='checkbox'>\n";
+		echo "		<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($messages ?: "style='visibility: hidden;'").">\n";
+		echo "	</th>\n";
+	}
+	echo th_order_by('message_type', $text['label-message_type'], $order_by, $order);
+	echo th_order_by('message_direction', $text['label-message_direction'], $order_by, $order);
+	echo th_order_by('message_date', $text['label-message_date'], $order_by, $order);
+	echo th_order_by('message_from', $text['label-message_from'], $order_by, $order);
+	echo th_order_by('message_to', $text['label-message_to'], $order_by, $order);
+	echo th_order_by('message_text', $text['label-message_text'], $order_by, $order, null, "class='pct-20 hide-xs'");
+	if (permission_exists('message_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+		echo "	<td class='action-button'>&nbsp;</td>\n";
+	}
+	echo "</tr>\n";
+
+	if (is_array($messages) && @sizeof($messages) != 0) {
+		$x = 0;
+		foreach ($messages as $row) {
+			if (permission_exists('message_edit')) {
+				$list_row_url = "message_edit.php?id=".urlencode($row['message_uuid']);
+			}
+			echo "<tr class='list-row' href='".$list_row_url."'>\n";
+			if (permission_exists('message_delete')) {
+				echo "	<td class='checkbox'>\n";
+				echo "		<input type='checkbox' name='messages[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
+				echo "		<input type='hidden' name='messages[$x][uuid]' value='".escape($row['message_uuid'])."' />\n";
+				echo "	</td>\n";
+			}
+			echo "	<td>";
+			switch ($row['message_type']) {
+				case 'sms': echo $text['label-sms']; break;
+				case 'mms': echo $text['label-mms']; break;
+				case 'chat': echo $text['label-chat']; break;
+			}
+			echo "	</td>\n";
+			echo "	<td>";
+			switch ($row['message_direction']) {
+				case "inbound": echo $text['label-inbound']; break;
+				case "outbound": echo $text['label-outbound']; break;
+			}
+			echo "	</td>\n";
+			echo "	<td>";
+			$message_date = explode(' ', $row['message_date']);
+			$message_date = escape($message_date[0])." <span class='hide-sm-dn'>".$message_date[1]."</span>";
+			if (permission_exists('message_edit')) {
+				echo "<a href='".$list_row_url."'>".$message_date."</a>";
+			}
+			else {
+				echo $message_date;
+			}
+			echo "	</td>\n";
+			echo "	<td>".escape(format_phone($row['message_from']))."&nbsp;</td>\n";
+			echo "	<td>".escape(format_phone($row['message_to']))."&nbsp;</td>\n";
+			echo "	<td class='description overflow hide-xs'>".escape($row['message_text'])."&nbsp;</td>\n";
+			if (permission_exists('message_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+				echo "	<td class='action-button'>\n";
+				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
+				echo "	</td>\n";
+			}
+			echo "</tr>\n";
+			$x++;
+		}
+		unset($messages);
+	}
+
+	echo "</table>\n";
+	echo "<br />\n";
+	echo "<div align='center'>".$paging_controls."</div>\n";
+	echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
+	echo "</form>\n";
+
+//include the footer
+	require_once "resources/footer.php";
+
+?>

+ 48 - 0
message_send.php

@@ -0,0 +1,48 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (!permission_exists('message_add') && !permission_exists('message_edit')) {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get http post variables and set them to php variables
+	if (is_array($_REQUEST)) {
+		//$message_from = $_REQUEST["message_from"];
+		//$message_to = $_REQUEST["message_to"];
+		$message_from = urldecode($_REQUEST["message_from"]);
+		$message_to = urldecode($_REQUEST["message_to"]);
+		$message_text = $_REQUEST["message_text"];
+		$message_media = $_FILES["message_media"];
+	}
+
+//translate the %2b to a '+' and its already a plus preserve the + rather than converting it into a space
+	//if (isset($message_from)) {
+	//	$message_from = str_replace('%2b', '+', $message_from);
+	//}
+	//if (isset($message_to)) {
+	//	$message_to = str_replace('%2b', '+', $message_to);
+	//}
+
+//send the message
+	if (count($_REQUEST) > 0 && strlen($_REQUEST["persistformvar"]) == 0) {
+		$message = new messages;
+		$message->send('sms', $message_from, $message_to, $message_text, $message_media);
+	}
+
+//URL to send
+	// https://voip.fusionpbx.com/app/messages/message_send.php?message_from=12083334444&message_to=12083330000&message_text=bbb
+
+?>

+ 17 - 0
message_update.php

@@ -0,0 +1,17 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	include "resources/classes/cache.php";
+
+//get the last message in the cache
+	if (is_uuid($_GET['id'])) {
+		$cache = new cache;
+		echo $cache->get("messages:user:last_message:".$_GET['id']);
+	}
+
+?>

+ 623 - 0
messages.php

@@ -0,0 +1,623 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (!permission_exists('message_view')) {
+		echo "access denied";
+		exit;
+	}
+
+//missing application - app/providers is required 
+	if (!file_exists($_SERVER["PROJECT_ROOT"].'/app/providers/app_config.php')) {
+		$document['title'] = $text['title-messages'];
+		require_once "resources/header.php";
+		echo "<br /><br />\n";
+
+		echo "<div>\n";
+		echo "	<div class='heading' style=\"text-align: center;\"><b>Missing Application</b></div>\n";
+		echo "	<div style=\"text-align: center;\">\n";
+		echo "	<br />\n";
+		echo "	This feature requires the <strong>provider</strong> member feature to be installed.<br />\n";
+		echo "	Please install it using the <strong>Application Manager</strong>.\n";
+		echo "	</div>\n";
+		echo "	<div style='clear: both;'></div>\n";
+		echo "</div>\n";
+
+		echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
+		echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
+		echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
+		echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
+		echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
+
+		require_once "resources/footer.php";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the message from
+	$sql = "select destination_number from v_destinations ";
+	$sql .= "where domain_uuid = :domain_uuid ";
+	$sql .= "and user_uuid = :user_uuid ";
+	$sql .= "and destination_type_text = 1 ";
+	$sql .= "and destination_enabled = 'true' ";
+	$sql .= "order by destination_number asc ";
+	$parameters['domain_uuid'] = $domain_uuid;
+	$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
+	$database = new database;
+	$rows = $database->select($sql, $parameters, 'all');
+	if (is_array($rows) && @sizeof($rows)) {
+		foreach ($rows as $row) {
+		
+			$destinations[] = $row['destination_number'];
+		}
+	}
+	unset($sql, $parameters, $rows, $row);
+	$message_from = $destinations[0];
+	//view_array($destinations);
+
+//get the message to
+	if (isset($_SESSION['user']['contact_number']) && strlen($_SESSION['user']['contact_number']) > 0) {
+		$message_to = $_SESSION['user']['contact_number'];
+	}
+
+//get self (primary contact attachment) image
+	/*
+	if (!is_array($_SESSION['tmp']['messages']['contact_me'])) {
+		$sql = "select attachment_filename as filename, attachment_content as image ";
+		$sql .= "from v_contact_attachments ";
+		$sql .= "where domain_uuid = :domain_uuid ";
+		$sql .= "and contact_uuid = :contact_uuid ";
+		$sql .= "and attachment_primary = 1 ";
+		$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
+		$parameters['contact_uuid'] = $_SESSION['user']['contact_uuid'];
+		$database = new database;
+		$row = $database->select($sql, $parameters, 'row');
+		$_SESSION['tmp']['messages']['contact_me'] = $row;
+		unset($sql, $parameters, $row);
+	}
+	*/
+
+//get the cache
+	$cache = new cache;
+	$message_update = $cache->get("messages:user:last_message:".$_SESSION['user']['user_uuid']);
+
+//additional includes
+	$document['title'] = $text['title-messages'];
+	require_once "resources/header.php";
+
+//add audio
+	echo "<audio id=\"message_audio\" >\n";
+	echo "	<source src=\"".$_SESSION['message']['notify_sound']['text']."\" type=\"audio/mpeg\">\n";
+	echo "</audio>\n";
+	echo "<script language='JavaScript' type='text/javascript'>\n";
+	echo "	var audio = document.getElementById('message_audio');\n";
+	echo "	function message_notify(){\n";
+	echo "		audio.play();\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+//additional sound notes
+	//https://notificationsounds.com/notification-sounds/clearly-602
+	//echo "	<source src=\"http://soundbible.com/grab.php?id=1682&type=mp3\" type=\"audio/mpeg\">\n";
+	//https://soundbible.com/search.php?q=beep
+	//https://freesound.org/search/?q=notify&page=2#sound
+
+//check for updates with ajax
+	echo "<script language='JavaScript' type='text/javascript'>\n";
+	echo "\n";
+	echo "function check_updates() {\n";
+	echo "	var xhttp = new XMLHttpRequest();\n";
+	echo "	xhttp.open('GET', '/app/messages/message_update.php?id=".$_SESSION['user']['user_uuid']."');\n";
+	echo "	xhttp.send();\n";
+	echo "	xhttp.onreadystatechange = function() {\n";
+	//echo "		var time_now = date_now.getTime();\n";
+	//echo "		var time_diff = time_now - date_now;\n";
+	//echo "		var seconds_elapsed = Math.floor ( time_diff / 1000 );\n";
+	//echo "		if (this.readyState == 4 && this.status == 200 && seconds_elapsed > 2) {\n";
+	echo "		if (this.readyState == 4 && this.status == 200) {\n";
+	echo "			if (this.responseText != document.getElementById('message_update').value) {\n";
+	//echo "				alert('update ajax: '+this.responseText+ ' input: '+document.getElementById('message_update').value);\n";
+	echo "				document.getElementById('message_update').value = this.responseText;\n";
+	echo "				message_to = document.getElementById('message_to').value;\n";
+	echo "				contacts_url = '/app/messages/messages_contacts.php';\n";
+	echo "				parent.document.getElementById('contacts_frame').src = contacts_url;\n";
+	echo "				parent.document.getElementById('contacts_frame').onload = function() {\n";
+	echo "					scroll_to_bottom('messages_frame');\n";
+	echo "				}\n";
+	echo "				messages_url = '/app/messages/messages_thread.php?number='+message_to;\n";
+	echo "				parent.document.getElementById('messages_frame').src = messages_url;\n";
+	echo "				parent.document.getElementById('messages_frame').onload = function() {\n";
+	echo "					scroll_to_bottom('messages_frame');\n";
+	echo "				}\n";
+	echo "				message_notify();\n";
+	echo "			}\n";
+	echo "		}\n";
+	echo "	};\n";
+	echo "}\n";
+	echo "setInterval(check_updates, 1000);\n";
+	echo "\n";
+	echo "</script>\n";
+
+//body onload
+	echo "<body onLoad=\"scroll_to_bottom('messages_frame');\">\n";
+
+//resize thread window on window resize
+	echo "<script language='JavaScript' type='text/javascript'>\n";
+	echo "	$(document).ready(function() {\n";
+	echo "		$(window).on('resizeEnd', function() {\n";
+	echo "			$('div#thread_messages').animate({ 'max-height': $(window).height() - 480 }, 200);\n";
+	echo "		});\n";
+	echo " 	});\n";
+	echo "</script>\n";
+
+//styles
+	echo "<style>\n";
+	echo "\n";
+
+	echo "	#message_new_layer {\n";
+	echo "		z-index: 999999;\n";
+	echo "		position: absolute;\n";
+	echo "		left: 0px;\n";
+	echo "		top: 0px;\n";
+	echo "		right: 0px;\n";
+	echo "		bottom: 0px;\n";
+	echo "		text-align: center;\n";
+	echo "		vertical-align: middle;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	#message_new_container {\n";
+	echo "		display: block;\n";
+	echo "		background-color: #fff;\n";
+	echo "		padding: 20px 30px;\n";
+	if (http_user_agent('mobile')) {
+		echo "	margin: 0;\n";
+	}
+	else {
+		echo "	margin: auto 30%;\n";
+	}
+	echo "		text-align: left;\n";
+	echo "		-webkit-box-shadow: 0px 1px 20px #888;\n";
+	echo "		-moz-box-shadow: 0px 1px 20px #888;\n";
+	echo "		box-shadow: 0px 1px 20px #888;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	#message_media_layer {\n";
+	echo "		z-index: 999999;\n";
+	echo "		position: absolute;\n";
+	echo "		left: 0px;\n";
+	echo "		top: 0px;\n";
+	echo "		right: 0px;\n";
+	echo "		bottom: 0px;\n";
+	echo "		text-align: center;\n";
+	echo "		vertical-align: middle;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	td.contact_selected {\n";
+	echo "		border-right: 5px solid ".($_SESSION['theme']['table_row_border_color']['text'] != '' ? $_SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	.contact_list_image {\n";
+	echo "		float: left;\n";
+	echo "		width: 75px;\n";
+	echo "		height: 75px;\n";
+	echo "		margin: 3px 8px 3px 2px;\n";
+	echo "		border: 1px solid ".($_SESSION['theme']['table_row_border_color']['text'] != '' ? $_SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
+	echo "		background-repeat: no-repeat;\n";
+	echo "		background-size: cover;\n";
+	echo "		background-position: center center;\n";
+	echo "		border-radius: 11px;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo ".container {\n";
+	echo "	width: 100%;\n";
+	echo "	height: 75vh;\n";
+	echo "	max-width: 100%;\n";
+	//echo "	max-height: 100%;\n";
+	//echo "	border:1px solid black;\n";
+	echo "  display: grid;\n";
+
+	//flex
+	//echo "	flex: 1;\n";
+	//echo "	display: flex;\n";
+	//echo "	flex-direction: column;\n";
+	//echo "	justify-content: space-between;\n";
+
+	//echo "	display: inline-grid;\n";
+	echo "	grid-template-columns: minmax(120px, 1fr) minmax(200px, 3fr) 1fr;\n";
+	echo "	grid-template-rows: 1fr;\n";
+	echo "	gap: 10px 10px;\n";
+	//echo "  grid-auto-flow: row;\n";
+
+	echo "	grid-template-areas:\n"; 
+	//echo "		\"contacts header header\"\n";
+	echo "		\"contacts messages details\"\n";
+	echo "		\"contacts send details\"\n";
+	//echo "		width: 100%;\n";
+	//echo "		height: 100%;\n";
+	echo "	}\n";
+	echo "\n";
+
+	echo ".contacts {\n";
+	echo "		grid-area: contacts;\n";
+	//echo "		min-width: 120px;\n";
+	//echo "		height: 100%;\n";
+	echo "		background: ".$_SESSION['theme']['form_table_field_background_color']['text'].";\n";
+	echo "	}\n";
+	echo "\n";
+	echo ".messages { grid-area: messages; }\n";
+	//echo ".header { grid-area: header; }\n";
+	echo ".details { grid-area: details; }\n";
+	echo ".send { grid-area: send; }\n";
+	echo "\n";
+
+	echo "@media (max-width: 992px) {\n";
+	echo "		.container { grid-template-columns: 120px minmax(200px, 3fr); }\n";
+	echo "}\n";
+
+	echo "@media (max-width: 500px) {\n";
+	echo "		.attachment_image { display: none; }\n";
+	echo "}\n";
+
+	echo "</style>\n";
+
+//cache self (primary contact attachment) image
+	if (is_array($_SESSION['tmp']['messages']['contact_me']) && sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
+		$attachment_type = strtolower(pathinfo($_SESSION['tmp']['messages']['contact_me']['filename'], PATHINFO_EXTENSION));
+		echo "<img id='src_message-bubble-image-me' style='display: none;' src='data:image/".$attachment_type.";base64,".$_SESSION['tmp']['messages']['contact_me']['image']."'>\n";
+	}
+
+//new message layer
+	if (permission_exists('message_add')) {
+		echo "<iframe name=\"message_new_frame\" style=\"display: none; width: 0px; height: 0px;\"></iframe>\n";
+		echo "<div id='message_new_layer' style='display: none;'>\n";
+		echo "	<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>\n";
+		echo "		<tr>\n";
+		echo "			<td align='center' valign='middle'>\n";
+		echo "				<form id='message_new' method='post' enctype='multipart/form-data' action='message_send.php' target='message_new_frame'>\n";
+		echo "				<span id='message_new_container'>\n";
+		echo "					<b>".$text['label-new_message']."</b><br /><br />\n";
+		echo "					<table width='100%'>\n";
+		echo "						<tr>\n";
+		echo "							<td class='vncell'>".$text['label-message_from']."</td>\n";
+		echo "							<td class='vtable'>\n";
+		if (is_array($destinations) && sizeof($destinations) != 0) {
+			echo "							<select class='formfld' name='message_from' id='message_new_from' onchange=\"$('#message_new_to').focus();\">\n";
+			foreach ($destinations as $destination) {
+				echo "							<option value='".$destination."'>".format_phone($destination)."</option>\n";
+			}
+			echo "							</select>\n";
+		}
+		else {
+			echo "							<input type='text' class='formfld' name='message_from' id='message_new_from'>\n";
+		}
+		echo "							</td>\n";
+		echo "						</tr>\n";
+		echo "						<tr>\n";
+		echo "							<td class='vncell'>".$text['label-message_to']."</td>\n";
+		echo "							<td class='vtable'>\n";
+		echo "								<input type='text' class='formfld' name='message_to' id='message_new_to'>\n";
+		echo "							</td>\n";
+		echo "						</tr>\n";
+		echo "						<tr>\n";
+		echo "							<td class='vncell'>".$text['label-message_text']."</td>\n";
+		echo "							<td class='vtable'>\n";
+		echo "								<textarea class='formfld' style='width: 100%; height: 80px;' name='message_text' name='message_new_text'></textarea>\n";
+		echo "							</td>\n";
+		echo "						</tr>\n";
+		echo "						<tr>\n";
+		echo "							<td class='vncell'>".$text['label-message_media']."</td>\n";
+		echo "							<td class='vtable'>\n";
+		echo "								<input type='file' class='formfld' multiple='multiple' name='message_media[]' id='message_new_media'>\n";
+		echo "							</td>\n";
+		echo "						</tr>\n";
+		echo "					</table>\n";
+		echo "					<center style='margin-top: 15px;'>\n";
+		echo button::create(['type'=>'reset','label'=>$text['button-clear'],'icon'=>$_SESSION['theme']['button_icon_reset'],'style'=>'float: left;','onclick'=>"document.getElementById('message_new').reset();"]);
+		echo button::create(['type'=>'button','label'=>$text['button-close'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'onclick'=>"$('#message_new_layer').fadeOut(200);"]);
+		echo button::create(['type'=>'submit','label'=>$text['button-send'],'icon'=>'paper-plane','style'=>'float: right;','onclick'=>"document.getElementById('message_new').submit();document.getElementById('message_new_layer').style.display='none'"]);
+		//echo button::create(['type'=>'reset','label'=>$text['button-clear'],'icon'=>$_SESSION['theme']['button_icon_reset'],'style'=>'float: left;','onclick'=>"$('#message_new').reset();"]);
+		//echo "						<input type='reset' class='btn' style='float: left; margin-top: 15px;' value='".$text['button-clear']."' onclick=\"$('#message_new').reset();\">\n";
+		//echo "						<input type='button' class='btn' style='margin-top: 15px;' value='".$text['button-close']."' onclick=\"$('#message_new_layer').fadeOut(200);\">\n";
+		//echo "						<input type='submit' class='btn' style='float: right; margin-top: 15px;' value='".$text['button-send']."'>\n";
+		echo "					</center>\n";
+		echo "				</span>\n";
+		echo "				</form>\n";
+		echo "			</td>\n";
+		echo "		</tr>\n";
+		echo "	</table>\n";
+		echo "</div>\n";
+	}
+
+//message media layer
+	echo "<div id='message_media_layer' style='display: none;'></div>\n";
+
+//show the content
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['title-messages']."</b></div>\n";
+	echo "	<div class='actions'>\n";
+	if (permission_exists('message_add')) {
+		echo button::create(['type'=>'button','label'=>$text['label-new_message'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','onclick'=>"document.getElementById('message_new').reset(); $('#message_new_layer').fadeIn(200); unload_thread();"]);
+		//echo button::create(['type'=>'button','label'=>$text['label-new_message'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','onclick'=>"document.getElementById('message_new').reset();$('#message_new_layer').fadeIn(200); unload_thread();"]);
+	}
+	echo button::create(['type'=>'button','label'=>$text['label-log'],'icon'=>'list','link'=>'message_logs.php']);
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	echo "<div class=\"container\">\n";
+	echo "	<div class=\"contacts\" style='border: 0px solid black;'>\n";
+	echo "		<iframe id=\"contacts_frame\" style=\"width: 100%; height: 100%;\" src=\"/app/messages/messages_contacts.php\" frameborder=\"0\"></iframe>\n";
+	echo "	</div>\n";
+	echo "	<div class=\"messages\" style='border: 0px solid black;'>\n";
+	echo "		<iframe id=\"messages_frame\" style=\"width: 100%; height: 100%;\" src=\"/app/messages/messages_thread.php\" frameborder=\"0\"></iframe>\n";
+	echo "	</div>\n";
+	echo "	<div class=\"send\">\n";
+
+	if (permission_exists('message_add')) {
+		//output input form
+		//echo "<iframe name=\"message_reply_frame\" style=\"display: none; width: 0px; height: 0px;\"></iframe>\n";
+		//echo "<form id='message_reply' method='post' onsubmit='document.getElementById(\"message_text\").value = \"\";' enctype='multipart/form-data' action='message_send.php' target='message_reply_frame'>\n";
+		echo "<form id='message_reply' method='post' onsubmit='' enctype='multipart/form-data' action='message_send.php'>\n";
+		echo "<input type='hidden' name='message_update' id='message_update' value='".$message_update."'>\n";
+
+		//echo "<div>\n";
+		if (count($destinations) > 1) {
+			echo "	From <select class='formfld' name='message_from' id='message_from'\">\n";
+			foreach ($destinations as $destination) {
+				echo "		<option value='".$destination."'>".$destination."</option>\n";
+			}
+			echo "	</select>\n";
+		}
+		else {
+			//echo "	From \n";
+			echo "	<input type='hidden' class='formfld' name='message_from' id='message_from' value='".urlencode($message_from)."'>\n";
+		}
+		//echo "	To <div id='div_message_to'>".escape($message_to)."</div>\n";
+		echo "	<input type='hidden' class='formfld' name='message_to' id='message_to' value='".urlencode($message_to)."'>\n";
+		//echo "</div>\n";
+
+		echo "<textarea class='formfld' id='message_text' name='message_text' style='width: 100%; max-width: 100%; min-height: 55px; border: 1px solid #cbcbcb; resize: vertical; padding: 5px 8px; margin-top: 10px; margin-bottom: 5px;' placeholder=\"".$text['description-enter_response']."\"></textarea>";
+		//echo "<input type='input' class='formfld' name='message_text' id='message_text' style='width: 90%; max-width: 100%;'>\n";
+		echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' style='margin-top: 5px;'>\n";
+		echo "	<tr>\n";
+		echo "		<td class='attachment_image' style='width: 20px;'><img src='resources/images/attachment.png' style='min-width: 20px; height: 20px; border: none; padding-right: 5px;'></td>\n";
+		echo "		<td>\n";
+		echo "			<input type='file' class='formfld' style='max-width: 170px;' multiple='multiple' name='message_media[]' id='message_new_media'>\n";
+		echo "		</td>\n";
+		echo "		<td style='text-align: right;'>\n";
+		echo "			".button::create(['type'=>'submit','label'=>$text['button-send'],'title'=>$text['label-ctrl_enter'],'icon'=>'paper-plane']);
+		echo "		</td>\n";
+		echo "	</tr>\n";
+		//echo "	<tr>\n";
+		//echo "		<td align='left' width='50%'>";
+		//echo button::create(['label'=>$text['button-clear'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'reset','onclick'=>"$('#message_text').focus();"]);
+		//echo "		</td>\n";
+		//echo "		<td align='center'><span id='thread_refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; cursor: pointer;' onclick=\"refresh_thread_stop('".$number."','".$contact_uuid."');\" alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span></td>\n";
+		//echo "		<td align='right' width='50%'>";
+		//echo button::create(['type'=>'submit','label'=>$text['button-send'],'title'=>$text['label-ctrl_enter'],'icon'=>'paper-plane']);
+		//echo "		</td>\n";
+		//echo "	</tr>\n";
+		echo "</table>\n";
+		//echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' style='margin-top: 15px;'>\n";
+		//echo "	<tr>\n";
+		//echo "		<td align='left' width='50%'>";
+		//echo button::create(['label'=>$text['button-clear'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'reset','onclick'=>"$('#message_text').focus();"]);
+		//echo "		</td>\n";
+		//echo "		<td align='center'><span id='thread_refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; cursor: pointer;' onclick=\"refresh_thread_stop('".$number."','".$contact_uuid."');\" alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span></td>\n";
+		//echo "		<td align='right' width='50%'>";
+		//echo button::create(['type'=>'submit','label'=>$text['button-send'],'title'=>$text['label-ctrl_enter'],'icon'=>'paper-plane']);
+		//echo "		</td>\n";
+		//echo "	</tr>\n";
+		//echo "</table>\n";
+		echo "</form>\n";
+
+		//js to load messages for clicked number
+		echo "<script>\n";
+
+		//scroll to the bottom
+		echo "	function scroll_to_bottom(id) {\n";
+		echo "		document.getElementById(id).contentWindow.scrollTo(0, 999999);\n";
+		echo "	}\n";
+		echo "\n";
+
+		//update the url
+		echo "	function update_url(id, url) {\n";
+		echo "		document.getElementById(id).src = url;\n";
+		echo "	}\n";
+
+		//define form submit function
+		echo "	$('#message_reply').submit(function(event) {\n";
+		echo "		event.preventDefault();\n";
+		echo "		$.ajax({\n";
+		echo "			url: $(this).attr('action'),\n";
+		echo "			type: $(this).attr('method'),\n";
+		echo "			data: new FormData(this),\n";
+		echo "			processData: false,\n";
+		echo "			contentType: false,\n";
+		echo "			cache: false,\n";
+		echo "			success: function(){\n";
+		echo "					document.getElementById('message_reply').reset();\n";
+		if (!http_user_agent('mobile')) {
+			echo "				if ($('#message_new_layer').is(':hidden')) {\n";
+			echo "					$('#message_text').focus();\n";
+			echo "				}\n";
+		}
+
+		//refresh the message thread
+		//echo "					setTimeout(function() {\n";
+		//echo "						refresh_thread()\n";
+		//echo "					}, 1000);\n";
+		//echo "				refresh_thread('".$number."', '".$contact_uuid."', 'true');\n";
+
+		echo "				}\n";
+		echo "		});\n";
+		echo "	});\n";
+		//enable ctrl+enter to send
+		echo "	$('#message_text').keydown(function (event) {\n";
+		echo "		if ((event.keyCode == 10 || event.keyCode == 13) && event.ctrlKey) {\n";
+		echo "			$('#message_compose').submit();\n";
+		echo "		}\n";
+		echo "	});\n";
+
+		echo "</script>\n";
+	}
+	echo "	</div>\n"; //send
+	echo "	<div class=\"details\">\n";
+	//echo "		<iframe id=\"messages_frame\" style=\"width: 100%; height: 100%;\" src=\"/app/contacts/contact_view.php?id=&query_string=\" frameborder=\"0\"></iframe>\n";
+	echo "	</div>\n";
+	echo "</div>\n"; //container
+
+	echo "<script>\n";
+	echo "	function refresh_thread() {\n";
+	echo "		message_to = parent.document.getElementById('message_to').value;\n";
+	echo "		update_url('messages_frame', '/app/messages/messages_thread.php?number='+message_to);\n";
+	echo "	}\n";
+
+	echo "</script>\n";
+/*
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+	echo "	<tr>\n";
+	echo "		<th width='30%'>".$text['label-contacts']."</th>\n";
+	echo "		<th style='white-space: nowrap;'><nobr>".$text['label-messages']."<nobr></th>\n";
+	echo "		<th width='70%' style='text-align: right; font-weight: normal;' id='contact_current_name'>\n";
+	echo "			<iframe id=\"frame\" src=\"/app/messages/messages_contacts.php\" frameborder=\"0\"></iframe>\n";
+	echo "		</th>\n";
+	echo "	</tr>\n";
+	echo "	<tr>\n";
+	echo "		<td id='contacts' valign='top'><center>&middot;&middot;&middot;</center></td>\n";
+	echo "		<td id='thread' colspan='2' valign='top' style='border-left: 1px solid #c5d1e5; padding: 15px 0 15px 15px;'><center>&middot;&middot;&middot;</center></td>\n";
+	echo "	</tr>\n";
+	echo "</table>\n";
+	echo "<input type='hidden' id='contact_current_number' value=''>\n";
+*/
+//js to load messages for clicked number
+	//echo "<script>\n";
+
+	/*
+	$refresh_contacts = is_numeric($_SESSION['message']['refresh_contacts']['numeric']) && $_SESSION['message']['refresh_contacts']['numeric'] > 0 ? $_SESSION['message']['refresh_contacts']['numeric'] : 10; //default (seconds)
+	$refresh_thread = is_numeric($_SESSION['message']['refresh_thread']['numeric']) && $_SESSION['message']['refresh_thread']['numeric'] > 0 ? $_SESSION['message']['refresh_thread']['numeric'] : 5; //default (seconds)
+	echo "	var contacts_refresh = ".($refresh_contacts * 1000).";\n";
+	echo "	var thread_refresh = ".($refresh_thread * 1000).";\n";
+	echo "	var timer_contacts;\n";
+	echo "	var timer_thread;\n";
+
+	echo "	function refresh_contacts() {\n";
+	echo "		clearTimeout(timer_contacts);\n";
+	echo "		$('#contacts').load('messages_contacts.php?sel=' + $('#contact_current_number').val(), function(){\n";
+	echo "			timer_contacts = setTimeout(refresh_contacts, contacts_refresh);\n";
+	echo "		});\n";
+	echo "	}\n";
+
+	echo "	function load_thread(number, contact_uuid) {\n";
+	echo "		clearTimeout(timer_thread);\n";
+	echo "		$('#thread').load('messages_thread.php?number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n";
+	echo "			$('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n";
+	echo "				$('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
+	echo "				$('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
+						//note: the order of the above two lines matters!
+	if (!http_user_agent('mobile')) {
+		echo "			if ($('#message_new_layer').is(':hidden')) {\n";
+		echo "				$('#message_text').focus();\n";
+		echo "			}\n";
+	}
+	echo "				refresh_contacts();\n";
+	echo "				timer_thread = setTimeout(refresh_thread_start, thread_refresh, number, contact_uuid);\n";
+	echo "			});\n";
+	echo "		});\n";
+	echo "	}\n";
+
+	echo "	function unload_thread() {\n";
+	echo "		clearTimeout(timer_thread);\n";
+	echo "		$('#thread').html('<center>&middot;&middot;&middot;</center>');\n";
+	echo "		$('#contact_current_number').val('');\n";
+	echo "		$('#contact_current_name').html('');\n";
+	echo "		refresh_contacts();\n";
+	echo "	}\n";
+
+	echo "	function refresh_thread(number, contact_uuid, onsent) {\n";
+	echo "		$('#thread_messages').load('messages_thread.php?refresh=true&number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n";
+	echo "			$('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n";
+	echo "				$('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
+	echo "				$('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
+						//note: the order of the above two lines matters!
+	if (!http_user_agent('mobile')) {
+		echo "				if ($('#message_new_layer').is(':hidden')) {\n";
+		echo "			$('#message_text').focus();\n";
+		echo "			}\n";
+	}
+	echo "				if (onsent != 'true') {\n";
+	echo "					timer_thread = setTimeout(refresh_thread, thread_refresh, number, contact_uuid);\n";
+	echo "				}\n";
+	echo "			});\n";
+	echo "		});\n";
+	echo "	}\n";
+
+//refresh controls
+	echo "	function refresh_contacts_stop() {\n";
+	echo "		clearTimeout(timer_contacts);\n";
+	echo "		document.getElementById('contacts_refresh_state').innerHTML = \"<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_contacts_start();' alt='".$text['label-refresh_enable']."' title='".$text['label-refresh_enable']."'>\";\n";
+	echo "	}\n";
+
+	echo "	function refresh_contacts_start() {\n";
+	echo "		if (document.getElementById('contacts_refresh_state')) {\n";
+	echo "			document.getElementById('contacts_refresh_state').innerHTML = \"<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_contacts_stop();' alt='".$text['label-refresh_pause']."' title='".$text['label-refresh_pause']."'>\";\n";
+	echo "			refresh_contacts();\n";
+	echo "		}\n";
+	echo "	}\n";
+
+	echo "	function refresh_thread_stop(number, contact_uuid) {\n";
+	echo "		clearTimeout(timer_thread);\n";
+	?>			document.getElementById('thread_refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick=\"refresh_thread_start('" + number + "', '" + contact_uuid + "');\" alt=\"<?php echo $text['label-refresh_enable']; ?>\" title=\"<?php echo $text['label-refresh_enable']; ?>\">";<?php
+	echo "	}\n";
+
+	echo "	function refresh_thread_start(number, contact_uuid) {\n";
+	echo "		if (document.getElementById('thread_refresh_state')) {\n";
+	?>				document.getElementById('thread_refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick=\"refresh_thread_stop('" + number + "', '" + contact_uuid + "');\" alt=\"<?php echo $text['label-refresh_pause']; ?>\" title=\"<?php echo $text['label-refresh_pause']; ?>\">";<?php
+	echo "			refresh_thread(number, contact_uuid);\n";
+	echo "		}\n";
+	echo "	}\n";
+
+//define form submit function
+	if (permission_exists('message_add')) {
+		echo "	$('#message_new').submit(function(event) {\n";
+		echo "		event.preventDefault();\n";
+		echo "		$.ajax({\n";
+		echo "			url: $(this).attr('action'),\n";
+		echo "			type: $(this).attr('method'),\n";
+		echo "			data: new FormData(this),\n";
+		echo "			processData: false,\n";
+		echo "			contentType: false,\n";
+		echo "			cache: false,\n";
+		echo "			success: function(){\n";
+		echo "				if ($.isNumeric($('#message_new_to').val())) {\n";
+		echo "					$('#contact_current_number').val($('#message_new_to').val());\n";
+		echo "					load_thread($('#message_new_to').val());\n";
+		echo "				}\n";
+		echo "				$('#message_new_layer').fadeOut(400);\n";
+		echo "				document.getElementById('message_new').reset();\n";
+		echo "				refresh_contacts();\n";
+		echo "			}\n";
+		echo "		});\n";
+		echo "	});\n";
+	}
+*/
+
+//include the footer
+	require_once "resources/footer.php";
+
+?>

+ 355 - 0
messages_contacts.php

@@ -0,0 +1,355 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (!permission_exists('message_view')) {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get selected number/contact
+	if (isset($_GET['number']) && strlen($_GET['number']) > 0) {
+		$_SESSION['user']['contact_number'] = $_GET['number'];
+	}
+
+//build a list of groups the user is a member of to be used in a SQL in
+	foreach($_SESSION['user']['groups'] as $group) {
+		if (is_uuid($group['group_uuid'])) {
+			$group_uuids[] =  $group['group_uuid'];
+		}
+	}
+	$group_uuids_in = "'".implode("','", $group_uuids)."'";
+
+//get the list of contacts
+	$sql .= "select *, \n";
+	$sql .= "(\n";
+	$sql .= "	(select effective_caller_id_name as name from v_extensions where n.number = extension limit 1)\n";
+	$sql .= "	union\n";
+	$sql .= "	(select concat_ws(' ', contact_name_given, contact_name_family) as name from v_contacts where contact_uuid in (select contact_uuid from v_contact_phones where n.number = phone_number) limit 1)\n";
+	$sql .= ") as name,\n";
+	$sql .= "(\n";
+	$sql .= "	select contact_uuid from v_contact_phones where n.number = phone_number limit 1\n";
+	$sql .= ") as contact_uuid,\n";
+	$sql .= "(\n";
+	$sql .= "	select attachment_filename from v_contact_attachments where contact_uuid in (select contact_uuid from v_contact_phones where n.number = phone_number)\n";
+	$sql .= ") as contact_image_filename,\n";
+	$sql .= "(\n";
+	$sql .= "	select attachment_content from v_contact_attachments where contact_uuid in (select contact_uuid from v_contact_phones where n.number = phone_number)\n";
+	$sql .= ") as contact_image_content,\n";
+	$sql .= "(\n";
+	$sql .= "	select count(*) as count from v_messages where message_read is not true and message_direction = 'inbound' and message_from = n.number\n";
+	$sql .= ") as count,\n";
+	$sql .= "(\n";
+	$sql .= "	select message_text from v_messages\n";
+	$sql .= "	where \n";
+	$sql .= "	(\n";
+	$sql .= "		(message_direction = 'inbound' and message_from = n.number)\n";
+	$sql .= "		or \n";
+	$sql .= "		(message_direction = 'outbound' and message_to = n.number)\n";
+	$sql .= "	)\n";
+	$sql .= "	and message_text is not null\n";
+	$sql .= "	order by message_date desc limit 1\n";
+	$sql .= ") as message,\n";
+	$sql .= "(\n";
+	$sql .= "	select message_date from v_messages \n";
+	$sql .= "	where (\n";
+	$sql .= "		(message_direction = 'inbound' and message_from = n.number)\n";
+	$sql .= "		or \n";
+	$sql .= "		(message_direction = 'outbound' and message_to = n.number)\n";
+	$sql .= "	)\n";
+	$sql .= "	and message_text is not null\n";
+	$sql .= "	order by message_date desc limit 1\n";
+	$sql .= ") as date\n";
+	$sql .= "from (\n";
+	$sql .= "	select number from \n";
+	$sql .= "	(\n";
+	$sql .= "		select distinct(message_from) as number from v_messages \n";
+	$sql .= "		where domain_uuid = :domain_uuid \n";
+	$sql .= "		and message_direction = 'inbound' and message_from is not null \n";
+	//$sql .= "		and user_uuid = :user_uuid \n";
+	$sql .= "		and ( \n";
+	$sql .= "			user_uuid = :user_uuid \n";
+	$sql .= "			or \n";
+	$sql .= "			group_uuid in (".$group_uuids_in.") \n";
+	$sql .= "		)\n";
+	$sql .= "		and message_from ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
+	$sql .= "		union \n";
+	$sql .= "		select distinct(message_to) as number from v_messages \n";
+	$sql .= "		where domain_uuid = :domain_uuid \n";
+	$sql .= "		and message_direction = 'outbound' and message_from is not null \n";
+	//$sql .= "		and user_uuid = :user_uuid ";
+	$sql .= "		and ( \n";
+	$sql .= "			user_uuid = :user_uuid \n";
+	$sql .= "			or \n";
+	$sql .= "			group_uuid in (".$group_uuids_in.") \n";
+	$sql .= "		)\n";
+	$sql .= "		and message_to ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
+	$sql .= "	) as nested \n";
+	$sql .= "	where number not in \n";
+	$sql .= "	( \n";
+	$sql .= "		select destination_number as number \n";
+	$sql .= "		from v_destinations \n";
+	$sql .= "		where destination_type = 'inbound' \n";
+	$sql .= "		and domain_uuid = :domain_uuid \n";
+	$sql .= "		union \n";
+	$sql .= "		select (concat(destination_prefix, destination_number)) as number \n";
+	$sql .= "		from v_destinations \n";
+	$sql .= "		where destination_type = 'inbound' \n";
+	$sql .= "		and domain_uuid = :domain_uuid \n";
+	$sql .= "	) \n";
+	$sql .= "	order by number asc\n";
+	$sql .= ") as n\n";
+
+	$sql .= "order by \n";
+	$sql .= "case when (number = :number) then 0 end asc,\n";
+	$sql .= "date desc\n";
+
+	$parameters['domain_uuid'] = $domain_uuid;
+	$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
+	$parameters['number'] = $_SESSION['user']['contact_number'];
+//echo "<pre>\n";
+//echo $sql;
+//echo "</pre>\n";
+//view_array($parameters);
+	$database = new database;
+	$contacts = $database->select($sql, $parameters, 'all');
+	//view_array($contacts);
+	unset($sql, $parameters);
+
+//show the content
+	echo "<!DOCTYPE html>\n";
+	echo "<html>\n";
+	echo "<head>\n";
+
+//include main css
+	//echo "<link rel='stylesheet' type='text/css' href='/themes/default/css.php'>\n";
+
+//js to load messages for clicked number
+	echo "<script>\n";
+
+	//scroll to the bottom
+	echo "	function scroll_to_bottom(id) {\n";
+	echo "		parent.document.getElementById(id).contentWindow.scrollTo(0, 999999);\n";
+	echo "	}\n";
+	echo "\n";
+
+	//update the url
+	echo "	function update_url(id, url) {\n";
+	//echo "			alert(id);\n";
+	//echo "		alert('from: '+parent.document.getElementById('message_from').value);\n";
+	//echo "		alert('to: '+parent.document.getElementById('message_to').value);\n";
+	//echo "		alert('to: '+parent.document.getElementById('message_text').value);\n";
+	echo "		parent.document.getElementById(id).src = url;\n";
+	echo "		parent.document.getElementById(id).onload = function() {\n";
+	echo "			scroll_to_bottom(id);\n";
+	echo "			parent.document.getElementById(id).contentWindow.scrollTo(0, 999999);\n";
+	echo "		}\n";
+	//echo "		scroll_to_bottom(id);\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+//styles
+	echo "<style>\n";
+	echo "\n";
+
+	echo "	#message_new_layer {\n";
+	echo "		z-index: 999999;\n";
+	echo "		position: absolute;\n";
+	echo "		left: 0px;\n";
+	echo "		top: 0px;\n";
+	echo "		right: 0px;\n";
+	echo "		bottom: 0px;\n";
+	echo "		text-align: center;\n";
+	echo "		vertical-align: middle;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	#message_new_container {\n";
+	echo "		display: block;\n";
+	echo "		background-color: #fff;\n";
+	echo "		padding: 20px 30px;\n";
+	if (http_user_agent('mobile')) {
+		echo "	margin: 0;\n";
+	}
+	else {
+		echo "	margin: auto 30%;\n";
+	}
+	echo "		text-align: left;\n";
+	echo "		-webkit-box-shadow: 0px 1px 20px #888;\n";
+	echo "		-moz-box-shadow: 0px 1px 20px #888;\n";
+	echo "		box-shadow: 0px 1px 20px #888;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	#message_media_layer {\n";
+	echo "		z-index: 999999;\n";
+	echo "		position: absolute;\n";
+	echo "		left: 0px;\n";
+	echo "		top: 0px;\n";
+	echo "		right: 0px;\n";
+	echo "		bottom: 0px;\n";
+	echo "		text-align: center;\n";
+	echo "		vertical-align: middle;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	td.contact_selected {\n";
+	echo "		border-right: 5px solid ".($_SESSION['theme']['table_row_border_color']['text'] != '' ? $_SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	.contact_list_image {\n";
+	echo "		float: left;\n";
+	echo "		width: 75px;\n";
+	echo "		height: 75px;\n";
+	echo "		margin: 3px 8px 3px 2px;\n";
+	echo "		border: 1px solid ".($_SESSION['theme']['table_row_border_color']['text'] != '' ? $_SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
+	echo "		background-repeat: no-repeat;\n";
+	echo "		background-size: cover;\n";
+	echo "		background-position: center center;\n";
+	echo "		border-radius: 11px;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	.row_style0 {\n";
+	echo "		border-bottom: 1px solid ".$_SESSION['theme']['table_row_border_color']['text'].";\n";
+	echo "		background: ".$_SESSION['theme']['form_table_label_background_color']['text'].";\n";
+	echo "		color: ".$_SESSION['theme']['body_text_color']['text'].";\n";
+	echo "		font-family: ".$_SESSION['theme']['body_text_font']['text'].";\n";
+	echo "		font-size: 12px;\n";
+	echo "		text-align: left;\n";
+	echo "		padding: 4px 7px;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	.row_style1 {\n";
+	echo "		border-bottom: 1px solid ".$_SESSION['theme']['table_row_border_color']['text'].";\n";
+	echo "		/*background: #fff;*/\n";
+	echo "		color: ".$_SESSION['theme']['body_text_color']['text'].";\n";
+	echo "		font-family: ".$_SESSION['theme']['body_text_font']['text'].";\n";
+	echo "		font-size: 12px;\n";
+	echo "		text-align: left;\n";
+	echo "		padding: 4px 7px;\n";
+	echo "		}\n";
+	echo "\n";
+
+	echo "	@media (max-width: 121px) {\n";
+	echo "		.contact_message { display: none; }\n";
+	echo "		.contact_image { float: none; margin-left: 20.5%; }\n";
+	echo "		.row_style0, .row_style1 { padding-bottom: 0px; text-align: center; }\n";
+	echo "		}\n";
+
+	echo "</style>\n";
+
+//end the header and start the body
+	echo "</head>\n";
+	echo "<body onload=''>\n";
+
+//contacts list
+	if (is_array($contacts) && @sizeof($contacts) != 0) {
+		echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+		foreach($contacts as $row) {
+			$number = $row['number'];
+			$name = $row['name'];
+			$count = $row['count'];
+			$message = $row['message'];
+			$date = $row['date'];
+			// $row['contact_image_content'];
+			// $row['contact_image_filename'];
+			// $row['contact_uuid'];
+
+			//get the image file extension
+			if (strlen($row['contact_image_filename']) > 0) {
+				$contact_image_extension = pathinfo($row['contact_image_filename'], PATHINFO_EXTENSION);
+			}
+
+			//set the count label
+			if ($count == 0) {
+				$count = '';
+			}
+			else {
+				$count = ' ('.$count.')';
+			}
+
+			//$contact_name = format_phone($row['number']);
+			$contact_name = $row['number'];
+			if (strlen($row['name']) > 0) {
+				$contact_name = escape($row['name']);
+			}
+			if ($_SESSION['user']['contact_number'] != '' && $_SESSION['user']['contact_number'] == $number) {
+				echo "<tr onclick=\"parent.document.getElementById('message_to').value=".escape($number)."; parent.document.getElementById('contacts_frame').src='/app/messages/messages_contacts.php?number=".urlencode($number)."'; update_url('messages_frame', '/app/messages/messages_thread.php?number=".urlencode($number)."');\"><td valign='top' class='row_style0 contact_selected' style='cursor: default;'>\n";
+				$selected = true;
+			}
+			else {
+				echo "<tr onclick=\"parent.document.getElementById('message_to').value=".escape($number)."; parent.document.getElementById('contacts_frame').src='/app/messages/messages_contacts.php?number=".urlencode($number)."'; update_url('messages_frame', '/app/messages/messages_thread.php?number=".urlencode($number)."');\"><td valign='top' class='row_style1'>\n"; // onclick=\"load_thread('".urlencode($number)."', '".$contact[$number]['contact_uuid']."');\"
+				$selected = false;
+			}
+
+			if (strlen($row['contact_image_filename']) > 0) {
+				//echo "<img id='src_message-bubble-image-em_".$row['contact_uuid']."' style='display: none;' src='data:image/".$contact_image_extension.";base64,".$row['contact_image_content']."'>\n";
+				echo "<div class='contact_image' style='width: 50px; height: 50px; float: left; padding-right: 3px;'>\n";
+				echo "	<img id='src_message-bubble-image-em_".$row['contact_uuid']."' src=\"data:image/png;base64,".$row['contact_image_content']."\" style=\"width: 50px;\">\n";
+				echo "</div>\n";
+				//echo "<img id='contact_image_".$row['contact_uuid']."' class='contact_list_image' src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'>\n";
+			}
+			else {
+				if (is_numeric($contact_name)) {
+					//echo "<div style='width: 80px; height: 80px; border: 2px solid #c4cddd; border-radius: 50%; float: left; text-align: center; vertical-align: middle;'><span style='font-size: 150%; font-weight: 600; color: #c4cddd;'>".substr($contact_name, -1)."</span></div><span style='padding-left: 3px;'/>\n";
+					echo "<div class='contact_image' style='width: 50px; height: 50px; float: left; padding-right: 3px;'>\n";
+					echo "	<img src='resources/images/status_logged_out.png' style=\"width: 50px;\"/>\n";
+					echo "</div>\n";
+				}
+				else {
+					//echo "<div style='width: 80px; height: 80px; border: 2px solid #c4cddd; border-radius: 50%; float: left; text-align: center; vertical-align: middle;'><span style='font-size: 150%; font-weight: 600; color: #c4cddd;'>".substr($contact_name, 0, 1)."</span></div><span style='padding-left: 3px;'/>\n";
+					echo "<div class='contact_image' style='width: 50px; height: 50px; float: left; padding-right: 3px;'>\n";
+					echo "	<img src='resources/images/status_available.png' style=\"width: 50px;\"/>\n";
+					echo "</div>\n";
+				}
+			}
+
+			//echo "&nbsp;\n";
+			echo "<span style='padding-left: 3px;'/>\n";
+			echo "	<a href=\"#\" style='text-decoration: none; color: ".$_SESSION['theme']['text_link_color']['text'].";'>\n";
+			echo "		<strong>".escape($contact_name)."</strong>".$count."<br />\n";
+			echo "	</a>\n";
+			echo "	<span class='contact_message' style='padding-left: 5px;'/>\n";
+			echo "		".escape($message)."<br />\n";
+			echo "	</span>\n";
+			echo "</span>\n";
+			//if ($selected) {
+			//	echo "<script>$('#contact_current_name').html(\"<a href='callto:".escape($number)."'>".escape(format_phone($number))."</a>\");</script>\n";
+			//}
+
+			echo "</td></tr>\n";
+		}
+		echo "</table>\n";
+
+		//echo "<script>\n";
+		//foreach ($numbers as $number) {
+		//	if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact[$number]['contact_uuid']]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact[$number]['contact_uuid']]) != 0) {
+		//		echo "$('img#contact_image_".$contact[$number]['contact_uuid']."').css('backgroundImage', 'url(' + $('img#src_message-bubble-image-em_".$contact[$number]['contact_uuid']."').attr('src') + ')');\n";
+		//	}
+		//}
+		//echo "</script>\n";
+	}
+	else {
+		echo "<div style='padding: 15px;'><center>&middot;&middot;&middot;</center>";
+	}
+
+	echo "</body>\n";
+	//echo "<center>\n";
+	//echo "	<span id='contacts_refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick=\"refresh_contacts_stop();\" alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span> ";
+	//echo "</center>\n";
+
+?>

+ 330 - 0
messages_thread.php

@@ -0,0 +1,330 @@
+<?php
+
+//set the include path
+	$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+	set_include_path(parse_ini_file($conf[0])['document.root']);
+
+//includes files
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (!permission_exists('message_view')) {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//santize the contact number, allow the + to support e.164 format
+	if (isset($_GET['number'])) {
+		$number = preg_replace("/[^\+?0-9]/", "", $_GET['number']);
+		$_SESSION['user']['contact_number'] = $number;
+	}
+
+//get the number from the php session
+	if (isset($_SESSION['user']['contact_number'])) {
+		$number = $_SESSION['user']['contact_number'];
+	}
+
+//get the contact uuid
+	$contact_uuid = (is_uuid($_GET['contact_uuid'])) ? $_GET['contact_uuid'] : null;
+
+//get the limit
+	if (isset($_SESSION['message']['limit']['numeric']) && is_numeric($_SESSION['message']['limit']['numeric'])) {
+		$message_limit = $_SESSION['message']['limit']['numeric'];
+	}
+	else {
+		$message_limit = 80;
+	}
+
+//build a list of groups the user is a member of to be used in a SQL in
+	foreach($_SESSION['user']['groups'] as $group) {
+		if (is_uuid($group['group_uuid'])) {
+			$group_uuids[] =  $group['group_uuid'];
+		}
+	}
+	$group_uuids_in = "'".implode("','", $group_uuids)."'";
+
+//get the list of messages
+	$sql = "select ";
+	$sql .= "message_uuid, ";
+	$sql .= "domain_uuid, ";
+	$sql .= "user_uuid, ";
+	$sql .= "contact_uuid, ";
+	$sql .= "message_type, ";
+	$sql .= "message_direction, ";
+	if ($_SESSION['domain']['time_zone']['name'] != '') {
+		$sql .= "message_date at time zone :time_zone as message_date, ";
+	}
+	else {
+		$sql .= "message_date, ";
+	}
+	$sql .= "message_read, ";
+	$sql .= "message_from, ";
+	$sql .= "message_to, ";
+	$sql .= "message_text ";
+	$sql .= "from v_messages ";
+	$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
+	$sql .= "and ( ";
+	$sql .= "	user_uuid = :user_uuid ";
+	$sql .= "	or ";
+	$sql .= "	group_uuid in (".$group_uuids_in.")";
+	$sql .= ")\n";
+	//$sql .= "and message_date > NOW() - INTERVAL '3 days' ";
+	$sql .= "and (message_from = :message_number or message_to = :message_number) ";
+	$sql .= "order by message_date desc ";
+	$sql .= "limit :message_limit ";
+	if ($_SESSION['domain']['time_zone']['name'] != '') {
+		$parameters['time_zone'] = $_SESSION['domain']['time_zone']['name'];
+	}
+	$parameters['user_uuid'] = $_SESSION['user_uuid'];
+	$parameters['domain_uuid'] = $domain_uuid;
+	$parameters['message_number'] = $number;
+	$parameters['message_limit'] = $message_limit;
+	$database = new database;
+	$messages = $database->select($sql, $parameters, 'all');
+	unset($sql, $parameters);
+
+	if (is_array($messages) && @sizeof($messages) != 0) {
+		$messages = array_reverse($messages);
+
+		//get media (if any)
+			$sql = "select ";
+			$sql .= "message_uuid, ";
+			$sql .= "message_media_uuid, ";
+			$sql .= "message_media_type, ";
+			$sql .= "length(decode(message_media_content,'base64')) as message_media_size ";
+			$sql .= "from v_message_media ";
+			$sql .= "where user_uuid = :user_uuid ";
+			$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+			$sql .= "and ( ";
+			foreach ($messages as $index => $message) {
+				$message_uuids[] = "message_uuid = :message_uuid_".$index;
+				$parameters['message_uuid_'.$index] = $message['message_uuid'];
+			}
+			$sql .= implode(' or ', $message_uuids);
+			$sql .= ") ";
+			$sql .= "and message_media_type <> 'txt' ";
+			$parameters['user_uuid'] = $_SESSION['user_uuid'];
+			$parameters['domain_uuid'] = $domain_uuid;
+			$database = new database;
+			$rows = $database->select($sql, $parameters, 'all');
+			unset($sql, $parameters, $index);
+
+		//prep media array
+			if (is_array($rows) && @sizeof($rows) != 0) {
+				foreach ($rows as $index => $row) {
+					$message_media[$row['message_uuid']][$index]['uuid'] = $row['message_media_uuid'];
+					$message_media[$row['message_uuid']][$index]['type'] = $row['message_media_type'];
+					$message_media[$row['message_uuid']][$index]['size'] = $row['message_media_size'];
+				}
+			}
+	}
+
+//flag messages as read
+	$sql = "update v_messages ";
+	$sql .= "set message_read = 'true' ";
+	$sql .= "where user_uuid = :user_uuid ";
+	$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
+	$sql .= "and (message_from like :message_number or message_to like :message_number) ";
+	$parameters['user_uuid'] = $_SESSION['user_uuid'];
+	$parameters['domain_uuid'] = $domain_uuid;
+	$parameters['message_number'] = $number;
+	$database = new database;
+	$database->execute($sql, $parameters);
+	unset($sql, $parameters);
+
+//css styles
+	echo "<style>\n";
+	echo "	.message-bubble {\n";
+	echo "		display: table;\n";
+	echo "		padding: 10px;\n";
+	echo "		border: 1px solid;\n";
+	echo "		margin-bottom: 10px;\n";
+	echo "		}\n";
+//$_SESSION['dashboard']['chart_text_color']['text'];
+	echo "	.message-bubble-em {\n";
+	echo "		margin-right: 30%;\n";
+	echo "		border-radius: 0 20px 20px 20px;\n";
+	echo "		border-color: ".$_SESSION['theme']['message_bubble_em_border_color']['text'].";\n";
+	echo "		background-color: ".$_SESSION['theme']['message_bubble_em_background_color']['text'].";\n";
+	echo "		color: ".$_SESSION['theme']['message_bubble_em_text_color']['text'].";\n";
+	echo "		clear: both;\n";
+	echo "		}\n";
+
+	echo "	.message-bubble-me {\n";
+	echo "		float: right;\n";
+	echo "		margin-left: 30%;\n";
+	echo "		border-radius: 20px 20px 0 20px;\n";
+	echo "		border-color: ".$_SESSION['theme']['message_bubble_me_border_color']['text'].";\n";
+	echo "		background-color: ".$_SESSION['theme']['message_bubble_me_background_color']['text'].";\n";
+	echo "		color: ".$_SESSION['theme']['message_bubble_me_text_color']['text'].";\n";
+	echo "		clear: both;\n";
+	echo "		}\n";
+
+	echo "	img.message-bubble-image-em {\n";
+	echo "		width: 100px;\n";
+	echo "		height: auto;\n";
+	echo "		border-radius: 0 11px 11px 11px;\n";
+	echo "		border: 1px solid #cffec7;\n";
+	echo "		}\n";
+
+	echo "	img.message-bubble-image-me {\n";
+	echo "		width: 100px;\n";
+	echo "		height: auto;\n";
+	echo "		border-radius: 11px 11px 0 11px;\n";
+	echo "		border: 1px solid #cbf0ff;\n";
+	echo "		}\n";
+
+	echo "	div.message-bubble-image-em {\n";
+	echo "		float: left;\n";
+	echo "		margin-right: 15px;\n";
+	echo "		text-align: left;\n";
+	echo "		}\n";
+
+	echo "	div.message-bubble-image-me {\n";
+	echo "		float: right;\n";
+	echo "		margin-left: 15px;\n";
+	echo "		text-align: right;\n";
+	echo "		}\n";
+
+	echo "	.message-text {\n";
+	echo "		padding-bottom: 5px;\n";
+	echo "		font-size: 90%;\n";
+	echo "		}\n";
+
+	echo "	.message-bubble-when {\n";
+	echo "		font-size: 71%;\n";
+	echo "		font-style: italic;\n";
+	echo "		}\n";
+
+	echo "	.message-media-link-em {\n";
+	echo "		display: inline-block;\n";
+	echo "		margin: 5px 10px 5px 0;\n";
+	echo "		padding: 8px;\n";
+	echo "		background: #cffec7;\n";
+	echo "		border-radius: 7px;\n";
+	echo "		text-align: center;\n";
+	echo "		}\n";
+
+	echo "	.message-media-link-me {\n";
+	echo "		display: inline-block;\n";
+	echo "		margin: 5px 10px 5px 0;\n";
+	echo "		padding: 8px;\n";
+	echo "		background: #cbf0ff;\n";
+	echo "		border-radius: 7px;\n";
+	echo "		text-align: center;\n";
+	echo "		}\n";
+
+	echo "</style>\n";
+
+	//display media
+	echo "<script language='JavaScript' type='text/javascript'>\n";
+	echo "	function display_media(id, src) {\n";
+	echo "		$('#message_media_layer').load('message_media.php?id=' + id + '&src=' + src + '&action=display', function(){\n";
+	echo "			$('#message_media_layer').fadeIn(200);\n";
+	echo "		});\n";
+	echo "	}\n";
+	echo "</script>\n";
+
+	//message media layer
+	echo "<div id='message_media_layer' style='display: none;'></div>\n";
+
+	if (!$refresh) {
+		echo "<div id='thread_messages' style='min-height: 300px; overflow: auto; padding-right: 15px;'>\n";
+	}
+
+	//output messages
+		if (is_array($messages) && @sizeof($messages) != 0) {
+			foreach ($messages as $message) {
+				//parse from message
+					if ($message['message_direction'] == 'inbound') {
+						$message_from = $message['message_to'];
+						$media_source = format_phone($message['message_from']);
+					}
+					if ($message['message_direction'] == 'outbound') {
+						$message_from = $message['message_from'];
+						$media_source = format_phone($message['message_to']);
+					}
+
+				//message bubble
+					echo "<span class='message-bubble message-bubble-".($message['message_direction'] == 'inbound' ? 'em' : 'me')."'>";
+						//contact image em
+							if ($message['message_direction'] == 'inbound') {
+								if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) {
+									echo "<div class='message-bubble-image-em'>\n";
+									echo "	<img class='message-bubble-image-em'><br />\n";
+									echo "</div>\n";
+								}
+							}
+						//contact image me
+							else {
+								if (is_array($_SESSION['tmp']['messages']['contact_me']) && @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
+									echo "<div class='message-bubble-image-me'>\n";
+									echo "	<img class='message-bubble-image-me'><br />\n";
+									echo "</div>\n";
+								}
+							}
+						echo "<div style='display: table;'>\n";
+						//message
+							if ($message['message_text'] != '') {
+								$allowed = ['http', 'https'];
+								$scheme = parse_url($message['message_text'], PHP_URL_SCHEME);
+								if ($scheme === false) {
+									// seriously malformed URL
+									$is_url = false;
+								}
+								else if (!in_array($scheme, $allowed, true)) {
+									// protocol not allowed, don't display the link!
+									$is_url = false;
+								}
+								else {
+									// everything OK
+									$is_url = true;
+								}
+								if ($is_url) {
+									echo "<div class='message-text'><a href='".$message['message_text']."' target='_blank'>".escape($message['message_text'])."</a></div>\n";
+								}
+								else {
+									echo "<div class='message-text'>".str_replace("\n",'<br />',escape($message['message_text']))."</div>\n";
+								}
+							}
+						//attachments
+							if (is_array($message_media[$message['message_uuid']]) && @sizeof($message_media[$message['message_uuid']]) != 0) {
+								foreach ($message_media[$message['message_uuid']] as $media) {
+									if ($media['type'] != 'txt') {
+										if ($media['type'] == 'jpg' || $media['type'] == 'jpeg' || $media['type'] == 'gif' || $media['type'] == 'png') {
+											echo "<a href='message_media.php?id=".$media['uuid']."&src=".$media_source."&action=download' class='message-media-link-".($message['message_direction'] == 'inbound' ? 'em' : 'me')."'>";
+										}
+										echo "<img src='message_media.php?id=".$media['uuid']."&src=".$media_source."&action=thumbnail&width=200' style='border: none; margin-right: 10px;'><br />\n";
+										//echo "<img src='resources/images/attachment.png' style='width: 16px; height: 16px; border: none; margin-right: 10px;'>";
+										echo "<span style='font-size: 85%; white-space: nowrap;'>".strtoupper($media['type']).' &middot; '.strtoupper(byte_convert($media['size']))."</span>";
+										echo "</a>\n";
+									}
+								}
+								echo "<br />\n";
+							}
+						//message when
+							echo "<span class='message-bubble-when'>".(date('m-d-Y') != format_when_local($message['message_date'],'d') ? format_when_local($message['message_date']) : format_when_local($message['message_date'],'t'))."</span>\n";
+						echo "</div>\n";
+					echo "</span>\n";
+			}
+			echo "<span id='thread_bottom'></span>\n";
+		}
+
+		echo "<script>\n";
+		//set current contact
+		//	echo "	$('#contact_current_number').val('".$number."');\n";
+		//set bubble contact images from src images
+		//	echo "	$('img.message-bubble-image-em').attr('src', $('img#src_message-bubble-image-em_".$contact_uuid."').attr('src'));\n";
+		//	echo "	$('img.message-bubble-image-me').attr('src', $('img#src_message-bubble-image-me').attr('src'));\n";
+		echo "</script>\n";
+
+	if (!$refresh) {
+		echo "</div>\n";
+	}
+
+?>

BIN
resources/audio/sounds-1143-clearly.mp3


+ 295 - 0
resources/classes/messages.php

@@ -0,0 +1,295 @@
+<?php
+
+//define the messages classs
+if (!class_exists('messages')) {
+	class messages {
+
+		/**
+		 * declare private variables
+		 */
+		private $app_name;
+		private $app_uuid;
+		private $permission_prefix;
+		private $list_page;
+		private $table;
+		private $uuid_prefix;
+
+		/**
+		 * called when the object is created
+		 */
+		public function __construct() {
+
+			//assign private variables
+				$this->app_name = 'messages';
+				$this->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+				$this->permission_prefix = 'message_';
+				$this->list_page = 'messages_log.php';
+				$this->table = 'messages';
+				$this->uuid_prefix = 'message_';
+
+		}
+
+		/**
+		 * called when there are no references to a particular object
+		 * unset the variables used in the class
+		 */
+		public function __destruct() {
+			foreach ($this as $key => $value) {
+				unset($this->$key);
+			}
+		}
+
+		/**
+		 * delete records
+		 */
+		public function delete($records) {
+			if (permission_exists($this->permission_prefix.'delete')) {
+
+				//add multi-lingual support
+					$language = new text;
+					$text = $language->get();
+
+				//validate the token
+					$token = new token;
+					if (!$token->validate($_SERVER['PHP_SELF'])) {
+						message::add($text['message-invalid_token'],'negative');
+						header('Location: '.$this->list_page);
+						exit;
+					}
+
+				//delete multiple records
+					if (is_array($records) && @sizeof($records) != 0) {
+
+						//build the delete array
+							foreach ($records as $x => $record) {
+								if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
+									$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
+									$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
+									$array['message_media'][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
+									$array['message_media'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
+								}
+							}
+
+						//delete the checked rows
+							if (is_array($array) && @sizeof($array) != 0) {
+
+								//grant temporary permissions
+									$p = new permissions;
+									$p->add('message_media_delete', 'temp');
+
+								//execute delete
+									$database = new database;
+									$database->app_name = $this->app_name;
+									$database->app_uuid = $this->app_uuid;
+									$database->delete($array);
+									unset($array);
+
+								//revoke temporary permissions
+									$p->delete('message_media_delete', 'temp');
+
+								//set message
+									message::add($text['message-delete']);
+							}
+							unset($records);
+					}
+			}
+		} //method
+
+		/**
+		 * send a message
+		 */
+		public function send($message_type, $message_from, $message_to, $message_text, $message_media = '') {
+
+			//santize the data
+				$message_type = 'sms';
+				$message_from = preg_replace("/[^\+?0-9]/", "", $message_from);
+				$message_to = preg_replace('/[^\+?0-9]/', '', $message_to);
+
+			//error check
+				if (!is_numeric($message_from) || !is_numeric($message_to)) {
+					exit;
+				}
+
+			//handle media (if any)
+				if (is_array($message_media) && @sizeof($message_media) != 0) {
+					// reorganize media array, ignore errored files
+					$f = 0;
+					foreach ($message_media['error'] as $index => $error) {
+						if ($error == 0) {
+							$tmp_media[$f]['uuid'] = uuid();
+							$tmp_media[$f]['name'] = $message_media['name'][$index];
+							$tmp_media[$f]['type'] = $message_media['type'][$index];
+							$tmp_media[$f]['tmp_name'] = $message_media['tmp_name'][$index];
+							$tmp_media[$f]['size'] = $message_media['size'][$index];
+							$f++;
+						}
+					}
+					$message_media = $tmp_media;
+					unset($tmp_media, $f);
+				}
+				$message_type = is_array($message_media) && @sizeof($message_media) != 0 ? 'mms' : 'sms';
+
+			//get the contact uuid
+				//$sql = "select c.contact_uuid ";
+				//$sql .= "from v_contacts as c, v_contact_phones as p ";
+				//$sql .= "where p.contact_uuid = c.contact_uuid ";
+				//$sql .= "and p.phone_number like :phone_number ";
+				//$sql .= "and c.domain_uuid = :domain_uuid ";
+				//$parameters['phone_number'] = '%'.$message_to.'%';
+				//$parameters['domain_uuid'] = $domain_uuid;
+				//$database = new database;
+				//$contact_uuid = $database->select($sql, $parameters, 'column');
+				//unset($sql, $parameters);
+
+			//prepare message to send
+				$message['to'] = $message_to;
+				$message['text'] = $message_text;
+				//if (is_array($message_media) && @sizeof($message_media) != 0) {
+				//	$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
+				//	foreach ($message_media as $index => $media) {
+				//		$path = $protocol.$_SERVER['HTTP_HOST'].'/app/messages/message_media.php?id='.$media['uuid'].'&action=download&.'.strtolower(pathinfo($media['name'], PATHINFO_EXTENSION));
+				//		$message['media'][] = $path;
+				//	}
+				//}
+				$http_content = json_encode($message);
+
+			//use the phone number to get the destination details
+				$sql = "SELECT * FROM v_destinations ";
+				$sql .= "WHERE ( ";
+				$sql .= "	destination_prefix || destination_area_code || destination_number = :destination_number ";
+				$sql .= "	OR destination_trunk_prefix || destination_area_code || destination_number = :destination_number ";
+				$sql .= "	OR destination_prefix || destination_number = :destination_number ";
+				$sql .= "	OR '+' || destination_prefix || destination_number = :destination_number ";
+				$sql .= "	OR '+' || destination_prefix || destination_area_code || destination_number = :destination_number ";
+				$sql .= "	OR destination_area_code || destination_number = :destination_number ";
+				$sql .= "	OR destination_number = :destination_number ";
+				$sql .= ") ";
+				$sql .= "and provider_uuid is not null ";
+				$sql .= "and destination_enabled = 'true'; ";
+				$parameters['destination_number'] = $message_from;
+				if ($debug) {
+					file_put_contents($log_file, "sql: ".$sql."\n", FILE_APPEND);
+					//echo $sql."\n";
+					file_put_contents($log_file, print_r($parameters, true)."\n", FILE_APPEND);
+				}
+				$database = new database;
+				$row = $database->select($sql, $parameters, 'row');
+				//view_array($row, false);
+				if (isset($row)) {
+					$domain_uuid = $row['domain_uuid'];
+					$provider_uuid = $row['provider_uuid'];
+					$user_uuid = $row['user_uuid'];
+					unset($row);
+				}
+				//if ($debug) {
+					view_array($row,false);
+					//file_put_contents($log_file, print_r($row, true)."\n", FILE_APPEND);
+				//}
+				unset($sql, $parameters);
+
+			//debug
+				//echo "provider_uuid: ".$provider_uuid."\n";
+
+			//get the provider settings
+				$sql = "select provider_setting_category, provider_setting_subcategory, ";
+				$sql .= "provider_setting_name, provider_setting_value, provider_setting_order \n";
+				$sql .= "from v_provider_settings \n";
+				$sql .= "where provider_uuid = :provider_uuid \n";
+				$sql .= "and provider_setting_category = 'outbound' \n";
+				$sql .= "and provider_setting_enabled = 'true'; \n";
+				$parameters['provider_uuid'] = $provider_uuid;
+				$database = new database;
+				$provider_settings = $database->select($sql, $parameters, 'all');
+				unset($parameters);
+				//echo $sql;
+				//print_r($parameters);
+				//print_r($provider_settings);
+				//
+				//echo "\n";
+
+			//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);
+						}
+					}
+				}
+
+			//continue only if message from and to have a value
+				if (!isset($message_from) || !isset($message_to)) {
+					return false;
+				}
+
+			//add the permission
+				$p = new permissions;
+				$p->add('message_queue_add', 'temp');
+
+			//build the message array
+				$message_queue_uuid = uuid();
+				$array['message_queue'][0]['domain_uuid'] = $_SESSION["domain_uuid"];
+				$array['message_queue'][0]['message_queue_uuid'] = $message_queue_uuid;
+				$array['message_queue'][0]['user_uuid'] = $_SESSION["user_uuid"];
+				//$array['message_queue'][0]['contact_uuid'] = $contact_uuid;
+				$array['message_queue'][0]['provider_uuid'] = $provider_uuid;
+				$array['message_queue'][0]['hostname'] = system('hostname');
+				$array['message_queue'][0]['message_status'] = 'waiting';
+				$array['message_queue'][0]['message_type'] = $message_type;
+				$array['message_queue'][0]['message_direction'] = 'outbound';
+				$array['message_queue'][0]['message_date'] = 'now()';
+				$array['message_queue'][0]['message_from'] = $message_from;
+				$array['message_queue'][0]['message_to'] = $message_to;
+				$array['message_queue'][0]['message_text'] = $message_text;
+				//view_array($array);
+
+			//build message media array (if necessary)
+				$media_exists = false;
+				if (is_array($message_media) && @sizeof($message_media) != 0) {
+					$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
+					foreach($message_media as $index => $media) {
+						//create the media path
+						$media_url = $protocol.$_SERVER['HTTP_HOST'].'/app/messages/media/'.$media['uuid'].'/'.$media['name'];
+
+						//add the media to the array
+						$array['message_media'][$index]['message_media_uuid'] = $media['uuid'];
+						$array['message_media'][$index]['message_uuid'] = $message_queue_uuid;
+						$array['message_media'][$index]['domain_uuid'] = $_SESSION["domain_uuid"];
+						$array['message_media'][$index]['user_uuid'] = $_SESSION["user_uuid"];
+						$array['message_media'][$index]['message_media_name'] = $media['name'];
+						$array['message_media'][$index]['message_media_type'] = strtolower(pathinfo($media['name'], PATHINFO_EXTENSION));
+						$array['message_media'][$index]['message_media_date'] = 'now()';
+						$array['message_media'][$index]['message_media_url'] = $media_url;
+						$array['message_media'][$index]['message_media_content'] = base64_encode(file_get_contents($media['tmp_name']));
+					}
+					$p->add('message_media_add', 'temp');
+					$media_exists = true;
+				}
+
+			//no message or media to send - do not send
+				//if ($message_text == '' && !$media_exists) {
+				//	return;
+				//}
+
+			//save to the data
+				$database = new database;
+				$database->app_name = 'messages';
+				$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+				$database->save($array, false);
+				//$message = $database->message;
+				//view_array($message, true);
+				unset($array);
+
+			//remove the permission
+				$p->delete('message_queue_add', 'temp');
+				$p->delete('message_media_add', 'temp');
+
+		} //method
+		
+	} //class
+}
+
+?>

BIN
resources/images/attachment.png


BIN
resources/images/refresh_active.gif


BIN
resources/images/refresh_paused.png


BIN
resources/images/status_available.png


BIN
resources/images/status_available_on_demand.png


BIN
resources/images/status_do_not_disturb.png


BIN
resources/images/status_logged_out.png


BIN
resources/images/status_on_break.png


+ 3165 - 0
resources/providers/settings.php

@@ -0,0 +1,3165 @@
+<?php
+
+//Add a Provider
+	$provider_uuid = uuid();
+
+	$x = 0;
+	$array['providers'][$x]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_name'] = 'Add a Provider';
+	$array['providers'][$x]['provider_region'] = 'Anywhere';
+	$array['providers'][$x]['provider_website'] = '';
+	$array['providers'][$x]['provider_signup'] = '';
+	$array['providers'][$x]['provider_prices'] = '';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'Use this as a template for adding provider settings.';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_media_name';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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_array';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e3c03e51-e913-44fd-97cb-4e3add950901';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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_other';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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_other';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'adfecd2f-bd0a-43fb-a388-7801586cf1c0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0dc3b46-a716-4c5b-a926-421a36bdb873';
+	$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,mms';
+	//$y++;
+	//$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	//$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_type';
+	//$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'] = 'false';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	//$y++;
+	//$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	//$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_accept';
+	//$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'] = 'false';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = $provider_uuid;
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = uuid();
+	$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'] = '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'] = '';
+	unset($provider_uuid);
+
+//bandwidth.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_name'] = 'bandwidth.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://bandwidth.com/';
+	$array['providers'][$x]['provider_signup'] = 'https://www.bandwidth.com/free-trial/';
+	$array['providers'][$x]['provider_prices'] = 'https://www.bandwidth.com/pricing/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'The universal platform for global enterprise communications';
+
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7077f125-f746-40c4-816b-5e21f77f172d';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'fe71e768-c1f0-4f70-8c56-ab62d3518a5b';
+	$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'] = '0.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'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b7ab2af4-d7ce-46d8-a097-e20a8c79ec77';
+	$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'] = '0.message.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4a3223b8-ca74-43d0-8c8c-df5f27f215ef';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '0.message.media.1';
+	$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'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '565c20b0-a135-4320-8b60-9c69e6302984';
+	$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_name';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '730ba179-b154-400e-82d2-3928b816ff29';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9166e952-3af5-4ab4-8875-903a16d09ebc';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'dd88e425-3a91-4b44-83e4-f7425556c81f';
+	$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'] = 'array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'message_to';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = '0.message.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e3c03e51-e913-44fd-97cb-4e3add950901';
+	$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'] = '+1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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'] = '+1xxxxxxxxxx';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd77e199e-e537-4dcd-a798-3c1808a3e9dc';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd2aed3cb-ae74-4664-bc7d-ced81a65eb58';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ca2123f1-9c77-4ac0-a93d-9244b836580d';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'bbc0879d-5ef7-4d5e-abb6-01eb56740252';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '84952608-c1a8-4f8b-a34d-e4098e55a95e';
+	$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'] = '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'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '918eb175-025c-4058-a296-e23c5672bb86';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c010b1fc-c1a0-4962-981e-1a41475a1747';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'media';
+	$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'] = 'NEW - not in generic';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '39cc80f2-d0a8-462a-b836-d0ac5d2574a9';
+	$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_other';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'bbfe3655-263f-40b0-9116-a58a11c6ed93';
+	$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'] = 'media';
+	$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'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '868ae7a6-4e66-498c-a778-f09a525e240f';
+	$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_other';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'applicationId={$your_application_id}';
+	$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'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8e6415f1-03b6-4c67-b718-998cc0a36498';
+	$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_other';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'priority=default';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '45ca9656-9e61-4b0b-84cc-cd1677581ac6';
+	$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'] = 'array';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '303748a3-2570-4024-a23d-b29ee50661fc';
+	$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://messaging.bandwidth.com/api/v2/users/{$user_id}/messages';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'eaac7227-8f22-43e6-8d94-29ab73280f50';
+	$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'] = '+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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'adfecd2f-bd0a-43fb-a388-7801586cf1c0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '11286fc7-0130-446b-a362-66648151616a';
+	$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'] = '+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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0dc3b46-a716-4c5b-a926-421a36bdb873';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e93a0eb9-6066-4de7-b00f-3574f2372616';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'df10b551-9e71-4fa0-a3bc-9221aeb85db2';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '19619d8a-808c-469c-be6d-2c341bccb871';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.82.123.96/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = 'new';
+	$y++;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'aec85b98-4b19-46d1-b1fe-acefca616932';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '18.233.250.246/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = 'new';
+	$y++;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '590e627a-43d8-48a3-8a06-874cf78b5c45';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'c46e2852-c2cf-4cb0-b4f5-1d8e458a7984';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.72.24.132/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//flowroute.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_name'] = 'flowroute.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://www.flowroute.com';
+	$array['providers'][$x]['provider_signup'] = 'https://manage.flowroute.com/signup';
+	$array['providers'][$x]['provider_prices'] = 'https://www.flowroute.com/pricing-details/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'SIP Trunking, VoIP and messaging.';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'bdbb84ac-cc97-4bc5-9a20-9033022d7ed1';
+	$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'] = 'attributes.url';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a280cab4-daf7-44ef-b6b4-0593d4c0da09';
+	$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'] = 'attributes.mime_type';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '62bc8087-6f63-4683-b9f6-e9c8c727c8e9';
+	$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_name';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'attributes.file_name';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f5a8573c-b0fc-4310-87cf-99e13e4e2dcd';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'included';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7d3a6c3b-18fc-4650-95a4-d7aaa4c14300';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '6b1f7e3e-2398-4513-8f41-665b14989d32';
+	$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'] = 'data.attributes.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'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '11451327-9df9-4569-a3ec-c29539ac01e7';
+	$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'] = 'data.attributes.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f2bc3eb9-7a86-4b00-a27a-490eb79d5efb';
+	$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'] = 'data.attributes.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '5f11cdac-410b-4a51-b2cd-9cb7a2b1665b';
+	$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'] = 'xxxxxxxxxxxx';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e23aa232-de3c-448b-ae79-1d30bdba7199';
+	$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'] = 'xxxxxxxxxxxx';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd0907cda-4b40-42d2-914b-b81f35c47ff1';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b2d8035d-4b49-4127-af3b-188384c849f6';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0bc12f7-8e8d-4ea1-b2e5-9dfd3a13a221';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '93e082a9-7fb1-484e-8222-234ef238acce';
+	$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_other';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'data.type=message';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8475963f-b3eb-49e4-8d6e-d67501f5bb38';
+	$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_other';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'data.attributes.is_mms=true';
+	$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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a3e4cc88-0a44-4639-96f5-5b9a90183a84';
+	$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'] = 'data.attributes.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'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '732f50a7-2bb6-4159-98f1-568046834682';
+	$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'] = 'data.attributes.media_urls';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e4c1b560-3523-4112-b02c-525f19ae6b5f';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '75898ae4-6a3c-4eef-880c-3808af1e359c';
+	$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'] = 'data.attributes.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '953430ab-8656-4b2c-a527-4bb43a8beddf';
+	$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'] = 'data.attributes.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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '034d3c83-3daa-47c8-aa27-58f2cecb459d';
+	$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://api.flowroute.com/v2.1/messages';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'dc262e4f-f78c-4c3f-a4c4-526b8b1ec0ab';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '45930e12-2204-4977-b8f0-5c9dd2489437';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'dffe8036-9efc-4dbc-9d58-a7f53e84fea7';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/vnd.api+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'] = '';
+	$y++;
+	//$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	//$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b15507fa-1508-417e-8c9a-c880dfa2e7df';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_type';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/vnd.api+json';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	//$y++;
+	//$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	//$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f8e67c4d-5403-4f96-ad12-7cff2d8404b4';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_accept';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/vnd.api+json';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	//$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	//$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '536690cd-740f-4863-9ac5-d75a88356577';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'b565d0f7-7277-484e-a294-e4024db0e13b';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.10.220.50/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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'c5f5ff8f-4d76-4eae-9e42-d4fdf9c64fd5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.43.82.110/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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'fbf231ad-5138-492a-ba73-72fff3e3b77f';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.88.246.140/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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '848a8065-2947-486f-b66b-095e2acd3189';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.190.46.191/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'] = '6945c192-c7de-48e3-baf3-440fa80c4d6c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '1ccf2cb3-6ae5-4f40-94ed-4a2a6ba74cad';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '96.18.175.136/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//twilio.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_name'] = 'twilio.com';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '65b9703a-41a9-4820-bef8-25999071f7df';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '09007582-c573-4c83-ad4d-ff10a4263e8a';
+	$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'] = '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'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '61210866-3f03-4853-9a94-bf1efa5b36ff';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9927c371-56cb-4e93-9bb4-3ef086822318';
+	$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_array';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '84692ae7-52b1-423e-a9fe-c7c09847a63d';
+	$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_name';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '17f6972c-8988-4408-8ddd-72fe3d7fa7ca';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4827aa75-84c1-4300-bc09-96ce4650cc71';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '96ac7ccc-9dd7-4370-8ea1-d9a4c396f04c';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e3c03e51-e913-44fd-97cb-4e3add950901';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3efda7fd-703b-43f3-bf0b-66a1a6872911';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '1879b1a2-2e04-4a30-bc7b-0005dd7aa99e';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '191f0e29-9628-4eed-a0af-05f1a3d2f629';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4cf70928-9e1b-493b-93e9-8de4a0926fb0';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd5ac18a8-60c2-4056-b325-01dfa62f64fe';
+	$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'] = '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'] = 'sms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a8167c61-a99a-4535-a9b8-80027a734abb';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f8fd238c-1442-4ae2-9bdf-9597a63fe200';
+	$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_other';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'dfde8f6b-d3d3-4d34-b775-59b51563aaf7';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4f6b4e66-5516-4034-9f5a-da9bb063ad24';
+	$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_other';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '0c7e15ff-122e-46eb-b5ff-3ce98a96a0ce';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a6f21c45-9208-4896-9521-6c670124a662';
+	$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://api.twilio.com/2010-04-01/Accounts/${account_sid}/Messages';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'adfecd2f-bd0a-43fb-a388-7801586cf1c0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b1f973c8-d66f-4c40-95eb-ea80872d09ff';
+	$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'] = '+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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0dc3b46-a716-4c5b-a926-421a36bdb873';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '233b63c5-f1e2-4f53-90fa-54184ebd902e';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '53ba4b16-4c03-48c7-ab2b-e269533e62b8';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '688f7a83-3cc9-4891-9193-26cfec2cc287';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.80.175.229/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '5baa2947-fffa-432c-9a15-c44acdccf7cb';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.80.191.179/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0139bf6f-6943-4eb4-b505-13d54dc003f8';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.81.47.122/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '6ec32337-4eb6-4139-8027-37cb91091a41';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.86.33.76/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'e14b0573-ae43-4c12-b503-6673855a98dc';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.86.111.166/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0e454a87-27a4-44cf-a4fc-8fb9018c4e06';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.87.52.192/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '6cdbe2fb-fbb0-4323-a95c-0484f4427ee7';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.90.46.123/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '284258ac-09f1-4827-a6c8-c3dbf52cb0ac';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.92.245.167/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '357119a3-ceaa-44fa-8ca6-797dc070ae08';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '3.94.190.54/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'b25b548d-9f79-4fce-8cad-da5a1975f149';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '18.208.223.25/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '2bd9daff-a10f-4497-ba85-dd2f92796dcf';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '18.232.129.134/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'c5a990a0-3a32-4b94-80d9-5d288c0cf3b2';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.204.1.118/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'f3a47c23-a854-4f42-8acb-3e6f51cad9b3';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.207.166.44/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'e756f78a-5968-4852-a00e-34e60519bc85';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.227.242.3/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '08aaa0bf-86b8-4c43-a47e-4862b7725435';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.229.251.36/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '638220fc-4463-4c4f-beb7-5e5878daadb3';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.230.2.68/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '93a46e46-f143-4524-b3fc-0dc2ed2132f9';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '34.239.245.250/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '05990be0-c6ac-48c8-90c2-2c277ee47f21';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '35.171.24.202/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '2d89c205-1376-4a41-b6e6-cf64bd1bf146';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.87.186.147/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0b045a01-0319-4a7d-8b57-d9a117dd7d2d';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.90.195.163/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '52a0731e-8387-4cef-8370-02630f9ce953';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.201.235.236/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0f9964a2-1169-4e57-b3bf-ab52ae580d38';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.202.15.53/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '137e261d-469a-4711-9d67-dda47bf58595';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.203.87.216/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '551c0274-4c9d-415a-840c-05cba1a4ab66';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.144.166.54/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '3ef43482-83c5-4d38-9818-11947cb80c64';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.147.202.213/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'e9b9dba2-81f2-495e-b22f-d5c73470f30b';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.159.226.255/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'd2f5efd0-8cea-474b-b563-8c489365bc42';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.163.23.74/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '89f30ac0-febb-463f-a31d-f4c03ab910d5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.166.76.61/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '04479415-ebfa-4dee-8a8d-f3a1c8f6dd44';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.166.85.73/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'e43cc266-76ed-4753-bac0-ce482186758e';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.172.230.57/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '1e4ead1e-64cf-480c-86e5-c6e7f3590455';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.209.248.168/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'cdad3f29-49c1-45fa-b4f9-1a91739389d0';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.210.15.141/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'fa55c75e-38d6-4745-8cce-c52871e598a3';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.210.48.98/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'aa1560fb-7cac-4301-aafc-14e9f6ed1e7f';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.210.132.233/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '7793a55f-e5c2-4af8-b389-4eddeb2781d7';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.221.127.57/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'a458de07-ccd5-4748-b1d1-b6578861ea21';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.227.212.77/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '29ffde72-ed86-4e9e-bb12-774203b93e8e';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.234.191.42/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0de75822-dc33-43e0-b09b-65dac6eff1dd';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '54.242.128.57/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '86ed84cb-f81c-42bd-b37c-01746c25b53f';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '100.24.61.247/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '36daafd4-7450-40bb-819c-331c2db2652c';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '107.21.82.64/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'] = 'e00f5c00-b423-405a-a3a3-edfd0a0a6d32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '538908d1-fe55-45a5-8170-97ded9dbd281';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '107.22.158.32/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//questblue.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_name'] = 'questblue.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://questblue.com/';
+	$array['providers'][$x]['provider_signup'] = 'https://questblue.com/questblue-vouched-id-verification-2/';
+	$array['providers'][$x]['provider_prices'] = 'https://questblue.com/pricing/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'QuestBlue | Fully Automated Communications Platform';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8efe4100-f6c9-48f0-aac7-5e1ce36a3d88';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '696b74e0-1032-4f00-bffd-87b65cefe8ae';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a77858f4-a696-4612-9910-434b703ca690';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7ef2da5c-d9f6-488f-b4e1-7cd415066e5b';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'media';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '1b234293-5d1c-4ead-9551-c17081d695b4';
+	$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_name';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'media';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '90942a18-a18c-44a2-b6cb-8cd6072ae530';
+	$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'] = 'type';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b54fcf4f-3ccd-4e70-ac5e-8e0e91c63cd7';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '67690750-1e8f-47db-bb84-6269d4091fff';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd3cd5036-62b0-4646-9cd3-cc9873c6345e';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '6f7dcab6-0d47-4edc-a6c2-d31dcb24e25f';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9e8adb17-fc06-425b-a0f3-0960f573ff92';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b8ad5c38-a71e-4bb3-8505-b0e05e3446bd';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '65b96e5f-cae4-4a20-9427-f7464bfbec79';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3656ad6c-c2b9-4877-8706-1bfdbc95b9cb';
+	$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'] = 'did';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '5c7ad300-47fc-458a-8020-bcf8df307e54';
+	$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_other';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '1efb52a7-e51c-4127-874e-c1f85096877f';
+	$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'] = 'file_url';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '0cb85009-653c-4521-b695-a5ee86349e76';
+	$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_other';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8c53a541-2d14-43ad-b5a3-dc3a64ead20d';
+	$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'] = 'did_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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b1ae042b-c8fb-4e93-8c1e-3833e772fbcd';
+	$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://api2.questblue.com/smsv2';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '83c6083d-5f55-49b5-844c-15bdaa63255e';
+	$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'] = 'rxxxxxxxxxx';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '19cd177b-438f-42ba-8578-0c6e0cc1a0f8';
+	$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'] = 'rxxxxxxxxxx';
+	$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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cb5f5157-25c7-445c-bd32-492bb1d46db2';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'Security-Key';
+	$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';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c42c425c-c04e-450f-8b2f-5fcec653b837';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '30fa0a92-de90-4e34-bf4f-69981b8857f5';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'b06e65a5-a637-4090-9ad5-057a5ba0e98f';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '128.136.235.72/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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '0638079d-bf82-4961-8f78-359d15230ce3';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '128.136.235.92/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'] = 'ef078c0e-0f4e-4887-acb4-6e4a4012a845';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '9dd8d19b-20c4-4540-90e9-bd66a32b5b1f';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '128.136.235.201/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//telnyx.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_name'] = 'telnyx.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://telnyx.com/';
+	$array['providers'][$x]['provider_signup'] = 'https://telnyx.com/sign-up';
+	$array['providers'][$x]['provider_prices'] = 'https://telnyx.com/pricing/messaging';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'Programmatic Voice and SMS APIs. US Licensed Carrier.';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7696da00-a5cc-4754-8fa0-5f41f90b9121';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f52bb2f7-4f0e-4787-8342-a6cf3316a266';
+	$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'] = 'data.payload.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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '6710fcd3-2521-4540-84b4-b9121c15f759';
+	$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'] = 'data.payload.from.phone_number';
+	$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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c8ef77e6-051b-4547-9e4d-7742dc2a2556';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'data.payload.media';
+	$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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7859492e-0846-471e-bfee-4d191244432e';
+	$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'] = 'content_type';
+	$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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b0f770e0-4adc-47d3-b631-99032dfef3a9';
+	$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'] = 'url';
+	$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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd5b1f222-48ce-4e5f-8b6b-d80d1960137b';
+	$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'] = 'data.payload.to.0.phone_number';
+	$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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cf26722b-7ca4-4676-8563-a921771fb1da';
+	$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';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'data.payload.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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e3c03e51-e913-44fd-97cb-4e3add950901';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8263eb14-2f4e-4bad-8919-58f4acedb4de';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '56aaa2e4-74b3-4521-a5c2-f6878e631827';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3e8a0fed-b106-4d09-ac76-2ca9ea652539';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3a6fca7a-4fdd-44e4-b030-aa5a64d2b4bc';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cec35bc1-e610-4cbc-a905-005baee013c4';
+	$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'] = '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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '411fdf73-a52e-4725-ac7f-26bf4c51d39d';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '393317c2-29f7-45fc-9401-276dc8034926';
+	$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_other';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'subject=Picture';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'deaba3fa-d91e-49e1-b8cf-47e755dda863';
+	$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'] = 'media_urls';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '715a422c-1e96-415e-bf25-65461efaba7d';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2e1ba9ef-49eb-4918-8076-7259d8634a08';
+	$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://api.telnyx.com/v2/messages';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e06d7cca-9fb7-4c60-b192-af2f0078006b';
+	$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'] = '+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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'adfecd2f-bd0a-43fb-a388-7801586cf1c0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0dc3b46-a716-4c5b-a926-421a36bdb873';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '88e9d5ea-5fe9-4391-8319-3206f38978b0';
+	$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'] = '+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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9e79f6cc-ac15-4016-9948-621c2e33fe5e';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'Authorization';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'Bearer zzzzzzzz';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd767cdb2-693e-4139-939f-cba1cad17edf';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8ff9b770-b9d5-4b37-9750-4eaef6fc0c01';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'db7e8ff6-abf6-49a4-90f4-8ec78193ba23';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '192.76.120.192/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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'ecef3d0c-ca65-42fd-b193-7b51aa788108';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '192.76.120.193/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'] = '3624399b-f894-4b59-9062-2e016b3871f9';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'e01ce3cb-d85c-4553-ad9f-4f9fcd507e2b';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '192.76.120.194/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//skyetel.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_name'] = 'skyetel.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://skyetel.com/';
+	$array['providers'][$x]['provider_signup'] = 'https://signup.skyetel.com/';
+	$array['providers'][$x]['provider_prices'] = 'https://skyetel.com/pricing/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'Skyetel, No Contracts & No Minimums, USA & Canada';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b3a84ff0-585e-4701-948b-16a275fa6642';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '27671e9b-5bf1-4ed1-beb8-120028874185';
+	$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'] = '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'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ac436eea-9603-47de-ae6d-653cf091a15d';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '519d3677-a288-4c88-a4d5-43e5a2a4e887';
+	$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'] = 'media';
+	$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'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2da9ea68-5226-4a58-904b-c591505ea7aa';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '815d436e-d743-469d-aed5-15282f5b7f74';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd3f28c99-1b28-4321-9cbe-7cfd1b6bc6b0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9578b6b3-7dd2-43b1-914c-ccf5e5ae9da0';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'afd1290c-da3f-4e6a-95a4-b3e617c85d8f';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '460b0acd-f5a5-418a-af61-3611a7b53d87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a2d38a7d-6e5a-4c65-b0dc-cd6dda24fa39';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '47dfd090-dcd7-4541-84c8-6d0409d02bfb';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c82933f4-1fc4-49d3-ac71-ab380c4479f1';
+	$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'] = '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'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f03fd46d-f68a-42b5-9924-789254bd3c0d';
+	$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'] = 'media';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '25880d30-0869-430f-a9eb-554e911959d7';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a3bae685-2163-4eb0-bf2c-aeae97549918';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '76fcc9e3-26ca-46ab-92d2-c9e1f7707cad';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a1656bf5-aa99-489a-b45e-6f2ce991b1e8';
+	$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'] = '+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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e6b1287d-7704-449b-8773-be59e0a9ad98';
+	$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://sms.skyetel.com/v1/out?from=${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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '6d151b98-5bdb-4440-adde-e2815372c989';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7796e989-cf47-46ca-be9e-275d81b557f7';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '6a984cf3-fd26-4f5e-ad24-6a8d7d73db40';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '727d032a-3ac2-426c-bf40-e2c773f2f665';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.14.37.123/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = 'SMS,MMS';
+
+//teli.net
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_name'] = 'teli.net';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://teli.net/';
+	$array['providers'][$x]['provider_signup'] = 'https://control.teli.net/signup';
+	$array['providers'][$x]['provider_prices'] = 'https://teli.net/pricing/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'teli - Wholesale VoIP and Communications API';
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '535a8940-134a-4c80-b0d0-81930e58a375';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4c548403-df94-45aa-b433-a68b6c54dc53';
+	$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'] = 'message';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9cae00ca-1afd-426e-9309-91f129c20701';
+	$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'] = 'source';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ccabe589-2939-4885-b4f0-99f3cf4f1e3d';
+	$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_array';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '2c4d065a-2099-44ed-bdbd-61616703844d';
+	$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_name';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4ea37645-9d64-4c85-93a5-d3c60baf57bf';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '0a6bef5b-b8ec-4269-80e8-de25c5dd65bf';
+	$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'] = 'destination';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '91b841df-25d6-459a-8f80-4eea892dda1d';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a8f48e9a-1ca2-40c2-80c6-56d2cffc1049';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f7236967-c5ee-4484-9259-bb87fcac01b1';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e9ecdfc2-1bd2-4bfa-8b20-f4b9405e9f78';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ae0e1838-f07d-4e2f-a412-317ea5debe7b';
+	$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'] = 'message';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'a364833d-746b-40df-819f-e09ba245e756';
+	$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'] = 'source';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'fe9b211d-4ffe-4f83-811b-09d75b990283';
+	$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_other';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '55449d3e-7f9a-4d2b-883f-7f98bc1fe210';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '39e17083-6486-4352-9e5d-a3673b5af06a';
+	$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_other';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'sms,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '9eadc767-1c1b-49db-88db-56df8643e568';
+	$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'] = 'destination';
+	$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'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c63af01e-e6f9-4007-97ec-938e26dbd463';
+	$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://sms.teleapi.net/sms/send?token=zzz';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'd8ca559b-721e-4de9-af0b-f8d037ef0abc';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = 'b695e16d-0d3c-4f28-b863-0a10242e3487';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '3d1ce1a5-b5e6-40f5-a37b-cd5f346db9d0';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.39.187.22/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+//bulkvs.com
+	$x++;
+	$array['providers'][$x]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_name'] = 'bulkvs.com';
+	$array['providers'][$x]['provider_region'] = 'North America';
+	$array['providers'][$x]['provider_website'] = 'https://www.bulkvs.com/';
+	$array['providers'][$x]['provider_signup'] = 'https://www.bulkvs.com/';
+	$array['providers'][$x]['provider_prices'] = 'https://www.bulkvs.com/';
+	$array['providers'][$x]['provider_installed'] = 'false';
+	$array['providers'][$x]['provider_enabled'] = 'true';
+	$array['providers'][$x]['provider_description'] = 'A multitude of high-quality services without complexity!';
+
+	$y = 0;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'b94e9cb5-b950-4099-bb94-21f8dc2a11bf';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '8a46e37b-d5c3-4611-8cea-82224d8c36e4';
+	$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'] = 'Message';
+	$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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ebfb90e2-be38-46e7-8dff-b70a31d1133e';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '19f6b695-342c-47d2-8bd6-7043349d0727';
+	$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_array';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'MediaURLs';
+	$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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '19c1fd04-2695-42ec-8c5c-bee67f676d0d';
+	$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_name';
+	$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'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '4c702036-e517-4f37-abbb-0b8a0e0644f2';
+	$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'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_order'] = '';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_enabled'] = 'false';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_description'] = 'mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7bf46746-5862-4303-bb51-2085847d9ebb';
+	$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'] = 'MediaURLs';
+	$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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '7b9b9a62-5f3d-4f7c-b578-8b9a9c6a91cd';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'e3c03e51-e913-44fd-97cb-4e3add950901';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3939d389-8648-4fd8-81a7-7670aff65df6';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '5b304b5e-f27f-4571-ba42-169aef81b157';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '434e30df-24f7-48d8-b6a3-b07cd0573f02';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_auth_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'basic';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '3d2518dc-d0d6-48f8-abf1-654e87fbe126';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'authentication';
+	$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'] = 'auth';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'f7ce8e6e-10ff-418c-9a69-f2985da2c402';
+	$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'] = '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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '31bdbf8e-ae36-4189-b76a-013d811ee54e';
+	$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'] = 'Message';
+	$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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '83cece4b-d3f7-4e3c-b246-664a0025ad0e';
+	$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'] = '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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'cc669ea7-8b4a-4fd6-b678-6788dd539306';
+	$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'] = 'MediaURLs';
+	$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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '426fb152-54d2-4b98-95d3-8b86ef4a137d';
+	$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'] = 'array';
+	$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,mms  (new)';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c39659cb-417c-4a6d-a56e-cdb59786e796';
+	$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://portal.bulkvs.com/api/v1.0/messageSend';
+	$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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'adfecd2f-bd0a-43fb-a388-7801586cf1c0';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'c0dc3b46-a716-4c5b-a926-421a36bdb873';
+	$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,mms';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = 'ff0fa286-935b-4bba-8506-526868b0d97c';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_category'] = 'outbound';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_subcategory'] = 'header';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_type'] = 'text';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_name'] = 'http_content_type';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_value'] = 'application/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'] = '';
+	$y++;
+	$array['providers'][$x]['provider_settings'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_settings'][$y]['application_uuid'] = '4a20815d-042c-47c8-85df-085333e79b87';
+	$array['providers'][$x]['provider_settings'][$y]['provider_setting_uuid'] = '351d69e0-5e0a-4e25-9df4-bbf1b9d04fa1';
+	$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'] = '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'] = '';
+	$y = 0;
+	$array['providers'][$x]['provider_addresses'][$y]['provider_uuid'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '5515633c-8920-49a4-a80a-b61dd65b9c49';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '52.206.134.245/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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '1aa4062c-2408-415d-826c-cb4670ca6c5a';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '69.12.88.198/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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = 'fb8689d7-6ed9-4112-8137-15d3dd6d2f18';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '192.9.236.42/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'] = '2b2480be-412e-436f-afc2-34a15a6e05d5';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_uuid'] = '1c718d6c-df39-4a52-baec-32bcdec33156';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_cidr'] = '199.255.157.195/32';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_enabled'] = 'true';
+	$array['providers'][$x]['provider_addresses'][$y]['provider_address_description'] = '';
+
+?>

+ 30 - 0
resources/service/debian-message_events.service

@@ -0,0 +1,30 @@
+; Author: Mark J Crane <[email protected]>
+; cp /var/www/fusionpbx/app/messages/resources/service/debian-message_events.service /etc/systemd/system/message_events.service
+; systemctl enable message_events
+; systemctl start message_events
+; systemctl daemon-reload
+
+[Unit]
+Description=FusionPBX Message Events
+Wants=network-online.target
+Requires=network.target local-fs.target postgresql.service
+After=network.target network-online.target local-fs.target postgresql.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+;Type=forking
+PIDFile=/var/run/fusionpbx/message_events.pid
+WorkingDirectory=/var/www/fusionpbx
+;Environment="USER=www-data"
+;Environment="GROUP=www-data"
+;EnvironmentFile=-/etc/default/fusionpbx
+ExecStartPre=/bin/mkdir -p /var/run/fusionpbx
+;ExecStartPre=/bin/chown -R ${USER}:${GROUP} /var/www/fusionpbx
+ExecStart=/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_events.php
+TimeoutSec=55s
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+Also=

+ 30 - 0
resources/service/debian-message_queue.service

@@ -0,0 +1,30 @@
+; Author: Mark J Crane <[email protected]>
+; cp /var/www/fusionpbx/app/messages/resources/service/debian-message_queue.service /etc/systemd/system/message_queue.service
+; systemctl enable message_queue
+; systemctl start message_queue
+; systemctl daemon-reload
+
+[Unit]
+Description=FusionPBX Message Queue
+Wants=network-online.target
+Requires=network.target local-fs.target postgresql.service
+After=network.target network-online.target local-fs.target postgresql.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+;Type=forking
+PIDFile=/var/run/fusionpbx/message_queue.pid
+WorkingDirectory=/var/www/fusionpbx
+;Environment="USER=www-data"
+;Environment="GROUP=www-data"
+;EnvironmentFile=-/etc/default/fusionpbx
+ExecStartPre=/bin/mkdir -p /var/run/fusionpbx
+;ExecStartPre=/bin/chown -R ${USER}:${GROUP} /var/www/fusionpbx
+ExecStart=/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_queue.php
+TimeoutSec=55s
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+Also=

+ 324 - 0
resources/service/message_events.php

@@ -0,0 +1,324 @@
+<?php
+
+//only allow command line
+	if (defined('STDIN')) {
+		//set the include path
+		$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+		set_include_path(parse_ini_file($conf[0])['document.root']);
+	}
+	else {
+		exit;
+	}
+
+//increase limits
+	set_time_limit(0);
+	ini_set('max_execution_time', 0);
+	ini_set('memory_limit', '512M');
+
+//save the arguments to variables
+	$script_name = $argv[0];
+	if (!empty($argv[1])) {
+		parse_str($argv[1], $_GET);
+	}
+	//print_r($_GET);
+
+//set the variables
+	if (isset($_GET['hostname'])) {
+		$hostname = urldecode($_GET['hostname']);
+	}
+	if (isset($_GET['debug'])) {
+		$debug = $_GET['debug'];
+	}
+	$debug = false;
+
+//set the hostname if it wasn't provided
+	if (!isset($hostname) || (isset($hostname) && strlen($hostname) == 0)) {
+		$hostname = gethostname();
+	}
+
+//includes
+	require_once "resources/require.php";
+	include "resources/classes/permissions.php";
+
+//define the process id file
+	$pid_file = "/var/run/fusionpbx/".basename( $argv[0], ".php") .".pid";
+	//echo "pid_file: ".$pid_file."\n";
+
+//function to check if the process exists
+	function process_exists($file = false) {
+
+		//set the default exists to false
+		$exists = false;
+
+		//check to see if the process is running
+		if (file_exists($file)) {
+			$pid = file_get_contents($file);
+			if (posix_getsid($pid) === false) { 
+				//process is not running
+				$exists = false;
+			}
+			else {
+				//process is running
+				$exists = true;
+			}
+		}
+
+		//return the result
+		return $exists;
+	}
+
+//check to see if the process exists
+	$pid_exists = process_exists($pid_file);
+
+//prevent the process running more than once
+	if ($pid_exists) {
+		echo "Cannot lock pid file {$pid_file}\n";
+		exit;
+	}
+
+//create the process id file if the process doesn't exist
+	if (!$pid_exists) {
+		//remove the old pid file
+		if (file_exists($file)) {
+			unlink($pid_file);
+		}
+
+		//show the details to the user
+		//echo "The process id is ".getmypid()."\n";
+
+		//save the pid file
+		file_put_contents($pid_file, getmypid());
+	}
+
+
+//connect to event socket
+	$socket = new event_socket;
+	if (!$socket->connect($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password'])) {
+		echo "Unable to connect to event socket\n";
+	}
+
+//connect to event socket
+	$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+
+//create the database connection
+	$database = new database;
+
+//add the permission
+	$p = new permissions;
+	$p->add('message_queue_add', 'temp');
+
+//example command
+	//$cmd = "api help";
+	//$result = $esl->request($cmd);
+	//echo "help: ".$result."\n";
+
+//loop through the switch events
+	//read the events
+	//$cmd = "event plain ALL";
+	//$cmd = "event xml ALL";
+	$cmd = "event json MESSAGE";
+	//$cmd = "event json CUSTOM";
+	$result = $socket->request($cmd);
+	while ($socket) {
+		$response = $socket->read_event();
+		//print_r($response);
+
+		$array = json_decode($response['$'], true);
+		//$array = json_decode($response['Content'], true);
+		//print_r($array);
+
+		$event_name = $array['Event-Name'];
+		$event_type = $array['event_type'];
+		$event_subclass = $array['Event-Subclass'];
+		$from = $array['from'];
+		$from_array = explode("@", $from);
+		$from_user = $array['from_user'];
+		$from_host = $array['from_host'];
+		$to_user = $array['to_user'];
+		$to_host = $array['to_host'];
+		$from_sip_ip = $array['from_sip_ip'];
+		$to = $array['to'];
+		$message_content = $array['_body'];
+		$message_type = 'sms';
+		$to = $to_user;
+
+		//if the message is from an external number don't relay the message
+		$command = "user_exists id ".$from_user." ".$from_host;
+		$response = event_socket_request($fp, "api ".$command);
+		if ($response == 'false') {
+			continue;
+		}
+
+		//get the from user's external number
+		$command = "user_data ".$from_user."@".$from_host." var outbound_caller_id_number";
+		//echo $command."\n";
+		$source_number = event_socket_request($fp, "api ".$command);
+
+		/*
+		[from] => [email protected]
+		[from_user] => 1005
+		[from_host] => voip.fusionpbx.com
+		[to_user] => 12088058985
+		[to_host] => voip.fusionpbx.com
+		[from_sip_ip] => 96.18.173.64
+		[from_sip_port] => 14395
+		[to] => [email protected]
+		[subject] => SIMPLE MESSAGE
+		[context] => public
+		[type] => text/plain
+		[from_full] => <sip:[email protected]>;tag=6952509
+		[sip_profile] => internal
+		[dest_proto] => sip
+		[max_forwards] => 70
+		[DP_MATCH] => [email protected]
+		[Nonblocking-Delivery] => true
+		[Content-Length] => 4
+		[_body] => nova
+		*/
+
+		//reconnect to the database
+		if (!database) {
+			$database = new database;
+		}
+
+		//get the provider uuid
+		$sql = "SELECT * FROM v_destinations \n";
+		$sql .= "WHERE ( \n";
+		$sql .= "	destination_prefix || destination_area_code || destination_number = :source_number \n";
+		$sql .= "	OR destination_trunk_prefix || destination_area_code || destination_number = :source_number \n";
+		$sql .= "	OR destination_prefix || destination_number = :source_number \n";
+		$sql .= "	OR '+' || destination_prefix || destination_number = :source_number \n";
+		$sql .= "	OR '+' || destination_prefix || destination_area_code || destination_number = :source_number \n";
+		$sql .= "	OR destination_area_code || destination_number = :source_number \n";
+		$sql .= "	OR destination_number = :source_number \n";
+		$sql .= ") \n";
+		$parameters['source_number'] = $source_number;
+		$row = $database->select($sql, $parameters, 'row');
+		//view_array($row, false);
+		if (is_array($row)) {
+			$domain_uuid = $row["domain_uuid"];
+			$provider_uuid = $row["provider_uuid"];
+			$destination_prefix = $row["destination_prefix"];
+			$destination_number = $row["destination_number"];
+		}
+		unset($parameters);
+
+		//get the user_uuid
+		$sql = "select user_uuid from v_extension_users \n";
+		$sql .= "where extension_uuid in ( \n";
+		$sql .= "	select extension_uuid \n";
+		$sql .= "	from v_extensions \n";
+		$sql .= "	where extension = :extension \n";
+		$sql .= "	and domain_uuid = :domain_uuid\n";
+		$sql .= ");\n";
+		$parameters['extension'] = $from_user;
+		$parameters['domain_uuid'] = $domain_uuid;
+		$row = $database->select($sql, $parameters, 'row');
+		//view_array($row, false);
+		if (is_array($row)) {
+			$user_uuid = $row["user_uuid"];
+		}
+		unset($parameters);
+
+		//get the source and destination numbers
+		$from = $destination_prefix.$destination_number;
+
+		//debug
+		//echo "provider_uuid: ".$provider_uuid."\n";
+
+		//build the message array
+		$message_queue_uuid = uuid();
+		$array['message_queue'][0]['domain_uuid'] = $domain_uuid;
+		$array['message_queue'][0]['message_queue_uuid'] = $message_queue_uuid;
+		$array['message_queue'][0]['user_uuid'] = $user_uuid;
+		//$array['message_queue'][0]['contact_uuid'] = $contact_uuid;
+		$array['message_queue'][0]['provider_uuid'] = $provider_uuid;
+		$array['message_queue'][0]['hostname'] = system('hostname');
+		$array['message_queue'][0]['message_status'] = 'waiting';
+		$array['message_queue'][0]['message_type'] = $message_type;
+		$array['message_queue'][0]['message_direction'] = 'outbound';
+		$array['message_queue'][0]['message_date'] = 'now()';
+		$array['message_queue'][0]['message_from'] = $from;
+		$array['message_queue'][0]['message_to'] = $to;
+		$array['message_queue'][0]['message_text'] = $message_content;
+		//view_array($array);
+
+		//build message media array (if necessary)
+		//$p = new permissions;
+		//if (is_array($message_media) && @sizeof($message_media) != 0) {
+		//	foreach($message_media as $index => $media) {
+		//		$array['message_media'][$index]['message_media_uuid'] = $media['uuid'];
+		//		$array['message_media'][$index]['message_uuid'] = $message_uuid;
+		//		$array['message_media'][$index]['domain_uuid'] = $_SESSION["domain_uuid"];
+		//		$array['message_media'][$index]['user_uuid'] = $_SESSION["user_uuid"];
+		//		$array['message_media'][$index]['message_media_type'] = strtolower(pathinfo($media['name'], PATHINFO_EXTENSION));
+		//		$array['message_media'][$index]['message_media_url'] = $media['name'];
+		//		$array['message_media'][$index]['message_media_content'] = base64_encode(file_get_contents($media['tmp_name']));
+		//	}
+		//	$p->add('message_media_add', 'temp');
+		//	$message_media_exists = true;
+		//}
+
+		//save to the data
+		$database->app_name = 'messages';
+		$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+		$database->save($array, false);
+		//$message = $database->message;
+		//view_array($message, false);
+		unset($array);
+
+		// current memory
+		//$memory_usage = memory_get_usage();
+
+		// peak memory
+		//$memory_peak = memory_get_peak_usage();
+
+		//echo 'Current memory: ' . round($memory_usage / 1024) . " KB\n";
+		//echo 'Peak memory: ' . round($memory_peak / 1024) . " KB\n\n";
+
+		usleep(10000);
+	}
+
+//remove the permission
+	$p->delete('message_queue_add', 'temp');
+
+//remove the old pid file
+	if (file_exists($file)) {
+		unlink($pid_file);
+	}
+
+//save output to
+	//$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
+
+//prepare the output buffers
+	//ob_end_clean();
+	//ob_start();
+
+//message divider for log file
+	//echo "\n\n=========================================================================\n\n";
+
+//get and save the output from the buffer
+	//$content = ob_get_contents(); //get the output from the buffer
+	//$content = str_replace("<br />", "", $content);
+
+	//ob_end_clean(); //clean the buffer
+
+	//fwrite($fp, $content);
+	//fclose($fp);
+
+//to do list
+	// destination_number -> digits length the provider requires
+	// local extension to extension messages
+	// cross tenant messages on same server
+	// cross server messages off the local server
+	// test multiple registrations for the same extension
+	// maybe merge into one server rather than multiple
+	// use a queue for inbound messages don't send unless the SIP user is registered
+	// group messages to multiple users
+	// limit number of messages to the provider per second per source number
+	// add media support for sending photos
+
+//how to use this feature
+	// cd /var/www/fusionpbx && /usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_events.php >> /dev/null 2>&1 &
+
+?>

+ 192 - 0
resources/service/message_queue.php

@@ -0,0 +1,192 @@
+<?php
+
+
+//only allow command line
+	if (defined('STDIN')) {
+		//set the include path
+		$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+		set_include_path(parse_ini_file($conf[0])['document.root']);
+	}
+	else {
+		exit;
+	}
+
+//increase limits
+	set_time_limit(0);
+	ini_set('max_execution_time', 0);
+	ini_set('memory_limit', '128M');
+
+//save the arguments to variables
+	$script_name = $argv[0];
+	if (!empty($argv[1])) {
+		parse_str($argv[1], $_GET);
+	}
+	//print_r($_GET);
+	//echo __line__."\n";
+
+//set the variables
+	if (isset($_GET['hostname'])) {
+		$hostname = urldecode($_GET['hostname']);
+	}
+	if (isset($_GET['debug'])) {
+		$debug = $_GET['debug'];
+	}
+	$debug = false;
+
+//set the hostname if it wasn't provided
+	if (!isset($hostname) || (isset($hostname) && strlen($hostname) == 0)) {
+		$hostname = gethostname();
+	}
+
+//includes
+	require_once "resources/require.php";
+	include "resources/classes/permissions.php";
+
+//define the process id file
+	$pid_file = "/var/run/fusionpbx/".basename( $argv[0], ".php") .".pid";
+	//echo "pid_file: ".$pid_file."\n";
+
+//function to check if the process exists
+	function process_exists($file = false) {
+
+		//set the default exists to false
+		$exists = false;
+
+		//check to see if the process is running
+		if (file_exists($file)) {
+			$pid = file_get_contents($file);
+			if (posix_getsid($pid) === false) { 
+				//process is not running
+				$exists = false;
+			}
+			else {
+				//process is running
+				$exists = true;
+			}
+		}
+
+		//return the result
+		return $exists;
+	}
+
+//check to see if the process exists
+	$pid_exists = process_exists($pid_file);
+
+//prevent the process running more than once
+	if ($pid_exists) {
+		echo "Cannot lock pid file {$pid_file}\n";
+		exit;
+	}
+
+//create the process id file if the process doesn't exist
+	if (!$pid_exists) {
+		//remove the old pid file
+		if (file_exists($file)) {
+			unlink($pid_file);
+		}
+
+		//show the details to the user
+		//echo "The process id is ".getmypid()."\n";
+
+		//save the pid file
+		file_put_contents($pid_file, getmypid());
+	}
+
+//get the messages waiting in the email queue
+	while (true) {
+
+		//get the messages that are waiting to send
+		$sql = "select message_queue_uuid, message_direction, hostname from v_message_queue ";
+		$sql .= "where message_status = 'waiting' ";
+		$sql .= "and (message_type = 'sms' or message_type = 'mms') ";
+		$sql .= "and hostname = :hostname ";
+		$sql .= "and message_from is not null ";
+		$sql .= "and message_to is not null ";
+		$sql .= "order by domain_uuid asc ";
+		$sql .= "limit 300; ";
+		//echo $sql."\n";
+		if (isset($hostname)) {
+			$parameters['hostname'] = $hostname;
+		}
+		else {
+			$parameters['hostname'] = gethostname();
+		}
+		//print_r($parameters);
+		$database = new database;
+		$message_queue = $database->select($sql, $parameters, 'all');
+		//view_array($message_queue, false);
+		unset($parameters);
+
+		//process the messages
+		if (is_array($message_queue) && @sizeof($message_queue) != 0) {
+			foreach($message_queue as $row) {
+				//direction inbound, send SIP messages to registered phones
+				if ($row['message_direction'] == 'inbound') {
+					$command = "/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_inbound.php ";
+					$command .= "'message_queue_uuid=".$row['message_queue_uuid']."&hostname=".$row['hostname']."'";
+				}
+
+				//direction outbound, send message to the provider
+				if ($row['message_direction'] == 'outbound') {
+					// /usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_outbound.php action=send&message_queue_uuid=&hostname=voip.fusionpbx.com
+					$command = "/usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_send_outbound.php ";
+					$command .= "'message_queue_uuid=".$row['message_queue_uuid']."&hostname=".$row['hostname']."'";
+				}
+
+				//send the command
+				if (isset($command)) {
+					if (isset($debug)) {
+						//run process inline to see debug info
+						echo $command."\n";
+						$result = system($command);
+						echo $result."\n";
+					}
+					else {
+						//starts process rapidly doesn't wait for previous process to finish (used for production)
+						$handle = popen($command." > /dev/null &", 'r'); 
+						echo "'$handle'; " . gettype($handle) . "\n";
+						$read = fread($handle, 2096);
+						echo $read;
+						pclose($handle);
+					}
+				}
+				unset($command);
+			}
+		}
+
+		//pause to prevent excessive database queries
+		sleep(1);
+	}
+
+//remove the old pid file
+	if (file_exists($file)) {
+		unlink($pid_file);
+	}
+
+//save output to
+	//$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
+
+//prepare the output buffers
+	//ob_end_clean();
+	//ob_start();
+
+//message divider for log file
+	//echo "\n\n=============================================================================================================================================\n\n";
+
+//get and save the output from the buffer
+	//$content = ob_get_contents(); //get the output from the buffer
+	//$content = str_replace("<br />", "", $content);
+
+	//ob_end_clean(); //clean the buffer
+
+	//fwrite($fp, $content);
+	//fclose($fp);
+
+//notes
+	//echo __line__."\n";
+	// if not keeping the email then need to delete it after the voicemail is emailed
+
+//how to use this feature
+	// cd /var/www/fusionpbx && /usr/bin/php /var/www/fusionpbx/app/messages/resources/service/message_queue.php
+
+?>

+ 213 - 0
resources/service/message_send_inbound.php

@@ -0,0 +1,213 @@
+<?php
+
+//only allow command line
+	if (defined('STDIN')) {
+		//set the include path
+		$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+		set_include_path(parse_ini_file($conf[0])['document.root']);
+	}
+	else {
+		exit;
+	}
+
+//increase limits
+	//set_time_limit(0);
+	ini_set('max_execution_time',30); //seconds
+	ini_set('memory_limit', '512M');
+
+//include files
+	require_once "resources/require.php";
+	include "resources/classes/cache.php";
+	include "resources/classes/permissions.php";
+
+//save the arguments to variables
+	$script_name = $argv[0];
+	if (!empty($argv[1])) {
+		parse_str($argv[1], $_GET);
+	}
+	//print_r($_GET);
+
+//set the variables
+	if (isset($_GET['hostname'])) {
+		$hostname = urldecode($_GET['hostname']);
+	}
+	if (isset($_GET['debug'])) {
+		$debug = $_GET['debug'];
+	}
+	if (isset($_GET['message_queue_uuid'])) {
+		$message_queue_uuid = urldecode($_GET['message_queue_uuid']);
+	}
+
+//set the hostname if it wasn't provided
+	if (!isset($hostname) && strlen($hostname) == 0) {
+		$hostname = system('hostname');
+	}
+
+//log information
+	if (isset($debug)) {
+		//print_r($_GET);
+		echo "message_queue_uuid ".$message_queue_uuid."\n";
+		echo "hostname ".$hostname."\n";
+	}
+
+//get the message details to send
+	$sql = "select * from v_message_queue ";
+	$sql .= "where message_queue_uuid = :message_queue_uuid ";
+	$sql .= "and hostname = :hostname ";
+	$parameters['hostname'] = $hostname;
+	$parameters['message_queue_uuid'] = $message_queue_uuid;
+	$database = new database;
+	$row = $database->select($sql, $parameters, 'row');
+	//view_array($row, false);
+	if (is_array($row)) {
+		$domain_uuid = $row["domain_uuid"];
+		$message_queue_uuid = $row["message_queue_uuid"];
+		$user_uuid = $row["user_uuid"];
+		$group_uuid = $row["group_uuid"];
+		$contact_uuid = $row["contact_uuid"];
+		$provider_uuid = $row["provider_uuid"];
+		//$hostname = $row["hostname"];
+		$message_type = $row["message_type"];
+		$message_direction = $row["message_direction"];
+		$message_date = $row["message_date"];
+		$message_from = $row["message_from"];
+		$message_to = $row["message_to"];
+		$message_text = $row["message_text"];
+		$message_json = $row["message_json"];
+	}
+	unset($parameters);
+
+//get the provider settings
+	$sql = "select provider_setting_category, provider_setting_subcategory, provider_setting_name, provider_setting_value, provider_setting_order \n";
+	$sql .= "from v_provider_settings \n";
+	$sql .= "where provider_uuid = :provider_uuid \n";
+	$sql .= "and provider_setting_category = 'inbound' \n";
+	$sql .= "and provider_setting_enabled = 'true'; \n";
+	$parameters['provider_uuid'] = $provider_uuid;
+	$database = new database;
+	$provider_settings = $database->select($sql, $parameters, 'all');
+	unset($parameters);
+	//echo $sql;
+	//print_r($parameters);
+	//print_r(provider_settings);
+	//
+	//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);
+			}
+		}
+
+		//get the http method
+		//if ($row['provider_setting_subcategory'] == 'method') {
+		//	if ($row['provider_setting_name'] == 'http_method') {
+		//		$http_method = $row['provider_setting_value'];
+		//	}
+		//}
+	}
+
+//get the list of extensions using the user_uuid
+	$sql = "select * from v_domains as d, v_extensions as e ";
+	$sql .= "where extension_uuid in ( ";
+	$sql .= "	select extension_uuid ";
+	$sql .= "	from v_extension_users ";
+	$sql .= "	where user_uuid = :user_uuid ";
+	$sql .= ") ";
+	$sql .= "and e.domain_uuid = d.domain_uuid ";
+	$sql .= "and e.enabled = 'true' ";
+	$parameters['user_uuid'] = $user_uuid;
+	$database = new database;
+	$extensions = $database->select($sql, $parameters, 'all');
+	//view_array($extensions, false);
+	unset($sql, $parameters);
+
+//send the sip message
+	if (is_array($extensions) && @sizeof($extensions) != 0) {
+		//echo "\n".__line__."\n";
+		//create the event socket connection
+		$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+
+		//loop through assigned extensions
+		foreach ($extensions as $extension) {
+			//get variables from the array
+			$domain_name = $extension['domain_name'];
+			$extension = $extension['extension'];
+			$number_alias = $extension['number_alias'];
+
+			//user registered get the sip profile
+			//$command = "sofia_contact ".$extension."@".$domain_name;
+			//if (isset($debug)) {
+			//	echo $command."\n";
+			//}
+			//$response = trim(event_socket_request($fp, "api ".$command));
+			//if ($response != 'error/user_not_registered') {
+			//	echo $extension." registered\n";
+			//	$sip_profile = explode("/", $response)[1];
+			//}
+
+			//user not registered skip the rest of code in the loop
+			//if ($response == 'error/user_not_registered') {
+			//	echo $extension." not registered\n";
+			//	continue;
+			//}
+
+			//original number with the domain name
+			$message_from = $message_from .'@'.$domain_name;
+
+			//send to the assigned extension(s)
+			$message_to = $extension . '@'.$domain_name;
+			//$message_to = '[email protected]';
+
+			//add debug info to the message
+			//$message_content = $message_content . ' - ' .$message_to_orig;
+
+			//send the SIP message  (working)
+			$event = "sendevent CUSTOM\n";
+			$event .= "Event-Subclass: SMS::SEND_MESSAGE\n";
+			$event .= "proto: sip\n";
+			$event .= "dest_proto: sip\n";
+			$event .= "from: ".$message_from."\n";
+			$event .= "from_full: sip:".$message_from."\n";
+			$event .= "to: ".$message_to."\n";
+			$event .= "subject: sip:".$message_to."\n";
+			//$event .= "type: text/html\n";
+			$event .= "type: text/plain\n";
+			$event .= "hint: the hint\n";
+			$event .= "replying: true\n";
+			$event .= "sip_profile: ".$sip_profile."\n";
+			$event .= "_body: ". $message_text;
+			event_socket_request($fp, $event);
+			unset($event);
+
+		}
+	}
+
+//set the message status to sent
+	$sql = "update v_message_queue ";
+	$sql .= "set message_status = 'sent' ";
+	$sql .= "where message_queue_uuid = :message_queue_uuid; ";
+	$parameters['message_queue_uuid'] = $message_queue_uuid;
+	//echo __line__." ".$sql."\n";
+	//print_r($parameters);
+	$database = new database;
+	$database->execute($sql, $parameters);
+	unset($parameters);
+
+//set the last message in the cache
+	$cache = new cache;
+	$cache->set("messages:user:last_message:".$user_uuid, date('r'));
+ 
+//how to use it
+	// php /var/www/fusionpbx/app/messages/resources/service/message_send_inbound.php message_queue_uuid=39402652-1475-49f8-8366-7889335edd6f&hostname=voip.fusionpbx.com
+
+?>

+ 566 - 0
resources/service/message_send_outbound.php

@@ -0,0 +1,566 @@
+<?php
+
+//only allow command line
+	if (defined('STDIN')) {
+		//set the include path
+		$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
+		set_include_path(parse_ini_file($conf[0])['document.root']);
+	}
+	else {
+		exit;
+	}
+
+//increase limits
+	//set_time_limit(0);
+	ini_set('max_execution_time',30); //seconds
+	ini_set('memory_limit', '512M');
+
+//includes files
+	require_once "resources/require.php";
+	include "resources/classes/cache.php";
+	include "resources/classes/permissions.php";
+
+//save the arguments to variables
+	$script_name = $argv[0];
+	if (!empty($argv[1])) {
+		parse_str($argv[1], $_GET);
+	}
+	//print_r($_GET);
+
+//set the variables
+	if (isset($_GET['hostname'])) {
+		$hostname = urldecode($_GET['hostname']);
+	}
+	if (isset($_GET['debug'])) {
+		$debug = $_GET['debug'];
+	}
+	if (is_uuid($_GET['message_queue_uuid'])) {
+		$message_queue_uuid = $_GET['message_queue_uuid'];
+		$message_uuid = $message_queue_uuid;
+	}
+	if (isset($debug)) {
+		print_r($_GET);
+		echo "message_queue_uuid ".$message_queue_uuid."\n";
+		echo "hostname ".$hostname."\n";
+	}
+
+//set the hostname if it wasn't provided
+	if (!isset($hostname) && strlen($hostname) == 0) {
+		$hostname = system('hostname');
+	}
+
+//get the message details to send
+	$sql = "select * from v_message_queue ";
+	$sql .= "where message_queue_uuid = :message_queue_uuid ";
+	//$sql .= "and hostname = :hostname ";
+	//$parameters['hostname'] = $hostname;
+	$parameters['message_queue_uuid'] = $message_queue_uuid;
+	$database = new database;
+	$row = $database->select($sql, $parameters, 'row');
+	if (isset($debug)) {
+		view_array($row, false);
+	}
+	if (is_array($row)) {
+		$domain_uuid = $row["domain_uuid"];
+		$user_uuid = $row["user_uuid"];
+		$group_uuid = $row["group_uuid"];
+		$contact_uuid = $row["contact_uuid"];
+		$provider_uuid = $row["provider_uuid"];
+		//$hostname = $row["hostname"];
+		$message_type = $row["message_type"];
+		$message_direction = $row["message_direction"];
+		$message_date = $row["message_date"];
+		$message_from = $row["message_from"];
+		$message_to = $row["message_to"];
+		$message_text = $row["message_text"];
+		$message_json = $row["message_json"];
+	}
+	unset($parameters);
+
+//get the message media
+	$sql = "select * from v_message_media ";
+	$sql .= "where message_uuid = :message_uuid ";
+	//$sql .= "and hostname = :hostname ";
+	//$parameters['hostname'] = $hostname;
+	$parameters['message_uuid'] = $message_uuid;
+	$database = new database;
+	$message_media = $database->select($sql, $parameters, 'all');
+	//view_array($message_media, false);
+	unset($parameters);
+
+//version 2
+	function get_value($data, $path) {
+		$keys = explode('.', $path);
+		foreach ($keys as $key) {
+			$data = $data[$key];
+		}
+		return $data;
+	}
+
+//get the values from the message array using the provider settings
+	//$message_from = get_value($message, $setting['message_from']);
+	//$message_to = get_value($message, $setting['message_to']);
+	//$message_content = get_value($message, $setting['message_content']);
+
+//debug info
+	//if ($debug) {
+	//	file_put_contents($log_file, "from: ".$message_from."\n", FILE_APPEND);
+	//	file_put_contents($log_file, "to: ".$message_to."\n", FILE_APPEND);
+	//	file_put_contents($log_file, "content: ".$message_content."\n", FILE_APPEND);
+	//}
+
+//build an array from dot notation
+	//$setting['data.attributes.from'] = '[email protected]';
+	//$setting['data.attributes.to'] = '[email protected]';
+	function build_array($array, $path, $value) {
+		$a = explode('.', $path);
+		if (count($a) == 1) {
+			$array[$a[0]] = $value;
+		}
+		if (count($a) == 2) {
+			$array[$a[0]][$a[1]] = $value;
+		}
+		if (count($a) == 3) {
+			$array[$a[0]][$a[1]][$a[2]] = $value;
+		}
+		if (count($a) == 4) {
+			$array[$a[0]][$a[1]][$a[2]][$a[3]] = $value;
+		}
+		if (count($a) == 5) {
+			$array[$a[0]][$a[1]][$a[2]][$a[3]][$a[4]] = $value;
+		}
+		return $array;
+	}
+
+//send context to the temp log
+	//echo "Subject: ".$email_subject."\n";
+	//echo "From: ".$email_from."\n";
+	//echo "Reply-to: ".$email_from."\n";
+	//echo "To: ".$email_to."\n";
+	//echo "Date: ".$email_date."\n";
+	//echo "Transcript: ".$array['message']."\n";
+	//echo "Body: ".$email_body."\n";
+
+//send the message
+	/*
+	//json api
+	POST /v2.1/messages HTTP/1.1
+	Content-Type: application/vnd.api+json
+	Accept: application/vnd.api+json
+
+	{
+		"data": {
+		"type": "message",
+		"attributes": {
+			"to": "19511231234",
+			"from": "18441231234",
+			"body": "hey"
+			}
+		}
+	}
+
+	//compact
+	POST /v2.1/messages HTTP/1.1
+	Content-Type: application/vnd.api+json
+	Accept: application/vnd.api+json
+	{
+		"to": "19511231234",
+		"from": "18441231234",
+		"body": "hey"
+	}
+
+	//curl
+	curl https://api.flowroute.com/v2.1/messages \
+	-H "Content-Type: application/vnd.api+json" -X POST -d \
+	'{"to": "19511231234", "from": "18441231234", "body": "hey"}' \
+	-u accessKey:secretKey 
+
+	http.type=/v2.1/messages HTTP/1.1
+	http.content_type=application/vnd.api+json
+	http.accept=application/vnd.api+json
+
+	data.type=message
+	data.attributes.to
+	data.attributes.from
+	data.attributes.body
+
+	//echo __line__."<br />\n";
+	*/
+
+//get the provider settings
+	$sql = "select provider_setting_category, provider_setting_subcategory, provider_setting_type, provider_setting_name, provider_setting_value, provider_setting_order \n";
+	$sql .= "from v_provider_settings \n";
+	$sql .= "where provider_uuid = :provider_uuid \n";
+	$sql .= "and provider_setting_category = 'outbound' \n";
+	$sql .= "and provider_setting_enabled = 'true'; \n";
+	$parameters['provider_uuid'] = $provider_uuid;
+	$database = new database;
+	$provider_settings = $database->select($sql, $parameters, 'all');
+	unset($parameters);
+	//echo $sql;
+	//print_r($parameters);
+	//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';
+				}
+				else {
+					$message_to_type = 'text';
+				}
+			}
+		}
+
+		//build the settings array
+		$setting[$row['provider_setting_name']] = $row['provider_setting_value'];
+	}
+
+//get the content location for the destinaion numer
+	if (isset($setting['type'])) {
+		$content_type = strtolower($setting['type']);
+	}
+	if (isset($setting['content_type'])) {
+		$content_type = strtolower($setting['content_type']);
+	}
+
+//send information to the console
+	if (isset($debug)) {
+		echo "content_type $content_type\n";
+		echo "message_from $message_from\n";
+		echo "message_to $message_to\n";
+		echo "message_text $message_text\n";
+	}
+
+//process the provider settings array
+	//foreach ($provider_settings as $row) {
+	//	$setting[$row['provider_setting_subcategory']][$row['provider_setting_name']] = $value;
+	//}
+
+//process the provider settings array
+	//foreach ($setting['content'] as $row) {
+	//		$value = $row['provider_setting_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);
+	//}
+
+//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 ($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 {
+					//sent the message to as text
+					$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 ($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 ($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']));
+						$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";
+	//view_array($outbound_array, false);
+	//view_array($setting, false);
+	/*
+	view_array($outbound_array, false);
+	exit;
+	$setting['http_destination']
+	*/
+
+//convert the array into json
+	if ($content_type == 'json') {
+		//view_array($outbound_array, false);
+		$http_content = json_encode($outbound_array);
+		//echo $http_content."\n";
+	}
+
+//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;
+		foreach ($outbound_array as $key => $value) {
+			if ($x != 0) { $query_string .= '&'; }
+			$query_string .= $key.'='. urlencode($value);
+			$x++;
+		}
+		$http_content = $query_string;
+	}
+
+//exchange variable name with their values
+	$setting['http_destination'] = str_replace("\${from}", $message_from, $setting['http_destination']);
+	$setting['http_destination'] = str_replace("\${message_from}", $message_from, $setting['http_destination']);
+	$setting['http_destination'] = str_replace("\${to}", $message_to, $setting['http_destination']);
+	$setting['http_destination'] = str_replace("\${message_to}", $message_to, $setting['http_destination']);
+	$setting['http_destination'] = str_replace("\${message_text}", $message_text, $setting['http_destination']);
+
+//logging info
+	//view_array($setting, false);
+	//view_array($outbound_array, false);
+
+//build the message array
+	$array['messages'][0]['domain_uuid'] = $domain_uuid;
+	$array['messages'][0]['message_uuid'] = $message_uuid;
+	$array['messages'][0]['user_uuid'] = $user_uuid;
+	$array['messages'][0]['group_uuid'] = $group_uuid;
+	//$array['messages'][0]['contact_uuid'] = $contact_uuid;
+	$array['messages'][0]['provider_uuid'] = $provider_uuid;
+	$array['messages'][0]['hostname'] = $hostname;
+	$array['messages'][0]['message_type'] = $message_type;
+	$array['messages'][0]['message_direction'] = $message_direction;
+	$array['messages'][0]['message_date'] = $message_date;
+	$array['messages'][0]['message_from'] = $message_from;
+	$array['messages'][0]['message_to'] = $message_to;
+	$array['messages'][0]['message_text'] = $message_text;
+	$array['messages'][0]['message_json'] = $http_content;
+
+//add permissions
+	$p = new permissions;
+	$p->add('message_add', 'temp');
+	$p->add('message_edit', 'temp');
+	$p->add('message_media_add', 'temp');
+	$p->add('message_media_edit', 'temp');
+
+//save to the database
+	$database = new database;
+	$database->app_name = 'messages';
+	$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+	$database->save($array, false);
+	view_array($database->message, false);
+	unset($array);
+
+//remove any temporary permissions
+	$p->delete('message_add', 'temp');
+	$p->delete('message_edit', 'temp');
+	$p->delete('message_media_add', 'temp');
+	$p->delete('message_media_edit', 'temp');
+
+//send the message - working
+/*
+	$cmd = "curl ".$setting['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']." ";
+	}
+	foreach ($provider_settings as $row) {
+		if ($row['provider_setting_subcategory'] == 'header' && $row['provider_setting_name'] != 'http_content_type') {
+			$cmd .= "-H '".$row['provider_setting_name'].": ".$row['provider_setting_value']."' ";
+		}
+	}
+	if (isset($setting['http_content_type'])) {
+		$cmd .= "-H 'Content-Type: ".$setting['http_content_type']."' ";
+	}
+	$cmd .= "-d '$http_content' ";
+	echo $cmd."\n";
+	$result = system($cmd);
+	$message_debug = $cmd;
+	//echo $result."\n";
+*/
+
+//prepare the http headers
+	if (isset($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') {
+			$http_headers[] = $row['provider_setting_name'].": ".$row['provider_setting_value'];
+		}
+	}
+	//print_r($provider_settings);
+	//echo "headers_array\n";
+	//print_r($http_headers);
+
+//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_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']);
+		curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //set the authentication type
+	}
+	if (isset($http_headers) && is_array($http_headers)) {
+		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_BINARYTRANSFER, TRUE);
+	curl_setopt($ch, CURLOPT_POSTFIELDS, $http_content); // file_get_contents($file_path.'/'.$file_name));
+	curl_setopt($ch, CURLOPT_POST, 1);
+	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);	//The number of seconds to wait while trying to connect.
+	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);	//To follow any "Location: " header that the server sends as part of the HTTP header.
+	curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);	//To automatically set the Referer: field in requests where it follows a Location: redirect.
+	curl_setopt($ch, CURLOPT_TIMEOUT, 30);	//The maximum number of seconds to allow cURL functions to execute.
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);	//To stop cURL from verifying the peer's certificate.
+	curl_setopt($ch, CURLOPT_HEADER, 0); //hide the headers when set to 0
+
+//execute the curl with the options
+	$http_content = curl_exec($ch);
+	echo $http_content."\n";
+
+//return the error
+	if (curl_errno($ch)) {
+		$message_debug = curl_error($ch);
+	}
+	else {
+		$message_debug = '';
+	}
+
+//close the curl resource
+	curl_close($ch);
+
+//working
+/*
+	$cmd = "curl https://api.flowroute.com/v2.1/messages -X POST ";
+	$cmd .= "-u ".$setting['http_auth_username'].":".$setting['http_auth_password']." ";
+	$cmd .= "-H 'Content-Type: application/vnd.api+json' ";
+	$cmd .= "-d '$http_content' ";
+	echo $cmd."\n";
+	echo system($cmd);
+*/
+
+/*
+//add permissions
+	$p = new permissions;
+	$p->add('message_queue_add', 'temp');
+	$p->add('message_queue_update', 'temp');
+
+//build the message array
+	$array['message_queue'][0]['domain_uuid'] = $domain_uuid;
+	$array['message_queue'][0]['message_queue_uuid'] = $message_queue_uuid;
+	$array['message_queue'][0]['message_status'] = 'sent';
+	$array['message_queue'][0]['message_json'] = $http_content;
+	$array['message_queue'][0]['message_debug'] = $message_debug;
+
+//save to the data
+	$database = new database;
+	$database->app_name = 'messages';
+	$database->app_uuid = '4a20815d-042c-47c8-85df-085333e79b87';
+	$database->save($array, false);
+	view_array($database->message, false);
+	unset($array);
+
+//remove any temporary permissions
+	$p->delete('message_queue_add', 'temp');
+	$p->delete('message_queue_update', 'temp');
+*/
+
+//set the message status to sent
+	$sql = "update v_message_queue ";
+	$sql .= "set message_status = 'sent', ";
+	$sql .= "message_json = :message_json, ";
+	$sql .= "message_debug = :message_debug ";
+	$sql .= "where message_queue_uuid = :message_queue_uuid; ";
+	$parameters['message_queue_uuid'] = $message_queue_uuid;
+	$parameters['message_json'] = $http_content;
+	$parameters['message_debug'] = $message_debug;
+	//echo __line__." ".$sql."\n";
+	//print_r($parameters);
+	$database = new database;
+	$database->execute($sql, $parameters);
+	unset($parameters);
+
+//set the last message in the cache
+	$cache = new cache;
+	$cache->set("messages:user:last_message:".$user_uuid, date('r'));
+
+//save the output
+	//$fp = fopen(sys_get_temp_dir()."/messages.log", "a");
+
+//prepare the output buffers
+	//ob_end_clean();
+	//ob_start();
+
+//message divider for log file
+	//echo "\n\n====================================================\n\n";
+
+//get and save the output from the buffer
+	//$content = ob_get_contents(); //get the output from the buffer
+	//$content = str_replace("<br />", "", $content);
+
+	//ob_end_clean(); //clean the buffer
+
+	//fwrite($fp, $content);
+	//fclose($fp);
+
+//how to use it
+	// php /var/www/fusionpbx/app/messages/resources/service/message_send_outbound.php message_queue_uuid=39402652-1475-49f8-8366-7889335edd6f&hostname=voip.fusionpbx.com
+
+?>