mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 18:53:49 +00:00
remove SMS (#1612)
This commit is contained in:
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = "SMS";
|
||||
$apps[$x]['uuid'] = "f1381f06-1d33-11e6-b6ba-3e1d05defe78";
|
||||
$apps[$x]['category'] = "Switch";
|
||||
$apps[$x]['subcategory'] = "";
|
||||
$apps[$x]['version'] = "";
|
||||
$apps[$x]['license'] = "Mozilla Public License 1.1";
|
||||
$apps[$x]['url'] = "http://www.fusionpbx.com";
|
||||
$apps[$x]['description']['en-us'] = "SMS";
|
||||
$apps[$x]['description']['es-cl'] = "";
|
||||
$apps[$x]['description']['es-mx'] = "";
|
||||
$apps[$x]['description']['de-de'] = "";
|
||||
$apps[$x]['description']['de-ch'] = "";
|
||||
$apps[$x]['description']['de-at'] = "";
|
||||
$apps[$x]['description']['fr-fr'] = "";
|
||||
$apps[$x]['description']['fr-ca'] = "";
|
||||
$apps[$x]['description']['fr-ch'] = "";
|
||||
$apps[$x]['description']['pt-pt'] = "";
|
||||
$apps[$x]['description']['pt-br'] = "";
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = "sms_view";
|
||||
$apps[$x]['permissions'][$y]['menu']['uuid'] = "d4278820-1d33-11e6-b6ba-3e1d05defe78";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "sms_edit";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "sms_add";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "sms_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "sms_enabled";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_sms_messages";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "sms_message_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "sms_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'] = "extension_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]['description']['en-us'] = "";
|
||||
$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";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "start_stamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "from_numer";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "to_number";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "message";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "direction";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "response";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "carrier";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_sms_destinations";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "sms_destination_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "sms_destination_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";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "carrier";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "description";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
?>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
$x = 0;
|
||||
$array[$x]['default_setting_category'] = 'sms';
|
||||
$array[$x]['default_setting_subcategory'] = 'carriers';
|
||||
$array[$x]['default_setting_name'] = 'array';
|
||||
$array[$x]['default_setting_value'] = 'flowroute';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'sms';
|
||||
$array[$x]['default_setting_subcategory'] = 'carriers';
|
||||
$array[$x]['default_setting_name'] = 'array';
|
||||
$array[$x]['default_setting_value'] = 'twilio';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,146 +0,0 @@
|
||||
<?php
|
||||
|
||||
$text['title-sms']['en-us'] = "SMS";
|
||||
$text['title-sms']['es-cl'] = "";
|
||||
$text['title-sms']['pt-pt'] = "";
|
||||
$text['title-sms']['fr-fr'] = "";
|
||||
$text['title-sms']['pt-br'] = "";
|
||||
$text['title-sms']['pl'] = "";
|
||||
$text['title-sms']['uk'] = "";
|
||||
$text['title-sms']['sv-se'] = "";
|
||||
$text['title-sms']['ro'] = "";
|
||||
$text['title-sms']['de-at'] = "";
|
||||
$text['title-sms']['ar-eg'] = "";
|
||||
$text['title-sms']['he'] = "";
|
||||
|
||||
$text['header-sms']['en-us'] = "SMS";
|
||||
$text['header-sms']['es-cl'] = "";
|
||||
$text['header-sms']['pt-pt'] = "";
|
||||
$text['header-sms']['fr-fr'] = "";
|
||||
$text['header-sms']['pt-br'] = "";
|
||||
$text['header-sms']['pl'] = "";
|
||||
$text['header-sms']['uk'] = "";
|
||||
$text['header-sms']['sv-se'] = "";
|
||||
$text['header-sms']['ro'] = "";
|
||||
$text['header-sms']['de-at'] = "";
|
||||
$text['header-sms']['ar-eg'] = "";
|
||||
$text['header-sms']['he'] = "";
|
||||
|
||||
$text['title-sms-edit']['en-us'] = "SMS";
|
||||
$text['title-sms-edit']['es-cl'] = "";
|
||||
$text['title-sms-edit']['pt-pt'] = "";
|
||||
$text['title-sms-edit']['fr-fr'] = "";
|
||||
$text['title-sms-edit']['pt-br'] = "";
|
||||
$text['title-sms-edit']['pl'] = " ";
|
||||
$text['title-sms-edit']['uk'] = "";
|
||||
$text['title-sms-edit']['sv-se'] = "";
|
||||
$text['title-sms-edit']['ro'] = "";
|
||||
$text['title-sms-edit']['de-at'] = "";
|
||||
$text['title-sms-edit']['ar-eg'] = "";
|
||||
$text['title-sms-edit']['he'] = "";
|
||||
|
||||
$text['label-domain']['en-us'] = "Domain";
|
||||
$text['label-domain']['es-cl'] = "";
|
||||
$text['label-domain']['pt-pt'] = "";
|
||||
$text['label-domain']['fr-fr'] = "";
|
||||
$text['label-domain']['pt-br'] = "";
|
||||
$text['label-domain']['pl'] = " ";
|
||||
$text['label-domain']['uk'] = "";
|
||||
$text['label-domain']['sv-se'] = "";
|
||||
$text['label-domain']['ro'] = "";
|
||||
$text['label-domain']['de-at'] = "";
|
||||
$text['label-domain']['ar-eg'] = "";
|
||||
$text['label-domain']['he'] = "";
|
||||
|
||||
$text['label-extension']['en-us'] = "Extension";
|
||||
$text['label-extension']['es-cl'] = "";
|
||||
$text['label-extension']['pt-pt'] = "";
|
||||
$text['label-extension']['fr-fr'] = "";
|
||||
$text['label-extension']['pt-br'] = "";
|
||||
$text['label-extension']['pl'] = " ";
|
||||
$text['label-extension']['uk'] = "";
|
||||
$text['label-extension']['sv-se'] = "";
|
||||
$text['label-extension']['ro'] = "";
|
||||
$text['label-extension']['de-at'] = "";
|
||||
$text['label-extension']['ar-eg'] = "";
|
||||
$text['label-extension']['he'] = "";
|
||||
|
||||
$text['label-source']['en-us'] = "Source";
|
||||
$text['label-source']['es-cl'] = "";
|
||||
$text['label-source']['pt-pt'] = "";
|
||||
$text['label-source']['fr-fr'] = "";
|
||||
$text['label-source']['pt-br'] = "";
|
||||
$text['label-source']['pl'] = " ";
|
||||
$text['label-source']['uk'] = "";
|
||||
$text['label-source']['sv-se'] = "";
|
||||
$text['label-source']['ro'] = "";
|
||||
$text['label-source']['de-at'] = "";
|
||||
$text['label-source']['ar-eg'] = "";
|
||||
$text['label-source']['he'] = "";
|
||||
|
||||
$text['label-destination']['en-us'] = "Destination";
|
||||
$text['label-destination']['es-cl'] = "";
|
||||
$text['label-destination']['pt-pt'] = "";
|
||||
$text['label-destination']['fr-fr'] = "";
|
||||
$text['label-destination']['pt-br'] = "";
|
||||
$text['label-destination']['pl'] = " ";
|
||||
$text['label-destination']['uk'] = "";
|
||||
$text['label-destination']['sv-se'] = "";
|
||||
$text['label-destination']['ro'] = "";
|
||||
$text['label-destination']['de-at'] = "";
|
||||
$text['label-destination']['ar-eg'] = "";
|
||||
$text['label-destination']['he'] = "";
|
||||
|
||||
$text['label-start']['en-us'] = "Time Stamp";
|
||||
$text['label-start']['es-cl'] = "";
|
||||
$text['label-start']['pt-pt'] = "";
|
||||
$text['label-start']['fr-fr'] = "";
|
||||
$text['label-start']['pt-br'] = "";
|
||||
$text['label-start']['pl'] = " ";
|
||||
$text['label-start']['uk'] = "";
|
||||
$text['label-start']['sv-se'] = "";
|
||||
$text['label-start']['ro'] = "";
|
||||
$text['label-start']['de-at'] = "";
|
||||
$text['label-start']['ar-eg'] = "";
|
||||
$text['label-start']['he'] = "";
|
||||
|
||||
$text['label-carrier']['en-us'] = "Carrier";
|
||||
$text['label-carrier']['es-cl'] = "";
|
||||
$text['label-carrier']['pt-pt'] = "";
|
||||
$text['label-carrier']['fr-fr'] = "";
|
||||
$text['label-carrier']['pt-br'] = "";
|
||||
$text['label-carrier']['pl'] = " ";
|
||||
$text['label-carrier']['uk'] = "";
|
||||
$text['label-carrier']['sv-se'] = "";
|
||||
$text['label-carrier']['ro'] = "";
|
||||
$text['label-carrier']['de-at'] = "";
|
||||
$text['label-carrier']['ar-eg'] = "";
|
||||
$text['label-carrier']['he'] = "";
|
||||
|
||||
$text['label-message']['en-us'] = "Message";
|
||||
$text['label-message']['es-cl'] = "";
|
||||
$text['label-message']['pt-pt'] = "";
|
||||
$text['label-message']['fr-fr'] = "";
|
||||
$text['label-message']['pt-br'] = "";
|
||||
$text['label-message']['pl'] = " ";
|
||||
$text['label-message']['uk'] = "";
|
||||
$text['label-message']['sv-se'] = "";
|
||||
$text['label-message']['ro'] = "";
|
||||
$text['label-message']['de-at'] = "";
|
||||
$text['label-message']['ar-eg'] = "";
|
||||
$text['label-message']['he'] = "";
|
||||
|
||||
$text['button-mdr']['en-us'] = "MDRs";
|
||||
$text['button-mdr']['es-cl'] = "";
|
||||
$text['button-mdr']['pt-pt'] = "";
|
||||
$text['button-mdr']['fr-fr'] = "";
|
||||
$text['button-mdr']['pt-br'] = "";
|
||||
$text['button-mdr']['pl'] = " ";
|
||||
$text['button-mdr']['uk'] = "";
|
||||
$text['button-mdr']['sv-se'] = "";
|
||||
$text['button-mdr']['ro'] = "";
|
||||
$text['button-mdr']['de-at'] = "";
|
||||
$text['button-mdr']['ar-eg'] = "";
|
||||
$text['button-mdr']['he'] = "";
|
||||
|
||||
?>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = "SMS";
|
||||
$apps[$x]['menu'][0]['title']['es-cl'] = "";
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-fr'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = " ";
|
||||
$apps[$x]['menu'][0]['title']['pt-pt'] = "";
|
||||
$apps[$x]['menu'][0]['title']['pt-br'] = "";
|
||||
$apps[$x]['menu'][0]['title']['pl'] = " ";
|
||||
$apps[$x]['menu'][0]['title']['uk'] = "";
|
||||
$apps[$x]['menu'][0]['title']['sv-se'] = "";
|
||||
$apps[$x]['menu'][0]['title']['ro'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "";
|
||||
$apps[$x]['menu'][0]['title']['ar-eg'] = "الأرقام الداخلية";
|
||||
$apps[$x]['menu'][0]['title']['he'] = "";
|
||||
$apps[$x]['menu'][0]['uuid'] = "d4278820-1d33-11e6-b6ba-3e1d05defe78";
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
|
||||
$apps[$x]['menu'][0]['category'] = "internal";
|
||||
$apps[$x]['menu'][0]['path'] = "/app/sms/sms.php";
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
|
||||
?>
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
umask(2);
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if (strpos($_ENV["OS"], "Win") !== false) {
|
||||
define("PATH_SEPARATOR", ";");
|
||||
} else {
|
||||
define("PATH_SEPARATOR", ":");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
|
||||
if(PHP_SAPI == 'cli'){
|
||||
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
|
||||
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
|
||||
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
|
||||
if (file_exists('/project_root.php')) {
|
||||
$path = '/';
|
||||
} else {
|
||||
$i = 1;
|
||||
$path = '';
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = $path;
|
||||
}else{
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
// try to detect if a project path is being used
|
||||
if (!defined('PROJECT_PATH')) {
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
|
||||
define('PROJECT_PATH', '/fusionpbx');
|
||||
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
|
||||
define('PROJECT_PATH', '');
|
||||
} else {
|
||||
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
|
||||
$i = 1;
|
||||
$path = $_SERVER["DOCUMENT_ROOT"];
|
||||
while ($i < count($dirs)) {
|
||||
$path .= '/' . $dirs[$i];
|
||||
if (file_exists($path. '/project_root.php')) {
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if(!file_exists($path. '/project_root.php')){
|
||||
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
|
||||
}
|
||||
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
|
||||
define('PROJECT_PATH', $project_path);
|
||||
}
|
||||
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
|
||||
}
|
||||
|
||||
?>
|
||||
229
app/sms/sms.php
229
app/sms/sms.php
@@ -1,229 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('sms_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http values and set them as variables
|
||||
$search = check_str($_GET["search"]);
|
||||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-sms'];
|
||||
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get total extension count from the database
|
||||
$sql = "select ";
|
||||
$sql .= "(select count(*) from v_sms_destinations where domain_uuid = '".$_SESSION['domain_uuid']."' ".$sql_mod.") as num_rows ";
|
||||
if ($db_type == "pgsql") {
|
||||
$sql .= ",(select count(*) as count from v_sms_destinations ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= ") as numeric_sms ";
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$total_sms_destinations = $row['num_rows'];
|
||||
if (($db_type == "pgsql") or ($db_type == "mysql")) {
|
||||
$numeric_sms = $row['numeric_sms'];
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $row);
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = "&search=".$search;
|
||||
if (!isset($_GET['page'])) { $_GET['page'] = 0; }
|
||||
$_GET['page'] = check_str($_GET['page']);
|
||||
list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_sms_destinations, $param, $rows_per_page, true); //top
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($total_sms_destinations, $param, $rows_per_page); //bottom
|
||||
$offset = $rows_per_page * $_GET['page'];
|
||||
|
||||
//to cast or not to cast
|
||||
if ($db_type == "pgsql") {
|
||||
$order_text = ($total_sms_destinations == $numeric_sms) ? "cast(destination as bigint)" : "destination asc";
|
||||
}
|
||||
else {
|
||||
$order_text = "extension asc";
|
||||
}
|
||||
|
||||
//get the extensions
|
||||
$sql = "select * from v_sms_destinations ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= $sql_mod; //add search mod from above
|
||||
if (strlen($order_by) > 0) {
|
||||
$sql .= ($order_by == 'destination') ? "order by $order_text ".$order." " : "order by ".$order_by." ".$order." ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_text ";
|
||||
}
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$sms_destinations = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//show the content
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' width='100%'><b>".$text['header-sms']." (".$total_sms_destinations.")</b><br>\n";
|
||||
echo " ".$text['description-sms']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
|
||||
if (if_group("superadmin")) {
|
||||
echo " <input type='button' class='btn' style='margin-right: 15px;' value='".$text['button-mdr']."' onclick=\"window.location.href='sms_mdr.php'\">\n";
|
||||
}
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </form>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<form name='frm' method='post' action='sms_delete.php'>\n";
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if (permission_exists('sms_delete') && is_array($sms_destinations)) {
|
||||
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
|
||||
}
|
||||
echo th_order_by('destination', $text['label-destination'], $order_by, $order);
|
||||
echo th_order_by('carrier', $text['label-carrier'], $order_by, $order);
|
||||
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
|
||||
echo th_order_by('description', $text['label-description'], $order_by, $order);
|
||||
echo "<td class='list_control_icon'>\n";
|
||||
if (permission_exists('sms_add')) {
|
||||
echo "<a href='sms_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
if (permission_exists('sms_delete') && is_array($sms_destinations)) {
|
||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($sms_destinations)) {
|
||||
|
||||
foreach($sms_destinations as $row) {
|
||||
$tr_link = (permission_exists('sms_edit')) ? " href='sms_edit.php?id=".$row['sms_destination_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
if (permission_exists('sms_delete')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
|
||||
echo " <input type='checkbox' name='id[]' id='checkbox_".$row['sms_destination_uuid']."' value='".$row['sms_destination_uuid']."' onclick=\"if (!this.checked) { document.getElementById('chk_all').checked = false; }\">";
|
||||
echo " </td>";
|
||||
$ext_ids[] = 'checkbox_'.$row['sms_destination_uuid'];
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('sms_edit')) {
|
||||
echo "<a href='sms_edit.php?id=".$row['sms_destination_uuid']."'>".$row['destination']."</a>";
|
||||
}
|
||||
else {
|
||||
echo $row['destination'];
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['carrier']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['enabled'])."</td>\n";
|
||||
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('sms_edit')) {
|
||||
echo "<a href='sms_edit.php?id=".$row['sms_destination_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('sms_delete')) {
|
||||
echo "<a href='sms_delete.php?id[]=".$row['sms_destination_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
unset($sms_destinations, $row);
|
||||
}
|
||||
|
||||
if (is_array($sms_destinations)) {
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan='20' class='list_control_icons'>\n";
|
||||
if (permission_exists('sms_add')) {
|
||||
echo "<a href='sms_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
if (permission_exists('sms_delete')) {
|
||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if (strlen($paging_controls) > 0) {
|
||||
echo "<center>".$paging_controls."</center>\n";
|
||||
}
|
||||
|
||||
echo "<br /><br />".((is_array($sms_destinations)) ? "<br /><br />" : null);
|
||||
|
||||
// check or uncheck all checkboxes
|
||||
if (sizeof($ext_ids) > 0) {
|
||||
echo "<script>\n";
|
||||
echo " function check(what) {\n";
|
||||
echo " document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
|
||||
foreach ($ext_ids as $ext_id) {
|
||||
echo " document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
|
||||
}
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
}
|
||||
|
||||
if (is_array($sms_destinations)) {
|
||||
// check all checkboxes
|
||||
key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
|
||||
|
||||
// delete checked
|
||||
key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
|
||||
}
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
/*
|
||||
call.php
|
||||
Copyright (C) 2008, 2009 Mark J Crane
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
James Rose <james.o.rose@gmail.com>
|
||||
|
||||
*/
|
||||
include "root.php";
|
||||
|
||||
//luarun /var/www/fusionpbx/app/sms/sms.lua TO FROM 'BODY'
|
||||
|
||||
$debug = false;
|
||||
|
||||
require_once "resources/require.php";
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($_SERVER['CONTENT_TYPE'] == 'application/json') {
|
||||
$data = json_decode(file_get_contents("php://input"));
|
||||
} else {
|
||||
error_log('REQUEST: ' . print_r($_REQUEST, true));
|
||||
$data = (object) ['body' => $_REQUEST['Body'],
|
||||
'to' => str_replace("+", "", $_REQUEST['To']),
|
||||
'from' => str_replace("+", "", $_REQUEST['From'])
|
||||
];
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
error_log('DATA: ' . print_r($data, true));
|
||||
}
|
||||
|
||||
//create the even socket connection and send the event socket command
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
if (!$fp) {
|
||||
//error message
|
||||
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
|
||||
}
|
||||
else {
|
||||
|
||||
$to = preg_replace('/(^[1])/','', $data->to);
|
||||
if ($debug) {
|
||||
error_log("TO: " . print_r($to,true));
|
||||
}
|
||||
|
||||
$sql = "select domain_name, ";
|
||||
$sql .= "dialplan_detail_data, ";
|
||||
$sql .= "v_domains.domain_uuid as domain_uuid ";
|
||||
$sql .= "from v_destinations, ";
|
||||
$sql .= "v_dialplan_details, ";
|
||||
$sql .= "v_domains ";
|
||||
$sql .= "where v_destinations.dialplan_uuid = v_dialplan_details.dialplan_uuid ";
|
||||
$sql .= "and v_destinations.domain_uuid = v_domains.domain_uuid";
|
||||
$sql .= " and destination_number like '" . $to . "' and dialplan_detail_type = 'transfer'";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_name = $row["domain_name"];
|
||||
preg_match('/(\d{2,7})/',$row["dialplan_detail_data"],$match);
|
||||
$domain_uuid = $row["domain_uuid"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
if ($debug) {
|
||||
error_log("MATCH: " . print_r($match,true));
|
||||
error_log("DOMAIN_NAME: " . print_r($domain_name,true));
|
||||
}
|
||||
|
||||
$sql = "select destination_number ";
|
||||
$sql .= "from v_ring_groups, v_ring_group_destinations ";
|
||||
$sql .= "where v_ring_groups.ring_group_uuid = v_ring_group_destinations.ring_group_uuid ";
|
||||
$sql .= "and ring_group_extension = '" . $match[0] . "' ";
|
||||
$sql .= "and v_ring_groups.domain_uuid = '" . $domain_uuid . "'";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
if (count($result)) {
|
||||
foreach ($result as &$row) {
|
||||
$switch_cmd = "api luarun app.lua sms inbound ";
|
||||
$switch_cmd .= $row['destination_number'] . "@" . $domain_name;
|
||||
$switch_cmd .= " " . $data->from . " '" . $data->body . "'";
|
||||
if ($debug) {
|
||||
error_log(print_r($switch_cmd,true));
|
||||
}
|
||||
$result2 = trim(event_socket_request($fp, $switch_cmd));
|
||||
}
|
||||
} else {
|
||||
$switch_cmd = "api luarun app.lua sms inbound " . $match[0] . "@" . $domain_name . " " . $data->from . " '" . $data->body . "'";
|
||||
if ($debug) {
|
||||
error_log(print_r($switch_cmd,true));
|
||||
}
|
||||
$result2 = trim(event_socket_request($fp, $switch_cmd));
|
||||
}
|
||||
if ($debug) {
|
||||
error_log("RESULT: " . print_r($result2,true));
|
||||
}
|
||||
|
||||
unset ($prep_statement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
die();
|
||||
|
||||
?>
|
||||
@@ -1,242 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
/*
|
||||
call.php
|
||||
Copyright (C) 2008, 2009 Mark J Crane
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
James Rose <james.o.rose@gmail.com>
|
||||
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('sms_add') || permission_exists('sms_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$sms_uuid = check_str($_REQUEST["id"]);
|
||||
$sql = "select * from v_sms_destinations ";
|
||||
$sql .= "where sms_destination_uuid = '" . $_REQUEST["id"] . "' ";
|
||||
$sql .= "and domain_uuid = '" . $_SESSION['domain_uuid'] . "' LIMIT 1";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$sms_destinations = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sms_destinations as $row) {
|
||||
$destination = check_str($row["destination"]);
|
||||
$carrier = check_str($row["carrier"]);
|
||||
$description = check_str($row["description"]);
|
||||
$enabled = check_str($row["enabled"]);
|
||||
$sms_destination_uuid = $row['sms_destination_uuid'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the http values and set them as php variables
|
||||
if (count($_POST) > 0 && $action != "update") {
|
||||
//get the values from the HTTP POST and save them as PHP variables
|
||||
$destination = str_replace(' ','-',check_str($_POST["destination"]));
|
||||
$carrier = check_str($_POST["carrier"]);
|
||||
$description = check_str($_POST["description"]);
|
||||
$enabled = check_str($_POST["enabled"]);
|
||||
$sms_destination_uuid = uuid();
|
||||
if ($action == "add") {
|
||||
$sql_insert = "insert into v_sms_destinations ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "sms_destination_uuid, ";
|
||||
$sql_insert .= "carrier, ";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "destination, ";
|
||||
$sql_insert .= "enabled, ";
|
||||
$sql_insert .= "description ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".$sms_destination_uuid."', ";
|
||||
$sql_insert .= "'".$carrier."', ";
|
||||
$sql_insert .= "'".$_SESSION['domain_uuid']."', ";
|
||||
$sql_insert .= "'".$destination."', ";
|
||||
$sql_insert .= "'".$enabled."', ";
|
||||
$sql_insert .= "'".$description."' ";
|
||||
$sql_insert .= ")";
|
||||
$db->exec($sql_insert);
|
||||
header( 'Location: sms.php') ;
|
||||
|
||||
}
|
||||
} elseif (count($_POST) > 0 && $action == "update") {
|
||||
$destination = str_replace(' ','-',check_str($_POST["destination"]));
|
||||
$carrier = check_str($_POST["carrier"]);
|
||||
$description = check_str($_POST["description"]);
|
||||
$enabled = check_str($_POST["enabled"]);
|
||||
|
||||
$sql_insert = "update v_sms_destinations set";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "carrier, ";
|
||||
$sql_insert .= "destination, ";
|
||||
$sql_insert .= "enabled, ";
|
||||
$sql_insert .= "description ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "= ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".$carrier."', ";
|
||||
$sql_insert .= "'".$destination."', ";
|
||||
$sql_insert .= "'".$enabled."', ";
|
||||
$sql_insert .= "'".$description."' ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "where sms_destination_uuid = '" . $sms_destination_uuid . "' and domain_uuid = '" . $_SESSION['domain_uuid'] . "'";
|
||||
$db->exec($sql_insert);
|
||||
header( 'Location: sms.php') ;
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
echo "<form method='post' name='frm' id='frm' action=''>\n";
|
||||
echo "<table width='100%' border='0' cellpdding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>".$text['header-sms-add']."</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>".$text['header-sms-edit']."</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='sms.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
|
||||
echo " <br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-destination']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='destination' autocomplete='off' maxlength='255' value=\"$destination\" required='required'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-destination']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-carrier']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
if (count($_SESSION['sms']['carriers']) > 0) {
|
||||
echo "<select name='carrier' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
sort($_SESSION['sms']['carriers']);
|
||||
foreach ($_SESSION['sms']['carriers'] as &$row) {
|
||||
echo " <option value='$row'";
|
||||
if ($row == $carrier) {
|
||||
echo " selected='selected'";
|
||||
}
|
||||
echo ">$row</option>\n";
|
||||
}
|
||||
echo "</select><br />\n";
|
||||
}
|
||||
echo $text['description-carrier']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
if (permission_exists('sms_enabled')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='enabled'>\n";
|
||||
if ($enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
if ($enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' name='description' rows='4'>$description</textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='sms_destination_uuid' value='".$sms_destination_uuid."'>\n";
|
||||
echo " <input type='hidden' name='id' id='id' value='".$sms_destination_uuid."'>";
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
|
||||
echo "<script>\n";
|
||||
//capture enter key to submit form
|
||||
echo " $(window).keypress(function(event){\n";
|
||||
echo " if (event.which == 13) { submit_form(); }\n";
|
||||
echo " });\n";
|
||||
// convert password fields to
|
||||
echo " function submit_form() {\n";
|
||||
echo " $('input:password').css('visibility','hidden');\n";
|
||||
echo " $('input:password').attr({type:'text'});\n";
|
||||
echo " $('form#frm').submit();\n";
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
/*
|
||||
call.php
|
||||
Copyright (C) 2008, 2009 Mark J Crane
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
James Rose <james.o.rose@gmail.com>
|
||||
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('sms_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//include the header
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
|
||||
$sql = "select domain_name, extension, sms_message_uuid,start_stamp,from_numer,to_number,message,direction from v_sms_messages, v_domains, v_extensions where v_sms_messages.domain_uuid = v_domains.domain_uuid and v_sms_messages.extension_uuid = v_extensions.extension_uuid and v_domains.domain_uuid = '" . $domain_uuid . "' order by start_stamp";
|
||||
error_log("SQL: " . print_r($sql,true));
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//mod paging parameters for inclusion in column sort heading links
|
||||
$param = substr($param, 1); //remove leading '&'
|
||||
$param = substr($param, 0, strrpos($param, '&order_by=')); //remove trailing order by
|
||||
|
||||
//show the results
|
||||
$col_count = 6;
|
||||
echo "<form name='frm' method='post' action='xml_cdr_delete.php'>\n";
|
||||
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th> </th>\n";
|
||||
if ($_REQUEST['showall'] && permission_exists('xml_cdr_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, null, null, $param);
|
||||
$col_count++;
|
||||
}
|
||||
echo th_order_by('extension', $text['label-extension'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('start_stamp', $text['label-start'], $order_by, $order, null, "style='text-align: center;'", $param);
|
||||
echo th_order_by('caller_id_number', $text['label-source'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('destination_number', $text['label-destination'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('message', $text['label-message'], $order_by, $order, null, null, $param);
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
echo "<tr>\n";
|
||||
|
||||
//determine if theme images exist
|
||||
$theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/";
|
||||
$theme_cdr_images_exist = (
|
||||
file_exists($theme_image_path."icon_cdr_inbound_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_inbound_failed.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_outbound_failed.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_answered.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_voicemail.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_cancelled.png") &&
|
||||
file_exists($theme_image_path."icon_cdr_local_failed.png")
|
||||
) ? true : false;
|
||||
|
||||
foreach($result as $index => $row) {
|
||||
|
||||
$tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_stamp']) : date("j M Y H:i:s", $row['start_epoch']);
|
||||
|
||||
//determine call result and appropriate icon
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>\n";
|
||||
if ($theme_cdr_images_exist) {
|
||||
$call_result = 'answered';
|
||||
echo "<img src='".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_".$row['direction']."_".$call_result.".png' width='16' style='border: none; cursor: help;' title='".$text['label-'.$row['direction']].": ".$text['label-'.$call_result]."'>\n";
|
||||
}
|
||||
else { echo " "; }
|
||||
echo "</td>\n";
|
||||
//domain name
|
||||
if ($_REQUEST['showall'] && permission_exists('xml_cdr_all')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
echo $row['domain_name'].' ';
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['extension']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['start_stamp']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['from_numer']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['to_number']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['message']." </td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
} // end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} // end if
|
||||
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
@@ -1,208 +0,0 @@
|
||||
-- sms.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2010 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
-- modification, are permitted provided that the following conditions are met:
|
||||
--
|
||||
-- 1. Redistributions of source code must retain the above copyright notice,
|
||||
-- this list of conditions and the following disclaimer.
|
||||
--
|
||||
-- 2. Redistributions in binary form must reproduce the above copyright
|
||||
-- notice, this list of conditions and the following disclaimer in the
|
||||
-- documentation and/or other materials provided with the distribution.
|
||||
--
|
||||
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
-- POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--connect to the database
|
||||
require "resources.functions.database_handle";
|
||||
dbh = database_handle('system');
|
||||
|
||||
--debug
|
||||
debug["info"] = false;
|
||||
debug["sql"] = false;
|
||||
|
||||
--set the api
|
||||
api = freeswitch.API();
|
||||
|
||||
--define uuid function
|
||||
local random = math.random;
|
||||
local function uuid()
|
||||
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
||||
return string.gsub(template, '[xy]', function (c)
|
||||
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb);
|
||||
return string.format('%x', v);
|
||||
end)
|
||||
end
|
||||
|
||||
--get the argv values
|
||||
script_name = argv[0];
|
||||
direction = argv[2];
|
||||
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] DIRECTION: " .. direction .. "\n");
|
||||
freeswitch.consoleLog("info", "chat console\n");
|
||||
end
|
||||
|
||||
if direction == "inbound" then
|
||||
to = argv[3];
|
||||
from = argv[4];
|
||||
body = argv[5];
|
||||
domain_name = string.match(to,'%@+(.+)');
|
||||
extension = string.match(to,'%d+');
|
||||
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] TO: " .. to .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] Extension: " .. extension .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] FROM: " .. from .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] BODY: " .. body .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] DOMAIN_NAME: " .. domain_name .. "\n");
|
||||
end
|
||||
|
||||
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
|
||||
event:addHeader("proto", "sip");
|
||||
event:addHeader("dest_proto", "sip");
|
||||
event:addHeader("from", "sip:" .. from);
|
||||
event:addHeader("from_full", "sip:" .. from);
|
||||
event:addHeader("sip_profile","internal");
|
||||
event:addHeader("to", to);
|
||||
event:addHeader("subject", "sip:" .. to);
|
||||
event:addHeader("type", "text/html");
|
||||
event:addHeader("hint", "the hint");
|
||||
event:addHeader("replying", "true");
|
||||
event:addBody(body);
|
||||
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("info", event:serialize());
|
||||
end
|
||||
event:fire();
|
||||
to = extension;
|
||||
elseif direction == "outbound" then
|
||||
to = message:getHeader("to_user");
|
||||
domain_name = message:getHeader("from_host");
|
||||
from = message:getHeader("from_user");
|
||||
body = message:getBody();
|
||||
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("info", message:serialize());
|
||||
freeswitch.consoleLog("notice", "[sms] TO: " .. to .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] FROM: " .. from .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] BODY: " .. body .. "\n");
|
||||
freeswitch.consoleLog("notice", "[sms] DOMAIN_NAME: " .. domain_name .. "\n");
|
||||
end
|
||||
|
||||
if (domain_uuid == nil) then
|
||||
--get the domain_uuid using the domain name required for multi-tenant
|
||||
if (domain_name ~= nil) then
|
||||
sql = "SELECT domain_uuid FROM v_domains ";
|
||||
sql = sql .. "WHERE domain_name = '" .. domain_name .. "' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
domain_uuid = rows["domain_uuid"];
|
||||
end);
|
||||
end
|
||||
end
|
||||
freeswitch.consoleLog("notice", "[sms] DOMAIN_UUID: " .. domain_uuid .. "\n");
|
||||
if (outbound_caller_id_number == nil) then
|
||||
--get the outbound_caller_id_number using the domain_uuid and the extension number
|
||||
if (domain_uuid ~= nil) then
|
||||
sql = "SELECT outbound_caller_id_number, extension_uuid, carrier FROM v_extensions ";
|
||||
sql = sql .. ", v_sms_destinations ";
|
||||
sql = sql .. "WHERE outbound_caller_id_number = destination and ";
|
||||
sql = sql .. "v_extensions.domain_uuid = '" .. domain_uuid .. "' and extension = '" .. from .."' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
outbound_caller_id_number = rows["outbound_caller_id_number"];
|
||||
extension_uuid = rows["extension_uuid"];
|
||||
carrier = rows["carrier"];
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
sql = "SELECT default_setting_value FROM v_default_settings ";
|
||||
sql = sql .. "where default_setting_category = 'sms' and default_setting_subcategory = '" .. carrier .. "_access_key'";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
access_key = rows["default_setting_value"];
|
||||
end);
|
||||
|
||||
sql = "SELECT default_setting_value FROM v_default_settings ";
|
||||
sql = sql .. "where default_setting_category = 'sms' and default_setting_subcategory = '" .. carrier .. "_secret_key'";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
secret_key = rows["default_setting_value"];
|
||||
end);
|
||||
|
||||
sql = "SELECT default_setting_value FROM v_default_settings ";
|
||||
sql = sql .. "where default_setting_category = 'sms' and default_setting_subcategory = '" .. carrier .. "_api_url'";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
api_url = rows["default_setting_value"];
|
||||
end);
|
||||
|
||||
if (carrier == "flowroute") then
|
||||
cmd = "curl -u ".. access_key ..":" .. secret_key .. " -H \"Content-Type: application/json\" -X POST -d '{\"to\":\"" .. to .. "\",\"from\":\"" .. outbound_caller_id_number .."\",\"body\":\"" .. body .. "\"}' " .. api_url;
|
||||
elseif (carrier == "twilio") then
|
||||
cmd ="curl -X POST '" .. api_url .."' --data-urlencode 'To=+" .. to .."' --data-urlencode 'From=+" .. outbound_caller_id_number .. "' --data-urlencode 'Body=" .. body .. "' -u ".. access_key ..":" .. secret_key .. " --insecure";
|
||||
end
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] CMD: " .. cmd .. "\n");
|
||||
end
|
||||
os.execute(cmd)
|
||||
|
||||
end
|
||||
|
||||
--write message to DB
|
||||
if (domain_uuid == nil) then
|
||||
--get the domain_uuid using the domain name required for multi-tenant
|
||||
if (domain_name ~= nil) then
|
||||
sql = "SELECT domain_uuid FROM v_domains ";
|
||||
sql = sql .. "WHERE domain_name = '" .. domain_name .. "' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
domain_uuid = rows["domain_uuid"];
|
||||
end);
|
||||
end
|
||||
end
|
||||
if (extension_uuid == nil) then
|
||||
--get the extension_uuid using the domain_uuid and the extension number
|
||||
if (domain_uuid ~= nil) then
|
||||
sql = "SELECT extension_uuid FROM v_extensions ";
|
||||
sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .. "' and extension = '" .. extension .."' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] SQL: " .. sql .. "\n");
|
||||
end
|
||||
status = dbh:query(sql, function(rows)
|
||||
extension_uuid = rows["extension_uuid"];
|
||||
end);
|
||||
end
|
||||
end
|
||||
sql = "insert into v_sms_messages";
|
||||
sql = sql .. "(sms_message_uuid,extension_uuid,domain_uuid,start_stamp,from_numer,to_number,message,direction,response,carrier)";
|
||||
sql = sql .. " values ('" .. uuid() .. "','" .. extension_uuid .. "','" .. domain_uuid .."',now(),'" .. from .. "','" .. to .. "','" .. body .. "','" .. direction .. "','','" .. carrier .."')";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[sms] "..sql.."\n");
|
||||
end
|
||||
dbh:query(sql);
|
||||
Reference in New Issue
Block a user