bug fix 'inernal'

Pre-made support for ATA devices
This commit is contained in:
PhantomVl 2017-11-10 18:58:06 +03:00
parent 1ef2e443ee
commit e41476560c
6 changed files with 209 additions and 137 deletions

View file

@ -53,7 +53,10 @@
* - restore default Value on page
* - restore default Value on sccp.class
* - 'Device SEP ID.[XXXXXXXXXXXX]=MAC'
* - ATA's start with ATAXXXXXXXXXXXX.
* - ATA's start with ATAXXXXXXXXXXXX.
* - Create ATADefault.cnf.xml
* - Create Second line Use MAC AABBCCDDEEFF rotation MAC BBCCDDEEFF01 (ATA 187 )
* + Add SEP, ATA, VG prefix.
* - VG248 ports start with VGXXXXXXXXXXXX0.
* * I think this file should be split in 3 parts (as in Model-View-Controller(MVC))
* * XML/Database Parts -> Model directory
@ -518,7 +521,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
public function ajaxRequest($req, &$setting) {
switch ($req) {
case 'savesettings':
case 'savesettings':
case 'save_hardware':
case 'save_dialplan_template':
case 'delete_hardware':
@ -573,9 +576,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $this->save_hw_phone($request);
break;
/* !TODO!: -TODO-: dialplan templates should be removed (only required for very old devices (like ATA) */
/* !TODO!: -TODO-: dialplan templates should be removed (only required for very old devices (like ATA) */
// ------------------------------- Old deviece suport - In the development---
case 'save_dialplan_template':
case 'save_dialplan_template':
$res = $this->save_DialPlant($request);
if (empty($res)) {
return array('status' => true, 'search' => '?display=sccp_adv', 'hash' => 'sccpdialplan');
@ -599,8 +602,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case 'delete_hardware':
if (!empty($request['idn'])) {
foreach ($request['idn'] as $idv) {
$msg = strpos($idv, 'SEP-');
if (!(strpos($idv, 'SEP') === false)) {
// $msg = strpos($idv, 'SEP-');
if ($this->strpos_array($idv, array('SEP', 'ATA', 'VG')) !== false) {
$this->dbinterface->sccp_save_db('sccpdevice', array('name' => $idv), 'delete', "name");
$this->dbinterface->sccp_save_db("sccpbuttons", array(), 'delete', '', $idv);
$this->sccp_delete_device_XML($idv); // Концы в вводу !!
@ -821,7 +824,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break;
// ------------------------------- Old deviece suport - In the development---
case 'getDialTemplate':
$result = $this->get_DialPlanList();
$result = $this->get_DialPlanList();
if (empty($result)) {
$result = array();
}
@ -858,6 +861,16 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$db_field = $this->dbinterface->get_db_SccpTableData("get_colums_sccpdevice");
$hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid'];
$update_hw = ($hw_id == 'new') ? 'update' : 'clear';
$hw_prefix = 'SEP';
if (!empty($get_settings[$hdr_prefix . 'type'])) {
$value = $get_settings[$hdr_prefix . 'type'];
if (strpos($value, 'ATA') !== false) {
$hw_prefix = 'ATA';
}
if (strpos($value, 'VG') !== false) {
$hw_prefix = 'VG';
}
}
foreach ($db_field as $data) {
$key = (string) $data['Field'];
$value = "";
@ -865,8 +878,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case 'name':
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
$value = $get_settings[$hdr_prefix . 'mac'];
$value = 'SEP' . strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac Seporated from string
$value = strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac Seporated from string
$value = sprintf("%012s", $value);
if ($hw_prefix == 'VG') {
$value = $hw_prefix . $value.'0';
} else {
$value = $hw_prefix . $value;
}
$name_dev = $value;
}
break;
case 'disallow':
@ -900,6 +920,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$tmp_data .= $vval . '/';
}
if (strlen($tmp_data) > 2) {
if (substr($tmp_data,-1)=='/') {
$tmp_data = substr($tmp_data, 0, -1);
}
$arr_data .= substr($tmp_data, 0, -1) . ';';
}
}
@ -1110,118 +1133,120 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
return;
}
/*
function sccp_get_keysetdata($name) {
if ($name == 'default') {
$keysetData = sccp_get_confData('softkeyset');
$keysetData['name'] = 'default';
} else {
$keysetData = sccp_get_confData($name);
}
$keysetData['name'] = ($keysetData['name'] ? $keysetData['name'] : $name);
return $keysetData;
}
*/
/*
function sccp_edit_keyset($keysetData) {
global $amp_conf;
$key_name = array('onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat', 'onhint', 'onstealable');
$keysetImplode['name'] = $keysetData['name'];
$keysetImplode['type'] = $keysetData['type'];
$keysetImplode['file_context'] = $keysetData['file_context'];
foreach ($key_name as $i) {
if (isset($keysetData[$i])) {
$keysetImplode[$i] = implode(',', $keysetData[$i]);
}
}
//
// Write config file context section.
//
$file_context = $keysetData['name'];
if ($file_context != 'default') {
$confDir = $amp_conf["ASTETCDIR"];
// !TODO!: -TODO-: Can this actually happen, or does it mean amp_conf array is empty ?
if (strlen($confDir) < 1) {
$confDir = "/etc/asterisk";
}
$inputfile = $confDir."/sccp.conf";
if (!file_exists($inputfile)) {
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/sccp.conf');
file_put_contents($inputfile, $sccpfile);
}
$handle = fopen($inputfile, "r");
$file_context = "[".$file_context."]";
$sccpfile = '';
$conext_data = $file_context." ; Managed by sccp_manager\n";
$conext_data .= "type=softkeyset\n";
foreach ($keysetImplode as $field => $value) {
echo($field);
if ($field != 'type' && $field != 'name' && $field != 'file_context') {
echo($value);
if (strlen($value) > 1) {
$conext_data .= $field . "=" . $value . "\n";
}
}
}
$conext_data .= "\n";
$new_context = "1";
echo($file_context);
if ($handle) {
while (($input = fgets($handle)) != false) {
if (trim($input) != $file_context) {
// echo($input);
$sccpfile .= $input;
} else {
$new_context = "0";
$sccpfile .= $conext_data;
//
// We don't include the 'name=' directive in sccp.conf contexts.
// $sccpfile .= "name=".$keysetImplode['name']."\n";
//
$trimmer = true;
while ($trimmer) {
$trimmer = ($input = fgets($handle));
if (substr($input, 0, 1) == '[') {
$trimmer = false;
$sccpfile .= $input;
}
}
}
}
if ($new_context != "0") {
$sccpfile .= $conext_data;
}
}
}
file_put_contents($inputfile, $sccpfile);
return $sccpfile;
}
*/
/*
function sccp_display_keyset($keysetData, $softkey, $option) {
if ($keysetData['name'] == 'default') {
$output = "<font size='+1'>";
if (strpos(' ' . $keysetData[$softkey], $option)) {
$output .= '&#x2611;';
} else {
$output .= '&#x2610;';
}
$output .= "</font>&nbsp;$option<br>";
} else {
$output = "<input type='checkbox' name='keysetData[$softkey][]' value='$option'";
if (strpos(' ' . $keysetData[$softkey], $option)) {
$output .= ' checked';
}
$output .= "> $option<br>";
}
return $output;
}
*/
function sccp_get_keysetdata($name) {
if ($name == 'default') {
$keysetData = sccp_get_confData('softkeyset');
$keysetData['name'] = 'default';
} else {
$keysetData = sccp_get_confData($name);
}
$keysetData['name'] = ($keysetData['name'] ? $keysetData['name'] : $name);
return $keysetData;
}
*/
/*
function sccp_edit_keyset($keysetData) {
global $amp_conf;
$key_name = array('onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat', 'onhint', 'onstealable');
$keysetImplode['name'] = $keysetData['name'];
$keysetImplode['type'] = $keysetData['type'];
$keysetImplode['file_context'] = $keysetData['file_context'];
foreach ($key_name as $i) {
if (isset($keysetData[$i])) {
$keysetImplode[$i] = implode(',', $keysetData[$i]);
}
}
//
// Write config file context section.
//
$file_context = $keysetData['name'];
if ($file_context != 'default') {
$confDir = $amp_conf["ASTETCDIR"];
// !TODO!: -TODO-: Can this actually happen, or does it mean amp_conf array is empty ?
if (strlen($confDir) < 1) {
$confDir = "/etc/asterisk";
}
$inputfile = $confDir."/sccp.conf";
if (!file_exists($inputfile)) {
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/sccp.conf');
file_put_contents($inputfile, $sccpfile);
}
$handle = fopen($inputfile, "r");
$file_context = "[".$file_context."]";
$sccpfile = '';
$conext_data = $file_context." ; Managed by sccp_manager\n";
$conext_data .= "type=softkeyset\n";
foreach ($keysetImplode as $field => $value) {
echo($field);
if ($field != 'type' && $field != 'name' && $field != 'file_context') {
echo($value);
if (strlen($value) > 1) {
$conext_data .= $field . "=" . $value . "\n";
}
}
}
$conext_data .= "\n";
$new_context = "1";
echo($file_context);
if ($handle) {
while (($input = fgets($handle)) != false) {
if (trim($input) != $file_context) {
// echo($input);
$sccpfile .= $input;
} else {
$new_context = "0";
$sccpfile .= $conext_data;
//
// We don't include the 'name=' directive in sccp.conf contexts.
// $sccpfile .= "name=".$keysetImplode['name']."\n";
//
$trimmer = true;
while ($trimmer) {
$trimmer = ($input = fgets($handle));
if (substr($input, 0, 1) == '[') {
$trimmer = false;
$sccpfile .= $input;
}
}
}
}
if ($new_context != "0") {
$sccpfile .= $conext_data;
}
}
}
file_put_contents($inputfile, $sccpfile);
return $sccpfile;
}
*/
/*
function sccp_display_keyset($keysetData, $softkey, $option) {
if ($keysetData['name'] == 'default') {
$output = "<font size='+1'>";
if (strpos(' ' . $keysetData[$softkey], $option)) {
$output .= '&#x2611;';
} else {
$output .= '&#x2610;';
}
$output .= "</font>&nbsp;$option<br>";
} else {
$output = "<input type='checkbox' name='keysetData[$softkey][]' value='$option'";
if (strpos(' ' . $keysetData[$softkey], $option)) {
$output .= ' checked';
}
$output .= "> $option<br>";
}
return $output;
}
*/
public function getMyConfig($var = null, $id = "noid") {
// $final = false;
switch ($var) {
@ -1440,6 +1465,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
/*
* Check file paths and permissions
*/
// !TODO!: -TODO-: This function is getting a little big. Might be possible to sperate tftp work into it's own file/class. Initially, you need to remove the not working section and commented out section
function init_sccp_path() {
@ -1554,6 +1580,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
* DialPlan
*
*/
function get_DialPlanList() {
$dir = $this->sccppath["tftp_DP"] . '/*.xml';
$base_len = strlen($this->sccppath["tftp_DP"]) + 1;
@ -2026,6 +2053,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if ($dev_id == 'all') {
$xml_name = $this->sccppath["tftp_path"] . '/SEP*.cnf.xml';
array_map("unlink", glob($xml_name));
$xml_name = $this->sccppath["tftp_path"] . '/ATA*.cnf.xml';
array_map("unlink", glob($xml_name));
$xml_name = $this->sccppath["tftp_path"] . '/VG*.cnf.xml';
array_map("unlink", glob($xml_name));
} else {
if (!strpos($dev_id, 'SEP')) {
return false;
@ -2171,4 +2202,21 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// $dom = dom_import_simplexml($node);
// $dom->parentNode->removeChild($dom);
// }
private function strpos_array($haystack, $needles) {
if (is_array($needles)) {
foreach ($needles as $str) {
if (is_array($str)) {
$pos = strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
return FALSE;
}
}

View file

@ -266,7 +266,8 @@ class xmlinterface {
$xml_work->$key = time();
break;
case 'loadInformation':
$xml_work->$key = $dev_config["loadimage"];
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
// $xml_work->$key = $dev_config["loadimage"];
if (!empty($dev_config['addon'])) {
$xnode = $xml_work->addChild('addOnModules');
$ti = 1;

View file

@ -108,7 +108,7 @@ and open the template in the editor. Base Version before all crash :-)
<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>
<help>Alow network settings. Blank fields will be ignored used Network 0.0.0.0/0.0.0.0 to resolve any existing connections. You can use the 'internal' connections only from the networks connected to the server. </help>
</item>
<item type="IED" id="2" seq="0">

View file

@ -6,21 +6,22 @@
* and open the template in the editor.
*/
/*
function removeSimpleXmlNode($node)
{
$dom = dom_import_simplexml($node);
$dom->parentNode->removeChild($dom);
}
function removeSimpleXmlNode($node)
{
$dom = dom_import_simplexml($node);
$dom->parentNode->removeChild($dom);
}
function replaceSimpleXmlNode($xml, SimpleXMLElement $element) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),TRUE
);
$dom->parentNode->replaceChild($import, $dom);
}
function replaceSimpleXmlNode($xml, SimpleXMLElement $element) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
dom_import_simplexml($element),TRUE
);
$dom->parentNode->replaceChild($import, $dom);
}
*/
function after($this, $inthat) {
if (!is_bool(strpos($inthat, $this)))
return substr($inthat, strpos($inthat, $this) + strlen($this));
@ -55,5 +56,22 @@ function strrevpos($instr, $needle) {
return strlen($instr) - $rev_pos - strlen($needle);
}
function strpos_array($haystack, $needles) {
if (is_array($needles)) {
foreach ($needles as $str) {
if (is_array($str)) {
$pos = strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
return FALSE;
}
?>

View file

@ -433,8 +433,13 @@ function InstallDB_fillsccpdevmodel() {
"('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL), ('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL), ('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL), ('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL), ('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, ''), ('6901', 'CISCO', 1, 0, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL), ('6911', 'CISCO', 1, 0, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL), ('6921', 'CISCO', 1, 0, 'SCCP69xx.9-2-1-0', 'loadInformation496', 0, NULL), ('6941', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation495', 0, NULL), ('6945', 'CISCO', 1, 0, 'SCCP6945.9-2-1-0', 'loadInformation564', 0, NULL), ('6961', 'CISCO', 1, 0, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL), ('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL), " .
"('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL), ('7906', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7910', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7911', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL), ('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL),('7914,7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL), ('7915', 'CISCO', 0, 24, 'B015-1-0-4', 'loadInformation227', 1, NULL), ('7915,7915', 'CISCO', 0, 48, 'B015-1-0-4', 'loadInformation228', 1, NULL), ('7916', 'CISCO', 0, 24, 'B015-1-0-4', 'loadInformation229', 1, NULL), " .
"('7916,7916', 'CISCO', 0, 48, 'B016-1-0-4', 'loadInformation230', 1, NULL), ('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL), ('7921', 'CISCO', 1, 1, 'CP7921G-1.4.1SR1', 'loadInformation365', 0, NULL),('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, NULL), ('7926', 'CISCO', 1, 1, 'CP7926G-1.4.1SR1', 'loadInformation557', 0, NULL), ('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL), ('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL), ('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL), ('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-4-0', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'), ('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_796x_template'), " .
"('7941', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7942', 'CISCO', 1, 2, 'SCCP42.9-2-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7945', 'CISCO', 1, 2, 'SCCP45.9-2-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_796x_template'), ('7961', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7962', 'CISCO', 3, 6, 'SCCP42.9-2-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7965', 'CISCO', 3, 6, 'SCCP45.9-2-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7970', 'CISCO', 3, 8, 'SCCP70.9-2-1S', 'loadInformation30006', 0, NULL), ('7971', 'CISCO', 1, 2, 'SCCP75.9-2-1S', 'loadInformation119', 0, NULL), ('7975', 'CISCO', 3, 8, 'SCCP75.9-2-1S', 'loadInformation437', 0, NULL), ('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL), ('8941', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation586', 0, NULL), ('8945', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation585', 0, NULL), ('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, NULL), ('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, NULL), ('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL), ('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL), ('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL), ('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL), ('ICC', 'NOKIA', 1, 1, '', '', 0, NULL), " .
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 0, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
"('7941', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7942', 'CISCO', 1, 2, 'SCCP42.9-2-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7945', 'CISCO', 1, 2, 'SCCP45.9-2-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_796x_template'), ('7961', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7962', 'CISCO', 3, 6, 'SCCP42.9-2-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7965', 'CISCO', 3, 6, 'SCCP45.9-2-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7970', 'CISCO', 3, 8, 'SCCP70.9-2-1S', 'loadInformation30006', 0, NULL), ('7971', 'CISCO', 1, 2, 'SCCP75.9-2-1S', 'loadInformation119', 0, NULL), ('7975', 'CISCO', 3, 8, 'SCCP75.9-2-1S', 'loadInformation437', 0, NULL), ('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL), ('8941', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation586', 0, NULL), ('8945', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation585', 0, NULL), ('ATA 186', 'CISCO', 1, 2, 'ATA030204SCCP090202A', 'loadInformation12', 0, NULL), ('ATA 187', 'CISCO', 1, 2, 'ATA187.9-2-3-1', 'loadInformation550', 0, NULL), ('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL), ('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL), ('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL), ('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL), ('ICC', 'NOKIA', 1, 1, '', '', 0, NULL), " .
"('Analog Access', 'CISCO', 1, 1, 'A001C030', 'loadInformation30', 0, ''),('WS-X6608', 'CISCO', 1, 1, 'D00404000032', 'loadInformation43', 0, ''), ('WS-X6624', 'CISCO', 1, 1, 'A00204000013', 'loadInformation43', 0, ''), ('WS-X6608', 'CISCO', 1, 1, 'C00104000003', 'loadInformation51', 0, ''), ('H.323 Phone', 'CISCO', 1, 1, '', 'loadInformation61', 0, ''), ('Simulator', 'CISCO', 1, 1, '', 'loadInformation100', 0, ''), ('MTP', 'CISCO', 1, 1, '', 'loadInformation111', 0, ''), ('MGCP Station', 'CISCO', 1, 1, '', 'loadInformation120', 0, ''), ('MGCP Trunk', 'CISCO', 1, 1, '', 'loadInformation121', 0, ''), ('UPC', 'CISCO', 1, 1, '', 'loadInformation358', 0, ''), ".
"('TelePresence', 'TELEPRESENCE', 1, 1, '', 'loadInformation375', 0, ''), ('1000', 'TELEPRESENCE', 1, 1, '', 'loadInformation478', 0, ''), ('3000', 'TELEPRESENCE', 1, 1, '', 'loadInformation479', 0, ''), ('3200', 'TELEPRESENCE', 1, 1, '', 'loadInformation480', 0, ''), ('500-37', 'TELEPRESENCE', 1, 1, '', 'loadInformation481', 0, ''), ('1300-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation505', 0, ''), ('1100', 'TELEPRESENCE', 1, 1, '', 'loadInformation520', 0, ''), ('200', 'TELEPRESENCE', 1, 1, '', 'loadInformation557', 0, ''), ('400', 'TELEPRESENCE', 1, 1, '', 'loadInformation558', 0, ''), ('EX90', 'TELEPRESENCE', 1, 1, '', 'loadInformation584', 0, ''), ('500-32', 'TELEPRESENCE', 1, 1, '', 'loadInformation590', 0, ''), ('1300-47', 'TELEPRESENCE', 1, 1, '', 'loadInformation591', 0, ''), ('TX1310-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation596', 0, ''), ('EX60', 'TELEPRESENCE', 1, 1, '', 'loadInformation604', 0, ''), ('C90', 'TELEPRESENCE', 1, 1, '', 'loadInformation606', 0, ''), ('C60', 'TELEPRESENCE', 1, 1, '', 'loadInformation607', 0, ''), ('C40', 'TELEPRESENCE', 1, 1, '', 'loadInformation608', 0, ''), ('C20', 'TELEPRESENCE', 1, 1, '', 'loadInformation609', 0, ''), ('C20-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation610', 0, ''), ('C60-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation611', 0, ''), ('C40-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation612', 0, ''), ('C60-52', 'TELEPRESENCE', 1, 1, '', 'loadInformation613', 0, ''), ('C60-52D', 'TELEPRESENCE', 1, 1, '', 'loadInformation614', 0, ''),('C60-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation615', 0, ''), ('C90-65', 'TELEPRESENCE', 1, 1, '', 'loadInformation616', 0, ''), ('MX200', 'TELEPRESENCE', 1, 1, '', 'loadInformation617', 0, ''), ('TX9000', 'TELEPRESENCE', 1, 1, '', 'loadInformation619', 0, ''), ('TX9200', 'TELEPRESENCE', 1, 1, '', 'loadInformation620', 0, ''), ('SX20', 'TELEPRESENCE', 1, 1, '', 'loadInformation626', 0, ''), ('MX300', 'TELEPRESENCE', 1, 1, '', 'loadInformation627', 0, ''), ('C40-42', 'TELEPRESENCE', 1, 1, '', 'loadInformation633', 0, ''), ('Jabber', 'CISCO', 1, 1, '', 'loadInformation652', 0, ''), ".
"('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, ''), ('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, ''), ('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, ''), ('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, ''), ('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, ''), ('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, ''), ('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, ''), ('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, ''), ('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, ''), ('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, ''), ('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, ''), ('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, ''), ('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, ''), ('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, ''), ('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, ''), ".
"('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, ''), ('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, ''), ('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, ''), ('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, ''), ".
"('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, ''), ('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, ''), ('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, ''), ('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, ''), ('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, ''), ('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, ''),".
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
$check = $db->query($sql);
if (db::IsError($check)) {
die_freepbx("Can not create sccpdevmodel table, error:$check\n");

View file

@ -9,7 +9,7 @@ $dev_id = null;
$dev_new = null;
if (!empty($_REQUEST['new_id'])) {
$dev_id = $_REQUEST['new_id'];
$val = str_replace('SEP', '', $dev_id);
$val = str_replace(array('SEP','ATA','VG'), '', $dev_id);
$val = implode('.',sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
$def_val['mac'] = array("keyword" => 'mac', "data" => $val, "seq" => "99");
$val = $_REQUEST['type'];
@ -28,7 +28,7 @@ if (!empty($_REQUEST['id'])) {
switch ($key) {
case 'name':
$key = 'mac';
$val = str_replace('SEP', '', $val);
$val = str_replace(array('SEP','ATA','VG'), '', $val);
$val = implode('.',sscanf($val, '%4s%4s%4s')); // Convert to Cisco display Format
break;
case '_hwlang':