Escene provision (#1140)

* Add. Provision to Escene ES330/ES320

* Add. Look up Escene device by ext+domain.

* Update Escene template.

* Add. `provision` section in config.

Found than ES330 some time hangup when it try get software/core and get error from fusion.
This commit is contained in:
Alexey Melnichuk
2016-05-06 01:49:43 -06:00
committed by FusionPBX
parent 73605b4454
commit f828c1c56b
9 changed files with 2014 additions and 1754 deletions
+26
View File
@@ -325,6 +325,19 @@ $text['label-speed_dial']['de-at'] = "Schnellwahl";
$text['label-speed_dial']['ar-eg'] = "";
$text['label-speed_dial']['he'] = "חיוג מהיר";
$text['label-speed_dial_prefix']['en-us'] = "Speed Dial Prefix";
$text['label-speed_dial_prefix']['es-cl'] = "";
$text['label-speed_dial_prefix']['pt-pt'] = "";
$text['label-speed_dial_prefix']['fr-fr'] = "";
$text['label-speed_dial_prefix']['pt-br'] = "";
$text['label-speed_dial_prefix']['pl'] = "";
$text['label-speed_dial_prefix']['uk'] = "";
$text['label-speed_dial_prefix']['sv-se'] = "";
$text['label-speed_dial_prefix']['ro'] = "";
$text['label-speed_dial_prefix']['de-at'] = "";
$text['label-speed_dial_prefix']['ar-eg'] = "";
$text['label-speed_dial_prefix']['he'] = "";
$text['label-sms']['en-us'] = "SMS";
$text['label-sms']['es-cl'] = "SMS";
$text['label-sms']['pt-pt'] = "SMS";
@@ -455,6 +468,19 @@ $text['label-record']['de-at'] = "Aufnehmen";
$text['label-record']['ar-eg'] = "تسجيل";
$text['label-record']['he'] = "הקלטה";
$text['label-pickup']['en-us'] = "Pickup";
$text['label-pickup']['es-cl'] = "";
$text['label-pickup']['pt-pt'] = "";
$text['label-pickup']['fr-fr'] = "";
$text['label-pickup']['pt-br'] = "";
$text['label-pickup']['pl'] = "";
$text['label-pickup']['uk'] = "";
$text['label-pickup']['sv-se'] = "";
$text['label-pickup']['ro'] = "";
$text['label-pickup']['de-at'] = "";
$text['label-pickup']['ar-eg'] = "";
$text['label-pickup']['he'] = "";
$text['label-public_hold']['en-us'] = "Public Hold";
$text['label-public_hold']['es-cl'] = "Hold Pública";
$text['label-public_hold']['pt-pt'] = "Espera Pública";
File diff suppressed because it is too large Load Diff
+3
View File
@@ -104,6 +104,9 @@ include "root.php";
case "001565":
$device_vendor = "yealink";
break;
case "00268B":
$device_vendor = "escene";
break;
default:
$device_vendor = "";
}
+16
View File
@@ -26,6 +26,7 @@
include "root.php";
require_once "resources/require.php";
require_once "resources/functions/device_by.php";
openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
//set default variables
@@ -38,6 +39,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
//define PHP variables from the HTTP values
$mac = check_str($_REQUEST['mac']);
$file = check_str($_REQUEST['file']);
$ext = check_str($_REQUEST['ext']);
//if (strlen(check_str($_REQUEST['template'])) > 0) {
// $device_template = check_str($_REQUEST['template']);
//}
@@ -51,6 +53,20 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0);
}
}
// Escence make request based on UserID for Memory keys
/*
The file name is fixed to `Account1_Extern.xml`.
(Account1 is the first account you register)
*/
if(empty($mac) && !empty($ext)){
$domain_array = explode(":", $_SERVER["HTTP_HOST"]);
$domain_name = $domain_array[0];
$device = device_by_ext($db, $ext, $domain_name);
if(($device !== false)&&($device['device_vendor']=='escene')){
$mac = $device['device_mac_address'];
}
}
//check alternate MAC source
if (empty($mac)){
//set the http user agent
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,34 @@
<?php
function device_by_mac($db, $mac) {
$sql = 'SELECT * FROM v_devices ';
$sql .= 'WHERE device_mac_address=:mac';
$prep = $db->prepare(check_sql($sql));
if ($prep) {
$prep->bindParam(':mac', $mac);
$prep->execute();
$row = $prep->fetch();
unset($prep);
return $row;
}
return false;
}
function device_by_ext($db, $ext, $domain) {
$sql = 'select t1.* ';
$sql .= 'from v_devices t1 inner join v_device_lines t2 on t1.device_uuid=t2.device_uuid ';
$sql .= 'inner join v_domains t3 on t2.domain_uuid=t3.domain_uuid ';
$sql .= 'where t2.user_id=:ext ';
$sql .= 'and t3.domain_name=:domain ';
$sql .= 'and t3.domain_enabled = \'true\' ';
$prep = $db->prepare(check_sql($sql));
if ($prep) {
$prep->bindParam(':ext', $ext);
$prep->bindParam(':domain', $domain);
$prep->execute();
$row = $prep->fetch();
unset($prep);
return $row;
}
return false;
}