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:
parent
170d4be4a1
commit
f1c31e0935
|
|
@ -31,4 +31,7 @@ RewriteRule ^.*/([A-Fa-f0-9]{12})-site.cfg$ app/provision/?mac=$1&file=
|
|||
RewriteRule ^.*/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=web.cfg [QSA]
|
||||
RewriteRule ^.*/([A-Fa-f0-9]{12})-directory.xml$ app/provision/?mac=$1&file=directory.xml [QSA]
|
||||
|
||||
#Escene
|
||||
RewriteRule ^.*/provision/([A-Fa-f0-9]+)_Extern.xml$ app/provision/?ext=$1&file={$mac}_extern.xml [QSA]
|
||||
|
||||
Options -Indexes
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -429,6 +429,21 @@ require_once "resources/require.php";
|
|||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "escene" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Escene'>"; }
|
||||
?>
|
||||
<option value='1' <?php if ($row['device_key_type'] == '1' ) { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
|
||||
<option value='7' <?php if ($row['device_key_type'] == '7' ) { echo $selected;$found=true; } ?>><?php echo $text['label-call_park'] ?></option>
|
||||
<option value='4' <?php if ($row['device_key_type'] == '4' ) { echo $selected;$found=true; } ?>><?php echo $text['label-dtmf'] ?></option>
|
||||
<option value='5' <?php if ($row['device_key_type'] == '5' ) { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
|
||||
<option value='2' <?php if ($row['device_key_type'] == '2' ) { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial_prefix'] ?></option>
|
||||
<option value='8' <?php if ($row['device_key_type'] == '8' ) { echo $selected;$found=true; } ?>><?php echo $text['label-intercom'] ?></option>
|
||||
<option value='9' <?php if ($row['device_key_type'] == '9' ) { echo $selected;$found=true; } ?>><?php echo $text['label-pickup'] ?></option>
|
||||
<option value='11' <?php if ($row['device_key_type'] == '11') { echo $selected;$found=true; } ?>><?php echo $text['label-broadsoft_group'] ?></option>
|
||||
<?php /*BLA type 2 Paging type ?*/ ?>
|
||||
<?php
|
||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||
}
|
||||
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0) {
|
||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Grandstream'>"; }
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ include "root.php";
|
|||
case "001565":
|
||||
$device_vendor = "yealink";
|
||||
break;
|
||||
case "00268B":
|
||||
$device_vendor = "escene";
|
||||
break;
|
||||
default:
|
||||
$device_vendor = "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -925,12 +925,13 @@ include "root.php";
|
|||
fwrite($fh, $tmp_string);
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
$this->file = $file;
|
||||
//returned the rendered template
|
||||
return $file_contents;
|
||||
|
||||
} //end render function
|
||||
|
||||
|
||||
function write() {
|
||||
|
||||
//set default variables
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<all>
|
||||
<Privisions>
|
||||
<!-- protocol
|
||||
0 - tftp
|
||||
1 - http
|
||||
2 - ftp
|
||||
3 - https
|
||||
-->
|
||||
<privision
|
||||
PNP="1"
|
||||
AutoPrivisionFlag="1"
|
||||
DHCPOptionFlag="1"
|
||||
DHCPOptionValue="66"
|
||||
protocol="1"
|
||||
Firmware="{$domain_name}{$project_path}/app/provision"
|
||||
username=""
|
||||
password=""
|
||||
Freqency="168"
|
||||
time="24"
|
||||
DownloadBroadsoft="0"
|
||||
DownloadFirmwar="0"
|
||||
DownloadKernel="0"
|
||||
DownloadExtension="1"
|
||||
Downloadconfig="1"
|
||||
DownloadPhonebook="0"
|
||||
DownloadPersonPhonebook="0"
|
||||
Bootingchecked="0"
|
||||
ExtensionNumber=""
|
||||
BootingcheckedMode="0"
|
||||
DownloadFilename="0"
|
||||
/>
|
||||
</Privisions>
|
||||
|
||||
<sipUsers>
|
||||
{foreach $lines as $row}
|
||||
{if $row.line_number neq ""}
|
||||
{$line_subscribe_tmp=$line_subscribe_{$row.line_number}}
|
||||
{if $line_subscribe_tmp==""} {$line_subscribe_tmp=$line_subscribe} {/if}
|
||||
{if $line_subscribe_tmp==""} {$line_subscribe_tmp=$row.register_expires} {/if}
|
||||
{if $line_subscribe_tmp<"120"} {$line_subscribe_tmp="120"} {/if}
|
||||
|
||||
<sipUser id="{$row.line_number-1}"
|
||||
EnableAccount="{($row.enabled=='true')?'1':'0'}"
|
||||
Describe="MyLabel"
|
||||
DomainName="{$row.server_address}"
|
||||
UserName="{$row.display_name}"
|
||||
UserNumber="{$row.user_id}"
|
||||
approveName="{$row.auth_id}"
|
||||
Password="{$row.password}"
|
||||
ProxyServerAddress="{if $row.outbound_proxy neq ''}{$row.outbound_proxy}{else}{$row.server_address}{/if}{if $row.sip_port neq '5060'}:{$row.sip_port}{/if}"
|
||||
LinkUse="{if $row.sip_transport=='tcp'}1{elseif $row.sip_transport=='tls'}2{else}0{/if}"
|
||||
PossessNumber="1"
|
||||
SecondProxyServerAddress=""
|
||||
PollingRegistrationTime="32"
|
||||
RefreshTime="{$row.register_expires}"
|
||||
Subscribe="{$line_subscribe_tmp}"
|
||||
SecondDomainName=""
|
||||
STUNAddress=""
|
||||
STUNEnableFlag="0"
|
||||
flag="0"
|
||||
SupportNumber="8"
|
||||
RTPBegin="10000" RTPEND="10128"
|
||||
AccountMode="0"
|
||||
RegisterMethod="0"
|
||||
BLAEnableFlag="0"
|
||||
BLANum=""
|
||||
AnonymousCall="0"
|
||||
UserSessionTimerEnable="0"
|
||||
SessionTimer="300"
|
||||
AllowEventsEnable="0"
|
||||
DNSSRVEnable="0"
|
||||
RegisteredNAT="1"
|
||||
RingFilename=""
|
||||
KeepaliveEnable="1"
|
||||
KeepaliveInterval="30"
|
||||
AnonymousCallReject="0"
|
||||
ProxyEnableFlag="0"
|
||||
AutoAnsEnableFlag="0"
|
||||
SessionTimerRefresher="0"
|
||||
UserphoneEnable="0"
|
||||
UserSessionTimerRefresher="0"
|
||||
/>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</sipUsers>
|
||||
</all>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<all>
|
||||
<hotlines>
|
||||
{$is_first_line='true'}
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="programmable"}
|
||||
{if $row.device_key_id!=""}
|
||||
{if $row.device_key_line==""}
|
||||
{$row.device_key_line="127"}
|
||||
{/if}
|
||||
<hotline {if $is_first_line=='true'}ExternID="0"{$is_first_line='false'}{/if} id="{$row.device_key_id-1}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-1}" Type="{$row.device_key_type}" HotlineNum="{$row.device_key_value}" Name="{$row.device_key_label}"/>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</hotlines>
|
||||
|
||||
<Extensions>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if $row.device_key_id le "32"}
|
||||
<extension id="{$row.device_key_id-1}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-1}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extensions>
|
||||
|
||||
<Extension2s>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if ($row.device_key_id gt "32")&&($row.device_key_id le "64")}
|
||||
<extension2 id="{$row.device_key_id-33}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-33}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extension2s>
|
||||
|
||||
<Extension3s>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if ($row.device_key_id gt "64")&&($row.device_key_id le "96")}
|
||||
<extension3 id="{$row.device_key_id-65}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-65}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extension3s>
|
||||
|
||||
<Extension4s>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if ($row.device_key_id gt "96")&&($row.device_key_id le "128")}
|
||||
<extension4 id="{$row.device_key_id-97}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-97}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extension4s>
|
||||
|
||||
<Extension5s>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if ($row.device_key_id gt "128")&&($row.device_key_id le "160")}
|
||||
<extension5 id="{$row.device_key_id-129}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-129}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extension5s>
|
||||
|
||||
<Extension6s>
|
||||
{foreach $keys as $row}
|
||||
{if $row.device_key_category=="expansion"}
|
||||
{if ($row.device_key_id gt "160")&&($row.device_key_id le "192")}
|
||||
<extension6 id="{$row.device_key_id-161}" HotlineNum="{$row.device_key_value}" SipAccounts="{$row.device_key_line}" ID="{$row.device_key_id-161}" Type="{$row.device_key_type}" Name="{$row.device_key_label}" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</Extension6s>
|
||||
</all>
|
||||
Loading…
Reference in New Issue