Begin resample Sccp_manager

DB convert Use ENUM
This commit is contained in:
PhantomVl 2017-10-18 14:39:53 +03:00
parent 5a492133bf
commit 2861da85c0
8 changed files with 310 additions and 222 deletions

View file

@ -71,6 +71,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
private $sccp_driver_ver = '11.2';
private $tftpLang = array();
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
private $val_null = 'NONE'; /// REPLACE to null Field
public $sccp_model_list = array();
private $cnf_wr = null;
public $sccppath = array();
@ -636,7 +638,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if (!empty($request[$value])) {
$save_settings[$value] = $request[$value];
} else {
$save_settings[$value] = 'none';
$save_settings[$value] = $val_null; // null
}
}
$this->dbinterface->sccp_save_db('sccpdevmodel', $save_settings, $upd_mode, "model");

View file

@ -8,6 +8,7 @@
namespace FreePBX\modules\Sccp_manager;
class dbinterface {
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct() {
}
@ -160,7 +161,7 @@ class dbinterface {
if (!empty($sql_var)) {
$sql_var .= ', ';
}
if ($data === 'none') {
if ($data === $this->val_null) {
$sql_var .= '`' . $key_v . '`=NULL';
} else {
$sql_var .= '`' . $key_v . '`="' . $data . '"';

View file

@ -52,8 +52,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
if (empty($settings['cid_num']['value'])) {
$settings['cid_num']['value']= $id;
}
$sql = 'INSERT INTO sccpline (name, id';
$sqlv = 'values ("'.$id.'", "'.$id.'"';
$sql = 'INSERT INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
if (!empty($settings[$val]) ) {
if (!empty($settings[$val]['value'])){
@ -78,7 +78,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
public function getDevice($id) {
$sccp_line = array();
$sql = "SELECT name as id";
$sql = "SELECT name as id, name as name";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}

View file

@ -68,8 +68,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
// die(print_r($settings));
$sql = 'REPLACE INTO sccpline (name, id';
$sqlv = 'values ("'.$id.'", "'.$id.'"';
$sql = 'REPLACE INTO sccpline (name';
$sqlv = 'values ("'.$id.'"';
foreach($this->data_fld as $key => $val) {
switch ($key) {
case 'secondary_dialtone_digits':
@ -111,7 +111,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
public function getDevice($id) {
$sccp_line = array();
$sql = "SELECT name as id";
$sql = "SELECT name as id, name as name ";
foreach($this->data_fld as $key => $val) {
$sql .= ',`'. $key .'` as '.$val;
}
@ -203,11 +203,11 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"flag" => $flag++
),
"transfer" => array(
"value" => "yes",
"value" => "on",
"flag" => $flag++
),
"echocancel" => array(
"value" => "yes",
"value" => "on",
"flag" => $flag++
),
"dnd" => array(
@ -215,7 +215,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"flag" => $flag++
),
"silencesuppression" => array(
"value" => "no",
"value" => "off",
"flag" => $flag++
),
"musicclass" => array(
@ -339,34 +339,34 @@ class Sccp extends \FreePBX\modules\Core\Driver {
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Allow call transfer.");
// $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section, 'category' => 'general');
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => '', 'text' => 'Cycle');
$select[] = array('value' => 'user', 'text' => 'Cycle');
$tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / Cycle").'<br>'.
_("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
_("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'reject', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No');
$select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
@ -380,7 +380,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
}
$tt = _("Music on hold");
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section);
$tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section);
$tt = _("Sets the named pickup groups this line is a member of (this phone can pickup calls from remote phones which are in this caller group (ast111)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);

View file

@ -74,8 +74,8 @@ and open the template in the editor. Base Version before all crash :-)
<help>Time between Keep Alive checks. Valid range is 60-300 seconds. After much trial-and-error, the minimum (60) seems to work just fine.</help>
</item>
<item type="IS" id="6"><name>debug</name> <label>SCCP DEBUG</label>
<default>none</default>
<button value="none">No</button>
<default>NONE</default>
<button value="NONE">No</button>
<button value="core">Core</button>
<button value="sccp">SCCP</button>
<button value="device">Device</button>
@ -88,8 +88,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Allow Networks / Mask</label>
<name>permit</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<button>Add Allow network</button>
<help>Allow network settings. Blank fields will be ignored, use Network 0.0.0.0.</help>
</item>
@ -98,8 +98,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<button>Add Deny network</button>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
@ -108,8 +108,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Local Networks / Mask</label>
<name>localnet</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> <class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> <class></class></input>
<button>Add local networks</button>
<help>Local network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -477,14 +477,14 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="SLM" id="6"><label>Music On Hold Class</label>
<name>musicclass</name>
<default>none</default>
<default>NONE</default>
<select></select>
<class>form-control</class>
<help>Music Class: Available MOH Classes. These are the MOH classes listed in your current server.</help>
</item>
<item type="SLA-disabled" id="6"><label>Default Dial Plan</label>
<name>dial_template</name>
<default>none</default>
<default>NONE</default>
<select></select>
<class>sccp-custom</class>
<help>Help.</help>
@ -586,7 +586,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="SDE" id="3" seq="99">
<label>Addon</label>
<name>addon</name>
<default>none</default>
<default>NONE</default>
<select name="model" dataval="buttons">model</select>
<class>hw_select sccp-custom</class>
<help>Addon: Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.</help>
@ -628,7 +628,7 @@ and open the template in the editor. Base Version before all crash :-)
<label>Addon</label>
<input>
<name>addon</name>
<default>none</default>
<default>NONE</default>
<class>sccp-custom</class>
<options readonly="readonly"></options>
</input>
@ -836,8 +836,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Alow Networks / Mask</label>
<name>permit</name>
<default>/</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<button>Add Allow network</button>
<help>Allow network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -846,8 +846,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>/</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<button>Add Deny network</button>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
@ -875,8 +875,8 @@ and open the template in the editor. Base Version before all crash :-)
<button value="progress">Progress</button>
<button value="offhook">Offhook</button>
<button value="dial">Dial</button>
<button value="none">none</button>
<help>The audio stream will be open in the progress and connected state. Valid options: none, progress, offhook, dial, ringout. Default may be Progress.</help>
<button value="NONE">NONE</button>
<help>The audio stream will be open in the progress and connected state. Valid options: NONE, progress, offhook, dial, ringout. Default may be Progress.</help>
</item>
</page_group>
<page_group name="sccp_dp_new_template">
@ -896,11 +896,11 @@ and open the template in the editor. Base Version before all crash :-)
<name>dialtemplate</name>
<default>*/10/*</default>
<element1 type="title" field="title"><options class="form-control control-label"/>title</element1>
<element type="input" value="none" field="match" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Pattern to match"/></element>
<element type="number" value="none" field="timeout" display_prefix="[" display_sufix="]"><options min="0" max="30" class="form-control dpt-title" placeholder="Time wait" /></element>
<element type="input" value="n" field="match" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Pattern to match"/></element>
<element type="number" value="NONE" field="timeout" display_prefix="[" display_sufix="]"><options min="0" max="30" class="form-control dpt-title" placeholder="Time wait" /></element>
<element1 type="label" field="label1"><options class="form-control control-label"/>text1</element1>
<element type="input" value="none" field="rewrite" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Rewrite the matched"/></element>
<element type="select" value="none" field="tone">
<element type="input" value="NONE" field="rewrite" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Rewrite the matched"/></element>
<element type="select" value="NONE" field="tone">
<options class="form-control dpt-title" />
<data>empty</data>
<data>Bellcore-Alerting</data>
@ -986,8 +986,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>srst_ip</name>
<max_row>3</max_row>
<default>/</default>
<input value="none" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="port"><options placeholder="2000" pattern="^([0-9]){3,5}$"/> <class></class></input>
<input value="NONE" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="port"><options placeholder="2000" pattern="^([0-9]){3,5}$"/> <class></class></input>
<button>Add Server</button>
<help></help>
</item>
@ -996,8 +996,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>srst_sip</name>
<max_row>3</max_row>
<default>/</default>
<input value="none" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="port"><options placeholder="2000" pattern="^[0-9]{3,5}$"/> <class></class></input>
<input value="NONE" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="port"><options placeholder="2000" pattern="^[0-9]{3,5}$"/> <class></class></input>
<button>Add Server</button>
<help></help>
</item>

View file

@ -75,8 +75,8 @@ and open the template in the editor. Base Version before all crash :-)
<help>Time between Keep Alive checks. Valid range is 60-300 seconds. After much trial-and-error, the minimum (60) seems to work just fine.</help>
</item>
<item type="IS" id="6"><name>debug</name> <label>SCCP DEBUG</label>
<default>none</default>
<button value="none">No</button>
<default>NONE</default>
<button value="NONE">No</button>
<button value="core">Core</button>
<button value="sccp">SCCP</button>
<button value="device">Device</button>
@ -89,8 +89,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Alow Networks / Mask</label>
<name>permit</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<button>Add Alow network</button>
<help>Alow network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -99,8 +99,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<button>Add Deny network</button>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
@ -109,8 +109,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Local Networks / Mask</label>
<name>localnet</name>
<default>0.0.0.0/0.0.0.0</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> <class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> <class></class></input>
<button>Add local networks</button>
<help>Local network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -201,27 +201,27 @@ and open the template in the editor. Base Version before all crash :-)
<help>Call Waiting Tone: The tone played when a call is waiting. If you set this one to '0', you will not get a tone in your current call if a new call comes in, so you might want to disable call waiting for this line instead.</help>
</item>
<item type="IS" id="8"><name>echocancel</name> <label>Echo Cancel</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Echo Cancel: Echo Cancellation (On or Off).</help>
</item>
<item type="IS" id="9"><name>silencesuppression</name> <label>Silence Suppression</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Silence Suppression: Slience Suppression on the phone.</help>
</item>
<item type="IS" id="10"><name>private</name> <label>Private Calling</label>
<default>yes</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Private Calling Enabled: Place a call with privacy Options (no Caller ID) turned on. Needs to be supported in Asterisk to work through SIP and DAHDI trunks.</help>
</item>
<item type="IS" id="11"><name>directed_pickup_modeanswer</name> <label>Directed Pickup</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Directed Pickup Mode (Answer): If a call is sent with the "directed pickup" flag, the phone will answer when set to "Yes".</help>
</item>
<item type="IS" id="12"><name>callanswerorder</name> <label>Call Answer Order</label>
@ -240,9 +240,9 @@ and open the template in the editor. Base Version before all crash :-)
<help>Set the MWI lamp style when MWI active to on, off, wink, flash or blink</help>
</item>
<item type="IS" id="14"><name>mwioncall</name> <label>Message Lamp On Call</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Set the MWI on call.</help>
</item>
@ -250,9 +250,9 @@ and open the template in the editor. Base Version before all crash :-)
</page_group>
<page_group name="sccp_dev_ntp"><label>SCCP NTP Service config</label>
<item type="IS" id="1" seq="98"><name>ntp_config_enabled</name> <label>NTP Server Enabled</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Enabling NTP settings in device configuration.</help>
</item>
<item type="IE" id="2" seq="10"><label>NTP Server name (ip)</label>
@ -310,7 +310,7 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="1" seq="20"><name>srst_Option</name> <label>SRST Server Enabled</label>
<default>no</default>
<default>off</default>
<button value="enabled">Yes</button>
<button value="disable">No</button>
<button value="user">TempletDefault</button>
@ -343,8 +343,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>srst_ip</name>
<max_row>3</max_row>
<default>/</default>
<input value="none" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="port"><options placeholder="2000" pattern="^([0-9]){3,5}$"/> <class></class></input>
<input value="NONE" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="port"><options placeholder="2000" pattern="^([0-9]){3,5}$"/> <class></class></input>
<button>Add Server</button>
<help>Help.</help>
</item>
@ -353,8 +353,8 @@ and open the template in the editor. Base Version before all crash :-)
<name>srst_sip</name>
<max_row>3</max_row>
<default>/</default>
<input value="none" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="none" field="port"><options placeholder="2000" pattern="^[0-9]{3,5}$"/> <class></class></input>
<input value="NONE" field="Addr" nameseparator=":"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$" /><class></class></input>
<input value="NONE" field="port"><options placeholder="2000" pattern="^[0-9]{3,5}$"/> <class></class></input>
<button>Add Server</button>
<help>Help.</help>
</item>
@ -502,9 +502,9 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="IS" id="1"><name>hotline_enabled</name> <label>Hotline</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>Hotline Enabled: This allows unregistered extensions to connect to the system and dial the number listed below.</help>
</item>
<item type="IE" id="2"><label>Hotline extension</label>
@ -549,14 +549,14 @@ and open the template in the editor. Base Version before all crash :-)
</item>
<item type="SLM" id="6"><label>Music On Hold Class</label>
<name>musicclass</name>
<default>none</default>
<default>NONE</default>
<select></select>
<class>form-control</class>
<help>Music Class: Available MOH Classes. These are the MOH classes listed in your current server.</help>
</item>
<item type="SLA-disabled" id="6"><label>Default Dial Plan</label>
<name>dial_template</name>
<default>none</default>
<default>NONE</default>
<select></select>
<class>sccp-custom</class>
<help>Help.</help>
@ -564,15 +564,15 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="7" seq="98">
<name>autoselectline_enabled</name>
<label>Autoselect Line</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>Enables and disables auto line selection.</help>
</item>
<item type="IS-disabled" id="8" seq="0"><name>meetme</name> <label>Meetme Conference</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>enable/disable conferencing via meetme (on/off), make sure you have one of the meetme apps mentioned below activated in module.conf</help>
</item>
<item type="IS-disabled" id="9" seq="0"><label>Meetme Options</label>
@ -587,15 +587,15 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="10" seq="98">
<name>autocall_select</name>
<label>Auto Call Select</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help></help>
</item>
<item type="IS" id="11" seq="98"><name>backgroundImageAccess</name> <label>Background Image</label>
<default>no</default>
<button value="yes">Enabled</button>
<button value="no">Disabled</button>
<default>off</default>
<button value="on">Enabled</button>
<button value="off">Disabled</button>
<help>I'm guessing on this one, but on some devices, the background image on the display can be modified at the device. I think this is the thing that allows that to take.</help>
</item>
@ -629,9 +629,9 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="4" seq="99">
<name>createlangdir</name> <label>Create tftp empty language dir</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Say 'yes' if you need to create cisco default language directory in tftp path.</help>
</item>
@ -658,7 +658,7 @@ and open the template in the editor. Base Version before all crash :-)
<item type="SDE" id="3" seq="99">
<label>Addon</label>
<name>addon</name>
<default>none</default>
<default>NONE</default>
<select name="model" dataval="buttons">model</select>
<class>hw_select sccp-custom</class>
<help>Addon: Addons are model specific and only work with certain base phones. This phone model is identified as being a phone that does not accept sidecars. Update devmodel if this is not correct.</help>
@ -700,7 +700,7 @@ and open the template in the editor. Base Version before all crash :-)
<label>Addon</label>
<input>
<name>addon</name>
<default>none</default>
<default>NONE</default>
<class>sccp-custom</class>
<options readonly="readonly"></options>
</input>
@ -774,44 +774,44 @@ and open the template in the editor. Base Version before all crash :-)
</page_group>
<page_group name="sccp_hw_dev_softkey"><label>Enable/Disable Softkeys</label>
<item type="IS" id="1" seq="99"><name>transfer</name> <label>Transfer</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Transfer allowed</help>
</item>
<item type="IS" id="2" seq="99"><name>cfwdall</name> <label>Call Forward</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Activate the callforward softkeys. Default is On</help>
</item>
<item type="IS" id="3" seq="99"><name>cfwdbusy</name> <label>Call Forward busy</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Activate the callforward busy softkeys. Default is On</help>
</item>
<item type="IS" id="5" seq="99"><name>DND</name>
<item type="IS" id="5" seq="99"><name>dndFeature</name>
<label>DND Button on Device</label>
<default>On</default>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Do Not Disturb. Default is Off</help>
</item>
<item type="IS" id="8" seq="99"><name>directed_pickup</name> <label>Pickup/Gpickup</label>
<default>yes</default>
<default>on</default>
<option_hide class=".pickup_hide">no</option_hide>
<button value="yes">On</button>
<button value="no">Off</button>
<button value="on">On</button>
<button value="off">Off</button>
<help>Enable Pickup function to direct pickup an extension. Default is On</help>
</item>
<item type="IS" id="1" seq="99">
<name>conf_allow</name>
<label>Conference</label>
<default>yes</default>
<default>on</default>
<option_hide class=".conf_hide">no</option_hide>
<button value="yes">Yes</button>
<button value="no">No</button>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Allow the use of conference</help>
</item>
</page_group>
@ -827,9 +827,9 @@ and open the template in the editor. Base Version before all crash :-)
<help>Context where direct pickup search for extensions. if not set current contect will be use.</help>
</item>
<item type="IS" id="9" seq="99"><name>directed_pickup_modeanswer</name> <label>Mode Answer</label>
<default>yes</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>On (Default)= the call has been answered when picked up. Off = call manager way, the phone who picked up the call rings the call</help>
<help-disables>Options: 'Immediate Answer' or 'Show CallerID' ??????</help-disables>
</item>
@ -838,13 +838,13 @@ and open the template in the editor. Base Version before all crash :-)
<page_group name="sccp_hw_dev_advance"><label>Device Properies</label>
<item type="IS" id="4" seq="99"><name>useRedialMenu</name>
<label>Redial using Phonebook</label>
<default>no</default>
<button value="yes">On</button>
<button value="no">Off</button>
<default>off</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>You can specifying 'useRedialMenu = yes' in the sccp.conf device section and the redial softkey will cause the "placed calls" list instead of immediately calling the last dialed number.</help>
</item>
<item type="IS" id="6" seq="99">
<item type="IS-disabled" id="6" seq="99">
<name>dtmfmode</name>
<label>Dual-Tone Multi-Frequency (DTMF)</label>
<default>outofband</default>
@ -871,33 +871,33 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="2" seq="99">
<name>conf_play_general_announce</name>
<label>Playback Conference Anncouncements</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>on</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Playback General Announcements (like: 'You are Entering/Leaving the conference')</help>
</item>
<item type="IS" id="3" seq="99">
<name>conf_play_part_announce</name>
<label>Playback Participant Anncouncements</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>on</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Playback Personal/Participant Announcements, (like: 'You have been muted / You have been kicked')</help>
</item>
<item type="IS" id="4" seq="99">
<name>conf_mute_on_entry</name>
<label>Start Muted</label>
<default>no</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Mute new participants from the start</help>
</item>
<item type="IS" id="5" seq="99">
<name>conf_show_conflist</name>
<label>Show conference list</label>
<default>yes</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<default>on</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Automatically show conference list to the moderator</help>
</item>
<item type="SLM" id="6" seq="99"><label>Music On Hold Class</label>
@ -916,8 +916,8 @@ and open the template in the editor. Base Version before all crash :-)
<label>Alow Networks / Mask</label>
<name>permit</name>
<default>/</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/> </input>
<button>Add Alow network</button>
<help>Alow network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
</item>
@ -926,16 +926,16 @@ and open the template in the editor. Base Version before all crash :-)
<label>Deny Networks / Mask</label>
<name>deny</name>
<default>/</default>
<input value="none" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="none" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="net" nameseparator="/"><options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<input value="NONE" field="mask"><options placeholder="255.255.255.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/><class></class></input>
<button>Add Deny network</button>
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
</item>
<item type="IS" id="3" seq="99">
<name>nat</name>
<label>NAT</label>
<default>none</default>
<button value="none">Auto</button>
<default>auto</default>
<button value="auto">Auto</button>
<button value="off">Off</button>
<button value="on">On</button>
<help>Device NAT support (default Auto)</help>
@ -944,8 +944,8 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="4" seq="99">
<name>directrtp</name>
<label>Direct RTP</label>
<default>none</default>
<button value="none">Auto</button>
<default>NONE</default>
<button value="NONE">Auto</button>
<button value="off">Off</button>
<button value="on">On</button>
<help>This option allow devices to do direct RTP sessions (default Off)</help>
@ -954,13 +954,13 @@ and open the template in the editor. Base Version before all crash :-)
<name>earlyrtp</name>
<label>Early RTP</label>
<default>none</default>
<button value="none">Progress</button>
<button value="offhook">Offhook</button>
<button-d value="immediate">Immediate</button-d>
<button value="dial">Dial</button>
<button value="offhook">Offhook</button>
<button value="dialing">Dial</button>
<button value="ringout">Ringout</button>
<button value="None">None</button>
<help>The audio strem will be open in the progress and connected state. Valid options: none, progress, offhook, dial, ringout. Default may be Progress.</help>
<button value="progress">Progress</button>
<button value="none">None</button>
<help>The audio strem will be open in the progress and connected state. Valid options: NONE, progress, offhook, dial, ringout. Default may be Progress.</help>
</item>
</page_group>
<page_group name="sccp_dp_new_template">
@ -1004,11 +1004,11 @@ and open the template in the editor. Base Version before all crash :-)
<name>dialtemplate</name>
<default>*/10/*</default>
<element1 type="title" field="title"><options class="form-control control-label"/>title</element1>
<element type="input" value="none" field="match" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Pattern to match"/></element>
<element type="number" value="none" field="timeout" display_prefix="[" display_sufix="]"><options min="0" max="30" class="form-control dpt-title" placeholder="Time wait" /></element>
<element type="input" value="NONE" field="match" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Pattern to match"/></element>
<element type="number" value="NONE" field="timeout" display_prefix="[" display_sufix="]"><options min="0" max="30" class="form-control dpt-title" placeholder="Time wait" /></element>
<element1 type="label" field="label1"><options class="form-control control-label"/>text1</element1>
<element type="input" value="none" field="rewrite" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Rewrite the matched"/></element>
<element type="select" value="none" field="tone">
<element type="input" value="NONE" field="rewrite" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Rewrite the matched"/></element>
<element type="select" value="NONE" field="tone">
<options class="form-control dpt-title" />
<data>empty</data>
<data>Bellcore-Alerting</data>

View file

@ -41,6 +41,7 @@ function astman_retrieveJSFromMetaData($astman, $segment = "") {
}
}
function Get_DB_config($sccp_comatable) {
$db_config_v0 = array(
'sccpdevmodel' => array(
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
@ -94,7 +95,7 @@ $db_config_v0 = array(
)
);
$db_config_v3 = array(
$db_config_v5 = array(
'sccpdevmodel' => array(
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
@ -161,13 +162,98 @@ $db_config_v3 = array(
)
);
$db_config_v3 = array(
'sccpdevmodel' => array(
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
),
'sccpdevice' => array(
'pickupexten' => array('rename' => "directed_pickup"),
'directed_pickup' => array('create' => " enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'pickupcontext' => array('rename' => "directed_pickup_context"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickupmodeanswer' => array('rename' => "directed_pickup_modeanswer"),
'directed_pickup_modeanswer' => array('create' => "VARCHAR(5) NULL DEFAULT 'yes'"),
'hwlang' => array('rename' => "_hwlang"),
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
'dtmfmode' => array('drop' => "yes"),
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'cfwdall' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'cfwdbusy' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'directrtp' =>array('create' => "enum('on','off') NULL default 'off'",'modify' => "enum('on','off')"),
'dndFeature' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'earlyrtp' =>array('create' => "enum('immediate','offHook','dialing','ringout','progress','none') NOT NULL default 'progress'",'modify' => "enum('immediate','offHook','dialing','ringout','progress','none')"),
'audio_tos'=>array('def_modify' => "0xB8"),
'audio_cos'=>array('def_modify' => "6"),
'video_tos'=>array('def_modify' => "0x88"),
'video_cos'=>array('def_modify' => "5"),
'trustphoneip'=>array('drop' => "yes"),
'mwilamp' =>array('create' => "enum('on','off','wink','flash','blink') default 'on'",'modify' => "enum('on','off','wink','flash','blink')"),
'mwioncall' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'private' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'privacy' =>array('create' => "enum('full','on','off') NOT NULL default 'full'",'modify' => "enum('full','on','off')"),
'nat' =>array('create' => "enum('on','off','auto') NOT NULL default 'auto'",'modify' => "enum('on','off','auto')"),
'conf_allow' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'conf_play_part_announce' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'conf_mute_on_entry' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'conf_show_conflist' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'type' =>array('create' => 'VARCHAR(15) NULL DEFAULT NULL','modify' => "VARCHAR(15)"),
'imageversion' =>array('create' => 'VARCHAR(31) NULL DEFAULT NULL','modify' => "VARCHAR(31)"),
'softkeyset' =>array('def_modify' => "softkeyset")
),
'sccpline' => array(
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'rtptos' => array('drop' => "yes"),
'audio_tos' => array('drop' => "yes"),
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'incominglimit' =>array('def_modify' => "2"),
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'vmnum' =>array('def_modify' => "*97"),
'musicclass' =>array('def_modify' => "default"),
'id' =>array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)",'index' =>'id'),
// 'id' =>array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' =>"NULL"),
'echocancel' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'silencesuppression' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' =>"reject")
)
);
if ($sccp_comatable >= 11) {
return $db_config_v3;
} else {
return $db_config_v0;
}
}
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
$table_req = array('sccpdevice', 'sccpline', 'buttonconfig');
$ss = FreePBX::create()->Sccp_manager;
$astman = FreePBX::create()->astman;
$sccp_ver = 0;
$db_config = $db_config_v0;
$sccp_comatable = 0;
//$db_config = $db_config_v0;
$db_config = '';
function CheckSCCPManagerDBTables($table_req) {
global $db;
@ -210,69 +296,16 @@ function CheckAsteriskVersion() {
return $ver_compatible;
}
function CheckChanSCCPVersion() {
global $db_config, $db_config_v0, $db_config_v3, $srvinterface,$astman;
function CheckChanSCCPСomatable() {
global $srvinterface,$astman;
if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
}
$sccp_ver = $srvinterface->get_comatable_sccp();
outn("<li>" . _("Sccp model Version : ") . $sccp_ver . "</li>");
if ($sccp_ver >= 11) {
$db_config = $db_config_v3;
} else {
$db_config = $db_config_v0;
}
return $sccp_ver;
$sccp_comatable = $srvinterface->get_comatable_sccp();
outn("<li>" . _("Sccp model Compatable code : ") . $sccp_comatable . "</li>");
return $sccp_comatable;
}
/*
function CheckChanSCCPVersion() {
global $db_config, $db_config_v0, $db_config_v3, $astman;
if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
}
$metadata = astman_retrieveJSFromMetaData($astman, "");
// example metadata:
// {"Name":"Chan-sccp-b","Branch":"develop","Version":"4.3.0","RevisionHash":"d3f4482","RevisionNum":"10403","Tag":"v4.2.3-574-gd3f44824","VersioningType":"git","ConfigRevision":"0",
// "ConfigureEnabled": ["park","pickup","realtime","video","conferenence","dirtrfr","feature_monitor","functions","manager_events","devstate_feature","dynamic_speeddial","dynamic_speeddial_cid","experimental","debug"],
// "Segments":["general","device","line","softkey"]}
if ($metadata && array_key_exists("Version",$metadata)) {
$version_parts=explode(".", $metadata["Version"]);
# not sure about this sccp_ver numbering. Might be better to just check "Version" and Revision
if ($version_parts[0] == "4") {
$sccp_ver = 400;
$db_config = $db_config_v0;
if ($version_parts[1] == "1") {
$sccp_ver = 410;
} else
if ($version_parts[1] == "2") {
$sccp_ver = 420;
} else
if ($version_parts[1] >= "3") {
$sccp_ver = 430;
}
}
if (array_key_exists("Revision",$metadata)) { // old method
if (base_convert($metadata["Revision"],16,10) == base_convert('702487a',16,10)) { // hash values are random, not incrementa
$sccp_ver = 431;
$db_config = $db_config_v3;
}
}
if (array_key_exists("RevisionNum",$metadata)) {
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
$sccp_ver = 432;
$db_config = $db_config_v3;
}
}
} else {
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
}
outn("<li>" . _("Sccp Version : ") . $sccp_ver . "</li>");
return $sccp_ver;
}
*/
function InstallDB_sccpsettings() {
global $db;
@ -313,11 +346,55 @@ function InstallDB_sccpdevmodel() {
return true;
}
/*
function InstallDB_updateEnums($db_config) {
global $db;
if (!$db_config) {
die_freepbx("No db_config provided");
}
$count_modify = 0;
outn("<li>" . _("Update Database Enums") . "</li>");
foreach ($db_config as $tabl_name => &$tab_modify) {
$sql = "";
$sql_r = array();
foreach ($tab_modify as $row_fld => $row_data){
if (!empty($row_data['crate'])) {
if (strpos($row_data['crate'], 'enum') !== false) {
$sql_r[] = $row_fld;
}
}
}
$sql = "SELECT " . implode(',', $sql_r) . " from ".$tabl_name;
$db_result= $db->getAll($sql);
if (DB::IsError($db_result)) {
die_freepbx("Can not add get informations from ".$tabl_name." table\n");
}
$sql_table = '';
$enum_data = array('true'=>'on','false'=>'off','yes'=>'on','no'=>'off');
foreach ($db_result as $tabl_data){
$sql = "";
foreach( $tabl_data as $row => $col_val){
$val= strtolower($col_val);
if (isset($enum_data[$val])) {
$sql .= $row.'="'.$enum_data[$val].'",';
}
}
if (!empty($sql)){
}
}
}
}
*/
function InstallDB_updateSchema($db_config) {
global $db;
if (!$db_config) {
die_freepbx("No db_config provided");
}
$count_modify = 0;
outn("<li>" . _("Modify Database schema") . "</li>");
foreach ($db_config as $tabl_name => &$tab_modify) {
// 0 - name 1-type 4- default
@ -334,6 +411,8 @@ function InstallDB_updateSchema($db_config) {
if (strtoupper($tab_modify[$fld_id]['def_modify']) == strtoupper($tabl_data[4])) {
$db_config[$tabl_name][$fld_id]['def_mod_stat'] = 'no';
}
}
if (!empty($tab_modify[$fld_id]['modify'])) {
if ( strtoupper ($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) {
$db_config[$tabl_name][$fld_id]['mod_stat'] = 'no';
}
@ -352,11 +431,12 @@ function InstallDB_updateSchema($db_config) {
if (empty($row_data['status'])) {
if (!empty($row_data['create'])) {
$sql_create .='ADD COLUMN `'.$row_fld.'` '. $row_data['create'].', ';
$count_modify ++;
}
} else {
if (!empty($row_data['rename'])) {
$sql_modify .= 'CHANGE COLUMN `'.$row_fld.'` `'. $row_data['rename'].'` '.$row_data['create'].', ';
$count_modify ++;
}
if (!empty($row_data['modify'])) {
if (empty($row_data['mod_stat'])) {
@ -366,15 +446,18 @@ function InstallDB_updateSchema($db_config) {
$sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', ";
}
$row_data['def_mod_stat'] = 'no';
$count_modify ++;
}
}
if (!empty($row_data['def_modify'])) {
if (empty($row_data['def_mod_stat'])) {
$sql_modify .= "ALTER COLUMN `".$row_fld."` SET DEFAULT '".$row_data['def_modify']."', ";
$count_modify ++;
}
}
if (!empty($row_data['drop'])) {
$sql_create .='DROP COLUMN `'.$row_fld.'`, ';
$count_modify ++;
}
}
@ -397,6 +480,7 @@ function InstallDB_updateSchema($db_config) {
}
}
}
outn("<li>" . _("Modify count :") .$count_modify. "</li>");
return true;
}
@ -452,11 +536,11 @@ function InstallDB_createButtonConfigTrigger() {
return true;
}
function InstallDB_CreateSccpDeviceConfigView($sccp_ver) {
function InstallDB_CreateSccpDeviceConfigView($sccp_comatable) {
global $db;
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
$sql = "";
if ($sccp_ver < 430) {
if ($sccp_comatable < 11) {
$sql= "
CREATE OR REPLACE
ALGORITHM = MERGE
@ -501,14 +585,15 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_ver) {
CheckSCCPManagerDBTables($table_req);
CheckPermissions();
CheckAsteriskVersion();
$sccp_ver = CheckChanSCCPVersion();
$sccp_comatable = CheckChanSCCPСomatable();
$db_config = Get_DB_config($sccp_comatable);
InstallDB_sccpsettings();
InstallDB_sccpdevmodel();
InstallDB_updateSchema($db_config);
InstallDB_fillsccpdevmodel();
InstallDB_updateSccpDevice();
InstallDB_createButtonConfigTrigger();
InstallDB_CreateSccpDeviceConfigView($sccp_ver);
InstallDB_CreateSccpDeviceConfigView($sccp_comatable);
outn("<br>");
// $ss->save_submit($request);

View file

@ -207,7 +207,7 @@
return (value === '1') ? '<i class="fa fa-check-square-o" style="color:green" title="<?php echo _("Device is enabled")?>"></i>' : '<i class="fa fa-square-o" title="<?php echo _("Device is disabled")?>"></i>';
}
function DisplayDnsFormatter(value, row, index) {
var exp_model = ['Expansion Module', 'No awalable', 'One ExpModule', 'Tow ExpModule'];
var exp_model = ['Expansion Module', 'Not Available', 'One ExpModule', 'Two ExpModule'];
return exp_model[value];
}