From 5e7bdbe40b8d87a5c343df155ea1bdcbc33231d7 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Wed, 16 Jun 2021 07:05:40 +0200 Subject: [PATCH 01/11] Revert Settings Changes Move changes to new version 14.2 --- Sccp_manager.class.php | 5 ++--- views/form.adddevice.php | 1 - views/formShow.php | 5 ----- views/server.advanced.php | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index cb57a78..4be5dab 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -173,7 +173,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { * Generate Input elements in Html Code from sccpgeneral.xml */ - public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = null, $show_inherit = true) { + public function showGroup($group_name, $show_Header, $form_prefix = 'sccp', $form_values = null) { $htmlret = ""; if (empty($form_values)) { $form_values = $this->sccpvalues; @@ -186,8 +186,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { 'form_prefix' => $form_prefix, 'fvalues' => $form_values, 'tftp_lang' => $this->tftpLang, - 'metainfo' => $this->sccp_metainfo, - 'inherit' => $show_inherit + 'metainfo' => $this->sccp_metainfo ) ); } diff --git a/views/form.adddevice.php b/views/form.adddevice.php index 09bb2dc..ecf10cd 100644 --- a/views/form.adddevice.php +++ b/views/form.adddevice.php @@ -117,7 +117,6 @@ if (!empty($device_warning)) { echo $this->showGroup('sccp_hw_dev_softkey', 1, 'sccp_hw', $def_val); // echo $this->showGroup('sccp_hw_dev_pickup', 1, 'sccp_hw', $def_val); This are line properties and does not exist! echo $this->showGroup('sccp_hw_dev_conference', 1, 'sccp_hw', $def_val); - echo $this->showGroup('sccp_dev_vendor_conf', 1, 'sccp_hw', $def_val, true); echo $this->showGroup('sccp_hw_dev_network', 1, 'sccp_hw', $def_val); ?> diff --git a/views/formShow.php b/views/formShow.php index 9ed3fd8..66e9fdf 100644 --- a/views/formShow.php +++ b/views/formShow.php @@ -376,11 +376,6 @@ foreach ($items as $child) { $opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" '; } foreach ($child->xpath('button') as $value) { - if (!$inherit) { - if ($value == 'Inherit') { - continue; - } - } $val_check = strtolower((string)$value[@value]); if ($val_check == strtolower($res_v)) { $val_check = " checked"; diff --git a/views/server.advanced.php b/views/server.advanced.php index 0bb48bd..61cf630 100644 --- a/views/server.advanced.php +++ b/views/server.advanced.php @@ -13,7 +13,7 @@ showGroup('sccp_srst', 1); - echo $this->showGroup('sccp_dev_vendor_conf', 1,'sccp',null,false); + echo $this->showGroup('sccp_dev_vendor_conf', 1); // echo $this->showGroup('sccp_dev_time',1); ?> From 218e1c66ee4a68a80749010c2c3b50555736b22f Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Wed, 16 Jun 2021 09:28:47 +0200 Subject: [PATCH 02/11] Clean Installer Remove unused functions Remove unused cases Remove duplicate code --- install.php | 124 ++++++++++++---------------------------------------- 1 file changed, 27 insertions(+), 97 deletions(-) diff --git a/install.php b/install.php index 6f73ae7..812467a 100644 --- a/install.php +++ b/install.php @@ -56,11 +56,6 @@ if ($result[0]['IsEmpty']) { outn("Populating sccpdevmodel..."); InstallDB_fillsccpdevmodel(); } -if (!$sccp_db_ver) { - InstallDB_updateSccpDevice(); -} else { - outn("Skip update Device model"); -} InstallDB_createButtonConfigTrigger(); InstallDB_CreateSccpDeviceConfigView($sccp_compatible); @@ -94,17 +89,14 @@ function Get_DB_config($sccp_compatible) 'directed_pickup_modeanswer' => array('drop' => "yes"), 'pickupmodeanswer' => array('drop' => "yes"), 'disallow' => array('drop' => "yes"), - 'disallow' => array('drop' => "yes"), 'callhistory_answered_elsewhere' => array('create' => "enum('Ignore','Missed Calls','Received Calls', 'Placed Calls') NOT NULL default 'Ignore'", 'modify' => "enum('Ignore','Missed Calls','Received Calls','Placed Calls')"), - 'description' => array('rename' => "_description"), 'hwlang' => array('rename' => "_hwlang"), '_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'), '_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'), '_profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0' AFTER `_loginname`"), '_dialrules' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `_profileid`"), - 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_dialrules`"), 'dtmfmode' => array('drop' => "yes"), 'force_dtmfmode' => array('create' => "ENUM('auto','rfc2833','skinny') NOT NULL default 'auto'", @@ -553,17 +545,6 @@ function InstallDB_fillsccpdevmodel() return true; } -function InstallDB_updateSccpDevice() -{ - global $db; - outn("
  • " . _("Update sccpdevice") . "
  • "); - $sql = "UPDATE `sccpdevice` set audio_tos='0xB8',audio_cos='6',video_tos='0x88',video_cos='5' where audio_tos=NULL or audio_tos='';"; - $check = $db->query($sql); - if (DB::IsError($check)) { - die_freepbx("Can not REPLACE defaults into sccpdevice table\n"); - } -} - function InstallDB_createButtonConfigTrigger() { global $db; @@ -615,93 +596,42 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) { global $db; outn("
  • " . _("(Re)Create sccpdeviceconfig view") . "
  • "); - $sql = ""; - if ($sccp_compatible < 431) { - $sql = "CREATE OR REPLACE + $sql = "DROP VIEW IF EXISTS sccpdeviceconfig; + DROP VIEW IF EXISTS sccpuserconfig;"; + + global $mobile_hw; + if ($mobile_hw == '1') { + $sql .= "CREATE OR REPLACE ALGORITHM = MERGE VIEW sccpdeviceconfig AS - SELECT GROUP_CONCAT( CONCAT_WS( ',', buttonconfig.type, buttonconfig.name, buttonconfig.options ) - ORDER BY instance ASC - SEPARATOR ';' ) AS button, - sccpdevice.type AS type, - sccpdevice.addon AS addon, - sccpdevice.description AS description, - sccpdevice.tzoffset AS tzoffset, - sccpdevice.transfer AS transfer, - sccpdevice.cfwdall AS cfwdall, - sccpdevice.cfwdbusy AS cfwdbusy, - sccpdevice.imageversion AS imageversion, - sccpdevice.deny AS deny, - sccpdevice.permit AS permit, - sccpdevice.dndFeature AS dndFeature, - sccpdevice.directrtp AS directrtp, - sccpdevice.earlyrtp AS earlyrtp, - sccpdevice.mwilamp AS mwilamp, - sccpdevice.mwioncall AS mwioncall, - sccpdevice.pickupexten AS pickupexten, - sccpdevice.pickupcontext AS pickupcontext, - sccpdevice.pickupmodeanswer AS pickupmodeanswer, - sccpdevice.private AS private, - sccpdevice.privacy AS privacy, - sccpdevice.nat AS nat, - sccpdevice.softkeyset AS softkeyset, - sccpdevice.audio_tos AS audio_tos, - sccpdevice.audio_cos AS audio_cos, - sccpdevice.video_tos AS video_tos, - sccpdevice.video_cos AS video_cos, - sccpdevice.conf_allow AS conf_allow, - sccpdevice.conf_play_general_announce AS conf_play_general_announce, - sccpdevice.conf_play_part_announce AS conf_play_part_announce, - sccpdevice.conf_mute_on_entry AS conf_mute_on_entry, - sccpdevice.conf_music_on_hold_class AS conf_music_on_hold_class, - sccpdevice.conf_show_conflist AS conf_show_conflist, - sccpdevice.setvar AS setvar, - sccpdevice.disallow AS disallow, - sccpdevice.allow AS allow, - sccpdevice.backgroundImage AS backgroundImage, - sccpdevice.ringtone AS ringtone, - sccpdevice.name AS name + SELECT GROUP_CONCAT( CONCAT_WS( ',', sccpbuttonconfig.buttontype, sccpbuttonconfig.name, sccpbuttonconfig.options ) + ORDER BY instance ASC SEPARATOR ';' ) AS sccpbutton, sccpdevice.* FROM sccpdevice - LEFT JOIN sccpbuttonconfig buttonconfig ON ( buttonconfig.device = sccpdevice.name ) - GROUP BY sccpdevice.name;"; + LEFT JOIN sccpbuttonconfig ON (sccpbuttonconfig.reftype = 'sccpdevice' AND sccpbuttonconfig.ref = sccpdevice.name ) + GROUP BY sccpdevice.name; "; + $sql .= "CREATE OR REPLACE ALGORITHM = MERGE VIEW sccpuserconfig AS + SELECT GROUP_CONCAT( CONCAT_WS( ',', sccpbuttonconfig.buttontype, sccpbuttonconfig.name, sccpbuttonconfig.options ) + ORDER BY instance ASC SEPARATOR ';' ) AS button, sccpuser.* + FROM sccpuser + LEFT JOIN sccpbuttonconfig ON ( sccpbuttonconfig.reftype = 'sccpuser' AND sccpbuttonconfig.ref = sccpuser.id) + GROUP BY sccpuser.name; "; } else { - $sql = "DROP VIEW IF EXISTS sccpdeviceconfig; - DROP VIEW IF EXISTS sccpuserconfig;"; - /// global $hw_mobil; - - global $mobile_hw; - if ($mobile_hw == '1') { - $sql .= "CREATE OR REPLACE - ALGORITHM = MERGE - VIEW sccpdeviceconfig AS - SELECT GROUP_CONCAT( CONCAT_WS( ',', sccpbuttonconfig.buttontype, sccpbuttonconfig.name, sccpbuttonconfig.options ) - ORDER BY instance ASC SEPARATOR ';' ) AS sccpbutton, sccpdevice.* - FROM sccpdevice - LEFT JOIN sccpbuttonconfig ON (sccpbuttonconfig.reftype = 'sccpdevice' AND sccpbuttonconfig.ref = sccpdevice.name ) - GROUP BY sccpdevice.name; "; - $sql .= "CREATE OR REPLACE ALGORITHM = MERGE VIEW sccpuserconfig AS - SELECT GROUP_CONCAT( CONCAT_WS( ',', sccpbuttonconfig.buttontype, sccpbuttonconfig.name, sccpbuttonconfig.options ) - ORDER BY instance ASC SEPARATOR ';' ) AS button, sccpuser.* - FROM sccpuser - LEFT JOIN sccpbuttonconfig ON ( sccpbuttonconfig.reftype = 'sccpuser' AND sccpbuttonconfig.ref = sccpuser.id) - GROUP BY sccpuser.name; "; - } else { - $sql .= "CREATE OR REPLACE - ALGORITHM = MERGE - VIEW sccpdeviceconfig AS + $sql .= "CREATE OR REPLACE + ALGORITHM = MERGE + VIEW sccpdeviceconfig AS SELECT case sccpdevice._profileid - when 0 then - (select GROUP_CONCAT(CONCAT_WS( ',', defbutton.buttontype, defbutton.name, defbutton.options ) SEPARATOR ';') from sccpbuttonconfig as defbutton where defbutton.ref = sccpdevice.name ORDER BY defbutton.instance ) - when 1 then - (select GROUP_CONCAT(CONCAT_WS( ',', userbutton.buttontype, userbutton.name, userbutton.options ) SEPARATOR ';') from sccpbuttonconfig as userbutton where userbutton.ref = sccpdevice._loginname ORDER BY userbutton.instance ) - when 2 then - (select GROUP_CONCAT(CONCAT_WS( ',', homebutton.buttontype, homebutton.name, homebutton.options ) SEPARATOR ';') from sccpbuttonconfig as homebutton where homebutton.ref = sccpuser.homedevice ORDER BY homebutton.instance ) - end as button, if(sccpdevice._profileid = 0, sccpdevice._description, sccpuser.description) as description, sccpdevice.* + when 0 then + (select GROUP_CONCAT(CONCAT_WS( ',', defbutton.buttontype, defbutton.name, defbutton.options ) SEPARATOR ';') from sccpbuttonconfig as defbutton where defbutton.ref = sccpdevice.name ORDER BY defbutton.instance ) + when 1 then + (select GROUP_CONCAT(CONCAT_WS( ',', userbutton.buttontype, userbutton.name, userbutton.options ) SEPARATOR ';') from sccpbuttonconfig as userbutton where userbutton.ref = sccpdevice._loginname ORDER BY userbutton.instance ) + when 2 then + (select GROUP_CONCAT(CONCAT_WS( ',', homebutton.buttontype, homebutton.name, homebutton.options ) SEPARATOR ';') from sccpbuttonconfig as homebutton where homebutton.ref = sccpuser.homedevice ORDER BY homebutton.instance ) + end as button, if(sccpdevice._profileid = 0, sccpdevice._description, sccpuser.description) as description, sccpdevice.* FROM sccpdevice LEFT JOIN sccpuser sccpuser ON ( sccpuser.name = sccpdevice._loginname ) GROUP BY sccpdevice.name;"; - } } + $results = $db->query($sql); if (DB::IsError($results)) { die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage())); From 82772eed71ceb6dc15ce0759f1359e227baaecb5 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Thu, 17 Jun 2021 15:12:50 +0200 Subject: [PATCH 03/11] Bugfix Incorrect object for execute Change object for execute in SaveButtons --- sccpManClasses/dbinterface.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sccpManClasses/dbinterface.class.php b/sccpManClasses/dbinterface.class.php index 5fa736c..e58faba 100644 --- a/sccpManClasses/dbinterface.class.php +++ b/sccpManClasses/dbinterface.class.php @@ -310,7 +310,7 @@ class dbinterface $stmt->bindParam(':instance', $button_array['instance'],\PDO::PARAM_INT); $stmt->bindParam(':buttontype', $button_array['type'],\PDO::PARAM_STR); $stmt->bindParam(':name', $button_array['name'],\PDO::PARAM_STR); - $result= $dbh->execute(); + $result= $stmt->execute(); } break; case 'add': From fd21a9482185c9aa3a41b84554c8793c4880af7f Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Sat, 19 Jun 2021 15:23:42 +0200 Subject: [PATCH 04/11] Fix Issue #20 During initial migration of Sccp_Manager to chan-sccp, the incorrect version of sccp class driver was imported. This corrects that and modifies the original driver --- conf/Sccp.class.php.v433 | 479 +++++++++++++++++++++++++++------------ 1 file changed, 329 insertions(+), 150 deletions(-) diff --git a/conf/Sccp.class.php.v433 b/conf/Sccp.class.php.v433 index 50448e1..f62829e 100644 --- a/conf/Sccp.class.php.v433 +++ b/conf/Sccp.class.php.v433 @@ -2,21 +2,51 @@ // vim: set ai ts=4 sw=4 ft=php: // Version for SCCP Manager 13.0.X // -// Templete for Sccp Driver +// Template for Sccp Driver +/* + * Required Functions for Core Drivers + * getInfo + * addDevice + * delDevice + * getDevice + * getDefaultDeviceSettings + * getDeviceDisplay + * + */ // namespace FreePBX\modules\Core\Drivers; class Sccp extends \FreePBX\modules\Core\Driver { private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account', - "context" =>'lcontext',"incominglimit"=>'incominglimit', - "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup', - "transfer" => 'transfer', "echocancel" => 'echocancel', - "language" => 'language', "description" => 'callerid', - "cid_num" => 'cid_num', "cid_name" => 'cid_name', "mailbox" => 'mailbox', - "musicclass" => 'musicclass',"allow" => 'allow',"disallow" => 'disallow', - "videomode" => 'videomode', - "dnd" => 'dnd', "silencesuppression" => 'silencesuppression', - "secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone', - 'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup' + "context" =>'lcontext',"incominglimit"=>'incominglimit', + "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup', + "transfer" => 'transfer', "echocancel" => 'echocancel', + "language" => 'language', "description" => 'callerid', + "cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox', + "musicclass" => 'musicclass', "allow" => 'allow',"disallow" => 'disallow', + "videomode" => 'videomode', + "dnd" => 'dnd', "silencesuppression" => 'silencesuppression', + "secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone', + 'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup' + ); + private $guiDefaults =array( + 'gui_checkset' => array( "elemname" => "", + "prompttext" => "", + "helptext" => "", + "currentvalue" => "", + "valarray" => array(), + "jsonclick" => '', + "jsvalidation" => "", + "failvalidationmsg" => "", + "canbeempty" => true, + "maxchars" => 0, + "disable" => false, + "inputgroup" => false, + "class" => "", + "cblabel" => 'Enable', + "disabled_value" => 'DEFAULT', + "check_enables" => 'true', + "cbdisable" => false, + "cbclass" => '') ); public function getInfo() { @@ -26,14 +56,14 @@ class Sccp extends \FreePBX\modules\Core\Driver { "prettyName" => _("Sccp Custom Driver"), "shortName" => "SCCP", "description" => _("Sccp Device"), - "Version" => "11.4", - "about" => "Sccp mysql class Base ver: 11.3, Sccp ver: default" + "Version" => "11.5", + "about" => "Sccp class Base ver: 11.5, Sccp ver: default" ); } public function addDevice($id, $settings) { global $currentcomponent; - $add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description'); + $add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox'); $settings['cid_num']['value'] = ''; $settings['cid_name']['value'] = ''; $settings['mailbox']['value']= ''; @@ -79,9 +109,14 @@ class Sccp extends \FreePBX\modules\Core\Driver { $sqlCol = 'name'; $sqlVal = "'{$id}'"; foreach($this->data_fld as $key => $val) { - if (isset($settings[$val]['value'])){ - $sqlCol .= ", {$key}"; - $sqlVal .= ", '{$settings[$val]['value']}'"; + if (isset($tech[$key])) { + if (isset($settings[$val]['value'])){ + $sqlCol .= ", {$key}"; + $sqlVal .= ", '{$settings[$val]['value']}'"; + } else { + $sqlCol .= ", {$key}"; + $sqlVal .= ", DEFAULT( {$key} )"; + } } } $sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} );"; @@ -97,141 +132,218 @@ class Sccp extends \FreePBX\modules\Core\Driver { if (isset($_REQUEST['display'])) { redirect("config.php?display=sccp_phone", false); } + // Have changed something so need to reload the device + // TODO: are we reloading the device or reloading Asterisk + $this->reload_line($id); return true; } public function delDevice($id) { - $sql = "DELETE FROM sccpline WHERE name = ?"; - $sth = $this->database->prepare($sql); - $sth->execute(array($id)); - return true; + $sql = "DELETE FROM sccpline WHERE name = ?"; + $sth = $this->database->prepare($sql); + $sth->execute(array($id)); + return true; } public function getDevice($id) { $sccp_line = array(); - // $sql = "SELECT name as id, name as name"; - $sql = "SELECT name as id, name as name "; - foreach($this->data_fld as $key => $val) { - $sql .= ',`'. $key .'` as '.$val; + $sql = "SELECT name as id, name as name "; + foreach($this->data_fld as $key => $val) { + $sql .= ',`'. $key .'` as '.$val; } - $sql .= " FROM sccpline WHERE name = ?"; - $sth = $this->database->prepare($sql); - $result = array(); - $tech = array(); - try { - $sth->execute(array($id)); - $result = $sth->fetch(\PDO::FETCH_ASSOC); + $sql .= " FROM sccpline WHERE name = ?"; + $sth = $this->database->prepare($sql); + $result = array(); + $tech = array(); + try { + $sth->execute(array($id)); + $result = $sth->fetch(\PDO::FETCH_ASSOC); $tech = $result; $tech['dial']='SCCP/'.$id; - } catch(\Exception $e) {} + } catch(\Exception $e) {} - return $tech; + return $tech; } public function getDefaultDeviceSettings($id, $displayname, &$flag) { - $dial = 'SCCP'; - $settings = array( - "pin" => array( - "value" => "", - "flag" => $flag++ - ), - "incominglimit" => array( - "value" => "", - "flag" => $flag++ - ), - "lcontext" => array( - "value" => "from-internal", - "flag" => $flag++ - ), - "callgroup" => array( - "value" => "", - "flag" => $flag++ - ), - "namedcallgroup" => array( - "value" => "", - "flag" => $flag++ - ), - "pickupgroup" => array( - "value" => "", - "flag" => $flag++ - ), - "namedpickupgroup" => array( - "value" => "", - "flag" => $flag++ - ), - "transfer" => array( - "value" => "on", - "flag" => $flag++ - ), - "adhocNumber" => array( - "value" => "", - "flag" => $flag++ - ), - "echocancel" => array( - "value" => "no", - "flag" => $flag++ - ), - "dnd" => array( - "value" => "UserDefined", - "flag" => $flag++ - ), - "silencesuppression" => array( - "value" => "no", - "flag" => $flag++ - ), - "secondary_dialtone_digits" => array( - "value" => "9", - "flag" => $flag++ - ), - "secondary_dialtone_tone" => array( - "value" => "0x22", - "flag" => $flag++ - ), - "musicclass" => array( - "value" => "default", - "flag" => $flag++ - ) - ); - return array( - "dial" => $dial, - "settings" => $settings - ); + $dial = 'SCCP'; + $settings = array( + "mailbox" => array( + "value" => "", + "flag" => $flag++ + ), + "pin" => array( + "value" => "", + "flag" => $flag++ + ), + "incominglimit" => array( + "value" => "", + "flag" => $flag++ + ), + "lcontext" => array( + "value" => "from-internal", + "flag" => $flag++ + ), + "callgroup" => array( + "value" => "", + "flag" => $flag++ + ), + "namedcallgroup" => array( + "value" => "", + "flag" => $flag++ + ), + "pickupgroup" => array( + "value" => "", + "flag" => $flag++ + ), + "namedpickupgroup" => array( + "value" => "", + "flag" => $flag++ + ), + "transfer" => array( + "value" => "on", + "flag" => $flag++ + ), + "adhocNumber" => array( + "value" => "", + "flag" => $flag++ + ), + "echocancel" => array( + "value" => "no", + "flag" => $flag++ + ), + "dnd" => array( + "value" => "UserDefined", + "flag" => $flag++ + ), + "silencesuppression" => array( + "value" => "no", + "flag" => $flag++ + ), + "secondary_dialtone_digits" => array( + "value" => "9", + "flag" => $flag++ + ), + "secondary_dialtone_tone" => array( + "value" => "0x22", + "flag" => $flag++ + ), + "musicclass" => array( + "value" => "default", + "flag" => $flag++ + ), + "allow" => array( + "value" => "all", + "flag" => $flag++ + ), + "disallow" => array( + "value" => "all", + "flag" => $flag++ + ), + ); + return array( + "dial" => $dial, + "settings" => $settings + ); + } + + public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { + $section = _("SCCP Extension Details"); + $section_с = _("SCCP Codec Details"); + $gn_category = "sccp"; + global $currentcomponent, $display; + $named_group = $this->getNamedGroup(); + //add sccp category + $currentcomponent->addTabTranslation('sccp',_('SCCP')); + + //Fill Codecs Informations + + $Sccp_Codec = array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261'); + $allCodecs = $this->freepbx->Codecs->getAudio(true); + $allVCodecs = $this->freepbx->Codecs->getVideo(); + $ACodec_cur = array('all'); + $VCodec_cur = array('all'); + + foreach ($allCodecs as $c => $v) { + if (array_search($c,$Sccp_Codec) !=null) { + $currentcomponent->addoptlistitem('devinfo_sccp_codec', "devinfo_codec_"."$c", "$c"); + if (isset($deviceInfo['allow'])) { + if (strpos($deviceInfo['allow'],$c)!== false) { + $ACodec_cur[] ="devinfo_codec_"."$c"; + } + } + } } -# !TODO!: -TODO-: Would it not be better to put this part in the view directory (MVC) ? No, This is a template for Freepbx. - public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { - $section = _("Settings"); - $category = "general"; + foreach ($allVCodecs as $c => $v) { + if (array_search($c,$Sccp_Codec) !=null) { + $currentcomponent->addoptlistitem('devinfo_sccp_vcodec', "devinfo_codec_"."$c", "$c"); + if (isset($deviceInfo['allow'])) { + if (strpos($deviceInfo['allow'],$c)!== false) { + $VCodec_cur[] ="devinfo_codec_"."$c"; + } + } + } + } + + $el = array( + "elemname" => "devinfo_sccp_codec", + "prompttext" => _('Line Audio Codec:'), + "helptext" => _("Line Audio Codec"), + "currentvalue" => $ACodec_cur, + "valarray" => $currentcomponent->getoptlist('devinfo_sccp_codec'), + "class" => $section_с, + "disable" => 0 + ); + + $currentcomponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category); + unset($el); + + $el = array( + "elemname" => "devinfo_sccp_vcodec", + "prompttext" => _('Line Video Codec:'), + "helptext" => _("Line Video Codec"), + "currentvalue" => $VCodec_cur, + "valarray" => $currentcomponent->getoptlist('devinfo_sccp_vcodec'), + "class" => $section_с, + "disable" => 0 + ); + $currentcomponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category); + $tmparr = array(); - $tt = _("The maximum number of incoming calls on this line."); - // $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel); - // !TODO!: Please change the default value for incominglimit to '6' or higher - $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 1); + $tt = _("Name or id of linked maibox"); + $tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - $tt = _("Asterisk context which this line will use to send and receive calls (Note: Only change this is you know what you are doing)."); - $tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1); + $tt = _("The SCCP channel number for this port. If you plaining to use this line as 'Shared' or use on several devices - leave this field blank or set limit to 10 calls."); + $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - // !TODO!: -TODO-: Maybe completely remove support for old numberic callgroup/pickupgroup in favor of the named version ? See Sccp.class.php.v431 - $tt = _("Phone call group (numeric only, example:1,3-4)"); - $tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1); + $tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing."); + $tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - // !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431 - $tt = _("Phone named call group (>asterisk-11)"); - $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1); + $tt = _("Asterisk context this device will can pickup calls. Only change this is you know what you are doing."); + $tmparr['directed_pickup_context'] = array('prompttext' => _('Directed PickUp Сontext '), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - $tt = _("Sets the pickup group (numeric only, example:1,3-4) this line is a member of. Allows this line to pickup calls from remote phones which are in this callhroup."); - $tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1); + $tt = _("Sets the named caller groups this line is a member of (ast111) : "); + if (!empty($named_group['namedcallgroup'])) { + foreach ($named_group['namedcallgroup'] as $val) { + $tt .= $val. ', '; + } + $tt .= '... '; + } + $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - // !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431 - $tt = _("Sets the named pickup name group this line is a member of. Allows this line to pickup calls from remote phones which are in this name callgroup (>asterisk-11)."); - $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1); + $tt = _("Named PickupGroup : "); + if (!empty($named_group['namedpickupgroup'])) { + foreach ($named_group['namedpickupgroup'] as $val) { + $tt .= $val. ', '; + } + $tt .= '... '; + } + $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); - $tt = _("Phone pincode (Note used)"); - $tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1); - - $tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)"); - $tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1); + $tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)"); + $tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); unset($select); $select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone'); @@ -276,8 +388,8 @@ class Sccp extends \FreePBX\modules\Core\Driver { $select[] = array( 'value' => '0x7A', 'text' => 'MLPP Bpa'); $select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea'); $select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa'); - /* !TODO!: +TODO+: I would remove the values below this line, except for 'No Tone' */ - // $select[] = array( 'value' => '0x7F', 'text' => 'No Tone'); +/* !TODO!: I would remove the values below this line, except for 'No Tone' */ +// $select[] = array( 'value' => '0x7F', 'text' => 'No Tone'); $select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone'); $select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone'); $select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed Tone'); @@ -292,39 +404,52 @@ class Sccp extends \FreePBX\modules\Core\Driver { $select[] = array('value' => 'no', 'text' => 'No'); $tt = _("Outside dialtone frequency (defaul 0x22)"); - $tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select'); + $tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => '0x22', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select', 'section' => $section,'category' => $gn_category); - # !TODO!: -TODO-: is there no easier way to specify a boolean radio group ? No. unset($select); - $select[] = array('value' => 'on', 'text' => 'On'); - $select[] = array('value' => 'off', 'text' => 'Off'); + $select[] = array('value' => '', 'text' => 'Inherit'); + $select[] = array('value' => 'on', 'text' => 'Yes'); + $select[] = array('value' => 'off', 'text' => 'No'); + $tt = _("Enable/Disable the `directed` pickup softkey"); + $tmparr['directed_pickup'] = array('prompttext' => _('Directed pickup'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); + + unset($select); + $select[] = array('value' => '', 'text' => 'Inherit'); + $select[] = array('value' => 'on', 'text' => 'Yes'); + $select[] = array('value' => 'off', 'text' => 'No'); + $tt = _("Should the picked/gpicked-up call be answered automatically"); + $tmparr['pickup_modeanswer'] = array('prompttext' => _('Pickup Modeanswer'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); + + unset($select); + $select[] = array('value' => '', 'text' => 'Inherit'); + $select[] = array('value' => 'on', 'text' => 'Yes'); + $select[] = array('value' => 'off', 'text' => 'No'); $tt = _("Allow call transfer."); - $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); +// $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' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); unset($select); - $select[] = array('value' => 'on', 'text' => 'On'); - $select[] = array('value' => 'off', 'text' => 'Off'); + $select[] = array('value' => 'on', 'text' => 'Yes'); + $select[] = array('value' => 'off', 'text' => 'No'); $tt = _("Echo cancel"); - $tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); + $tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'on', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); unset($select); $select[] = array('value' => 'off', 'text' => 'Off'); $select[] = array('value' => 'reject', 'text' => 'Reject'); $select[] = array('value' => 'silent', 'text' => 'Silent'); - $select[] = array('value' => 'UserDefined', 'text' => 'UserDefined'); - # !TODO!: -TODO-: The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour - # !TODO!: -TODO-: Userdefined is also a possible state, but it is not used or implemented (and it should not be implemented here, i think). See Sccp.class.php.v431, See Sccp.class.php - Old Style - $tt = _("DND: How will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'
    '. - _("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'
    '. + $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").'
    '. + _("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'
    '. _("Reject - Usesr can only switch off and on (in reject/busy mode)").'
    '. - _("Silent - Usesr can only switch off and on (in silent mode)"); - $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); + _("Silent - Usesr can only switch off and on (in silent mode)"); + $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'reject', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); unset($select); - $select[] = array('value' => 'on', 'text' => 'On'); - $select[] = array('value' => 'off', 'text' => 'Off'); + $select[] = array('value' => 'on', 'text' => 'Yes'); + $select[] = array('value' => 'off', 'text' => 'No'); $tt = _("Silence Suppression. Asterisk Not supported"); - $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); + $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'off', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); unset($select); $select[] = array('value' => 'default', 'text' => _('default')); @@ -338,9 +463,63 @@ 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); + $tmparr['musicclass'] = array('prompttext' => _('Music on hold'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section,'category' => $gn_category); + unset($select); - $devopts = $tmparr; - return $devopts; + $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 ,'category' => $gn_category); + unset($select); + + $select[] = array('value' => 'off', 'text' => 'Off'); + $select[] = array('value' => 'user', 'text' => 'User'); + $select[] = array('value' => 'auto', 'text' => 'Auto'); + $tt = _("Automatic or Manual video mode. Valid values are 'auto', 'user' or 'off'. When set to 'auto', video will automatically start if both parties have a compatible code enabled. In 'user' mode the user needs to press the vidmode softkey before video will be tried. Default:'auto'"); + $tmparr['videomode'] = array('prompttext' => _('Video Mode '), 'value' => 'auto', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section_с, 'category' => $gn_category); + unset($select); + + $tt = _("Codec disallow"); + $tmparr['disallow'] = array('prompttext' => _('Codec disallow'), 'value' => 'all', 'tt' => $tt, 'level' => 1, 'section' => $section_с,'category' => $gn_category); + unset($select); + + $devopts = $tmparr; + return $devopts; + } + + public function reload_line($id) { + global $astman; + // TODO: Change to use amInterfaceClasses + $result = $astman->Command('sccp reload line ' . $id); + return $result; + } + + public function getNamedGroup() { + $sql = "select namedcallgroup from sccpline group by namedcallgroup"; + $sth = $this->database->prepare($sql); + $result = array(); + $tech = array(); + try { + $sth->execute(); + $result = $sth->fetchAll(); + foreach($result as $val) { + $tech['namedcallgroup'][] = $val[0]; + } + } catch(\Exception $e) {} + $sql = "select namedpickupgroup from sccpline group by namedpickupgroup"; + $sth = $this->database->prepare($sql); + try { + $sth->execute(); + $result = $sth->fetchAll(); + foreach($result as $val) { + $tech['namedpickupgroup'][] = $val[0]; + } + } catch(\Exception $e) {} + + return $tech; + } + + public function getDeviceHeaders() { + return array( + 'secret' => array('identifier' => _('Secret'), 'description' => sprintf(_('Secret [Enter "%s" to regenerate]'),"REGEN")), + ); } } From def22582e38d9531dfe144fa3a5b193ec0c4c308 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Sun, 20 Jun 2021 13:14:54 +0200 Subject: [PATCH 05/11] Correct SQL in INSTALLER --- install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.php b/install.php index 812467a..32dbe83 100644 --- a/install.php +++ b/install.php @@ -366,7 +366,7 @@ function InstallDB_updateSchema($db_config) $count_modify ++; } if (!empty($row_data['def_modify'])) { - $sql_modify .= "MODIFY COLUMN {$row_fld} SET DEFAULT {$row_data['def_modify']}, "; + $sql_modify .= "ALTER COLUMN {$row_fld} SET DEFAULT '{$row_data['def_modify']}', "; $count_modify ++; } if (!empty($row_data['drop'])) { From 0692b3cd6a2611dd86b068f357620a6b51aceeab Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Sun, 20 Jun 2021 13:15:49 +0200 Subject: [PATCH 06/11] Update module version --- module.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.xml b/module.xml index eca5e99..cc95ff6 100644 --- a/module.xml +++ b/module.xml @@ -1,7 +1,7 @@ sccp_manager SCCP Manager - 14.2.0.10 + 14.2.0.11 setup SCCP Connectivity Steve Lad, Alex GP From a6a7b517d15c26bba8fad32320fd0eba215f145a Mon Sep 17 00:00:00 2001 From: Diederik de Groot Date: Sat, 26 Jun 2021 11:03:42 +0200 Subject: [PATCH 07/11] Added file explaining config parsing and inheritance by chan-sccp. --- .../asterisk-chan-sccp-config-handling.txt | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Technical.notes/asterisk-chan-sccp-config-handling.txt diff --git a/Technical.notes/asterisk-chan-sccp-config-handling.txt b/Technical.notes/asterisk-chan-sccp-config-handling.txt new file mode 100644 index 0000000..dc39004 --- /dev/null +++ b/Technical.notes/asterisk-chan-sccp-config-handling.txt @@ -0,0 +1,91 @@ +Config Structure & Handling explained +------------------------------------- +Asterisk has a config parsing system that provides a generic interface to +config sections and paramater, this system has multiple backends like +ini, ldap, database that all present their data in a unified structure. + +From chan-sccp's view all the config sections and parameters looks exactly +the same. In principal we don't have to know where the settings are coming +from, we just need to be able to handle three cases: +- requested section+paramater does not exist -> error +- requested section+parameter exists and returns a value +- requested section+parameter exists and returns NULL (ie: no field present in +ini/table or is set to NULL) + +Based on this simple view of the world we built sccp_config.c and it's +primary source of information sccp_config_entries.hh. The latter contains: +- all valid config sections and parameters +- their links to the in memory entity structures (POD's) +- flags: + - their deprecated/obsolete status + - their value inheritance structure, device or lines can inherit values from +the [general] section if they are not provided (See more about inheritance +below) + - what to do when a value changes (either directly or through inheritance) +- ultimate fallback value for parameter that cannot be/work `unspecified` +- dedicated parser required to process the value, if a generic parser would +not work (for example handling codecs, deny/permit) +- help descriptions for each parameter + +Config value inheritance +------------------------ +sccp_config_entries.hh contains universal fallback values for parameters +that cannot work without one. Without this ultimate fallback +value, chan-sccp would crash/not work. For example chan-sccp would not know +what tcp-port to use for it's listerning connection, if not provided. +They are built-in fallback values fixed at compile time. + +sccpdevices or sccplines can inherit values from the general section +in sccp.conf. The parameters in the general section are further backed by +the sccp_config_entries.hh with it's fallback value, in case they +are not provided. + +So for example: +If sccpdevice:keepalive is not set, it will get it's value from +general:keepalive, which if not set, will fallback to the value provided +in sccp_config_entries.hh. The actual sccpdevice:keepalive is on evaluated +at the moment the device is connecting and registering to chan-sccp, at +which moment the value trickles down. So let's assume this situation: + +sccp.conf: +``` +[general] +;keepalive=120 + +[SEPxxxxx] +;keepalive=140 +``` + +In this case the universal default will be provided by +sccp_config_entries.hh. When we now set general:keepalive to 120 and issue +`sccp reload`, all devices will have to be restart (RESTART_REQUIRED flag +is set for keepalive in sccp_config_entries.hh). They will start to connect +again, and the keepalive parameter is reevalueated, they will now see that +they do not have a personal keepalive parameter provided and will use the +general one, instead. + +Note: inheritance is specifically specified in the sccp_config_entries.hh +file and just not automatically happen just based on the parameter name for +example. + +You can think of the sccp_config_entries.hh and a universal section in the +sccp.conf that has a slew of fallback values that are there to have your +back. It will allow you to get by with a minimal config file without having +to worry about chan-sccp not working, becasue you forgot to set the port +number for example. + +So mentally you can think of it like this: +``` +[universal] +keepalive=60 + +[general] +;keepalive=120 + +[SEPxxxxx] +;keepalive=140 +``` + +Note: changing sccp_config_entries.hh after the binary has been build, will +not do anything, the fallback values are backed into the final binary at +compile time. From c1aab666b3e47d2fc549bcbeb434fff4b9903078 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Tue, 6 Jul 2021 08:58:03 +0200 Subject: [PATCH 08/11] Fix Issue #25 Fix incorrect separator and key reference. --- sccpManClasses/xmlinterface.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sccpManClasses/xmlinterface.class.php b/sccpManClasses/xmlinterface.class.php index 0107c5e..bb7f90a 100644 --- a/sccpManClasses/xmlinterface.class.php +++ b/sccpManClasses/xmlinterface.class.php @@ -287,10 +287,10 @@ class xmlinterface if (!empty($dev_config['addon'])) { $xnode = $xml_work->addChild('addOnModules'); $ti = 1; - $hw_addon = explode(',', $dev_config['addon']); + $hw_addon = explode(';', $dev_config['addon']); foreach ($hw_addon as $add_key) { - if (!empty($dev_config['addon_info'][$add_key])) { - $add_val = $dev_config['addon_info'][$add_key]; + if (!empty($dev_config['addon_info'][$dev_config['addon']])) { + $add_val = $dev_config['addon_info'][$dev_config['addon']]; $xnode_obj = $xnode->addChild('addOnModule'); $xnode_obj->addAttribute('idx', $ti); $xnode_obj->addChild('loadInformation', $add_val); From 6fa4c8626e219e801723a263fd47a6f2c39daba4 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Tue, 6 Jul 2021 08:58:47 +0200 Subject: [PATCH 09/11] Revert "Fix Issue #25" This reverts commit c1aab666b3e47d2fc549bcbeb434fff4b9903078. --- sccpManClasses/xmlinterface.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sccpManClasses/xmlinterface.class.php b/sccpManClasses/xmlinterface.class.php index bb7f90a..0107c5e 100644 --- a/sccpManClasses/xmlinterface.class.php +++ b/sccpManClasses/xmlinterface.class.php @@ -287,10 +287,10 @@ class xmlinterface if (!empty($dev_config['addon'])) { $xnode = $xml_work->addChild('addOnModules'); $ti = 1; - $hw_addon = explode(';', $dev_config['addon']); + $hw_addon = explode(',', $dev_config['addon']); foreach ($hw_addon as $add_key) { - if (!empty($dev_config['addon_info'][$dev_config['addon']])) { - $add_val = $dev_config['addon_info'][$dev_config['addon']]; + if (!empty($dev_config['addon_info'][$add_key])) { + $add_val = $dev_config['addon_info'][$add_key]; $xnode_obj = $xnode->addChild('addOnModule'); $xnode_obj->addAttribute('idx', $ti); $xnode_obj->addChild('loadInformation', $add_val); From 4ad33852fdb95ecde70220de9556df7e98872e78 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Tue, 6 Jul 2021 09:01:26 +0200 Subject: [PATCH 10/11] Revert "Revert "Fix Issue #25"" This reverts commit 6fa4c8626e219e801723a263fd47a6f2c39daba4. --- sccpManClasses/xmlinterface.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sccpManClasses/xmlinterface.class.php b/sccpManClasses/xmlinterface.class.php index 0107c5e..bb7f90a 100644 --- a/sccpManClasses/xmlinterface.class.php +++ b/sccpManClasses/xmlinterface.class.php @@ -287,10 +287,10 @@ class xmlinterface if (!empty($dev_config['addon'])) { $xnode = $xml_work->addChild('addOnModules'); $ti = 1; - $hw_addon = explode(',', $dev_config['addon']); + $hw_addon = explode(';', $dev_config['addon']); foreach ($hw_addon as $add_key) { - if (!empty($dev_config['addon_info'][$add_key])) { - $add_val = $dev_config['addon_info'][$add_key]; + if (!empty($dev_config['addon_info'][$dev_config['addon']])) { + $add_val = $dev_config['addon_info'][$dev_config['addon']]; $xnode_obj = $xnode->addChild('addOnModule'); $xnode_obj->addAttribute('idx', $ti); $xnode_obj->addChild('loadInformation', $add_val); From 47522b4a259147ab2a1326fd77890c3c364ccd83 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Tue, 6 Jul 2021 09:06:10 +0200 Subject: [PATCH 11/11] Update SIP cnf as well --- sccpManClasses/xmlinterface.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sccpManClasses/xmlinterface.class.php b/sccpManClasses/xmlinterface.class.php index bb7f90a..394400c 100644 --- a/sccpManClasses/xmlinterface.class.php +++ b/sccpManClasses/xmlinterface.class.php @@ -610,11 +610,15 @@ class xmlinterface if (!empty($dev_config['addon'])) { $xnode = $xml_work->addChild('addOnModules'); $ti = 1; - foreach ($dev_config['addon_info'] as $add_key => $add_val) { - $xnode_obj = $xnode->addChild('addOnModule'); - $xnode_obj->addAttribute('idx', $ti); - $xnode_obj->addChild('loadInformation', $add_val); - $ti++; + $hw_addon = explode(';', $dev_config['addon']); + foreach ($hw_addon as $add_key) { + if (!empty($dev_config['addon_info'][$dev_config['addon']])) { + $add_val = $dev_config['addon_info'][$dev_config['addon']]; + $xnode_obj = $xnode->addChild('addOnModule'); + $xnode_obj->addAttribute('idx', $ti); + $xnode_obj->addChild('loadInformation', $add_val); + $ti++; + } } } break;