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:
committed by
FusionPBX
parent
170d4be4a1
commit
f1c31e0935
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user