Prerelease 06.10.2017

change Lablel in SCCP Extension page
This commit is contained in:
PhantomVl 2017-10-10 12:33:03 +03:00
parent 14d6ffc298
commit 524b602a5e
4 changed files with 129 additions and 42 deletions

View file

@ -65,6 +65,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path
private $pagedata = null; private $pagedata = null;
private $sccp_driver_ver = '11.1';
private $tftpLang = array(); private $tftpLang = array();
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
public $sccp_model_list = array(); public $sccp_model_list = array();
@ -1672,8 +1673,22 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
} }
$this->sccpvalues['sccp_comatable'] = $this->get_comatable_sccp(); $this->sccpvalues['sccp_comatable'] = $this->get_comatable_sccp();
$driver = $this->FreePBX->Core->getAllDriversInfo();
$driver_replace = '';
if (empty($driver['sccp'])) {
$driver_replace = 'yes';
} else {
if (empty($driver['sccp']['sccp_driver_ver'])) {
$driver_replace = 'yes';
} else {
if ($driver['sccp']['sccp_driver_ver'] != $this->sccp_driver_ver){
$driver_replace = 'yes';
}
}
}
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php'; $dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
if (!file_exists($dst)) { if (!file_exists($dst) || $driver_replace =='yes') {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst).'.v'.$this->sccpvalues['sccp_comatable']; $src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst).'.v'.$this->sccpvalues['sccp_comatable'];
if (file_exists($src_path)) { if (file_exists($src_path)) {
copy($src_path, $dst); copy($src_path, $dst);
@ -1681,6 +1696,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst); $src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst);
copy($src_path, $dst); copy($src_path, $dst);
} }
} else {
$driver = $this->FreePBX->Core->getAllDriversInfo();
} }
if (!file_exists($this->sccppath["sccp_conf"])) { // System re Config if (!file_exists($this->sccppath["sccp_conf"])) { // System re Config

View file

@ -20,8 +20,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"rawName" => "sccp", "rawName" => "sccp",
"hardware" => "sccp_custom", "hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"), "prettyName" => _("Sccp Custom Driver"),
"shortName" => _("Sccp"), "shortName" => "SCCP",
"description" => _("Sccp Device") "description" => _("Sccp Device"),
"sccp_driver_ver" => "11.1"
); );
} }
public function addDevice1($id, $settings) { public function addDevice1($id, $settings) {

View file

@ -3,6 +3,8 @@
// Version for SCCP Manager 13.0.0.A // Version for SCCP Manager 13.0.0.A
namespace FreePBX\modules\Core\Drivers; namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver { class Sccp extends \FreePBX\modules\Core\Driver {
public $version;
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account', private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'context',"incominglimit"=>'incominglimit', "context" =>'context',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup', "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
@ -14,14 +16,20 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone', "secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone',
'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup' 'namedcallgroup'=>'namedcallgroup', 'namedpickupgroup' => 'namedpickupgroup'
); );
public function __construct($freepbx) {
parent::__construct($freepbx);
// $this->version = $freepbx->Config->get('ASTVERSION');
}
public function getInfo() { public function getInfo() {
return array( return array(
"rawName" => "sccp", "rawName" => "sccp",
"hardware" => "sccp_custom", "hardware" => "sccp_custom",
"prettyName" => _("Sccp Custom Driver"), "prettyName" => _("Sccp Custom Driver"),
"shortName" => _("Sccp"), "shortName" => "SCCP",
"description" => _("Sccp Device") "description" => _("Sccp Device"),
"sccp_driver_ver" => "11.1"
); );
} }
public function addDevice1($id, $settings) { public function addDevice1($id, $settings) {
@ -109,13 +117,36 @@ class Sccp extends \FreePBX\modules\Core\Driver {
return $tech; return $tech;
} }
public function getNamedGroup() {
$sql = "select namedcallgroup from sccpline group by namedcallgroup";
$sth = $this->database->prepare($sql);
$result = array();
$tech = array();
// $tech['namedcallgroup'] = '';
// $tech['namedpickupgroup'] = '';
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 getDefaultDeviceSettings($id, $displayname, &$flag) { public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP'; $dial = 'SCCP';
$settings = array( $settings = array(
"pin" => array(
"value" => "",
"flag" => $flag++
),
"incominglimit" => array( "incominglimit" => array(
"value" => "2", "value" => "2",
"flag" => $flag++ "flag" => $flag++
@ -125,7 +156,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"flag" => $flag++ "flag" => $flag++
), ),
"callgroup" => array( "callgroup" => array(
"value" => "", "value" => "from-internal",
"flag" => $flag++ "flag" => $flag++
), ),
"namedcallgroup" => array( "namedcallgroup" => array(
@ -140,16 +171,20 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"secondary_dialtone_digits" => array(
"value" => "9",
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => "0x22",
"flag" => $flag++
),
"transfer" => array( "transfer" => array(
"value" => "yes", "value" => "yes",
"flag" => $flag++ "flag" => $flag++
), ),
"adhocNumber" => array(
"value" => "",
"flag" => $flag++
),
"echocancel" => array( "echocancel" => array(
"value" => "no", "value" => "yes",
"flag" => $flag++ "flag" => $flag++
), ),
"dnd" => array( "dnd" => array(
@ -160,12 +195,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"value" => "no", "value" => "no",
"flag" => $flag++ "flag" => $flag++
), ),
"secondary_dialtone_digits" => array( "musicclass" => array(
"value" => "9", "value" => "default",
"flag" => $flag++ "flag" => $flag++
), ),
"secondary_dialtone_tone" => array( "pin" => array(
"value" => "0x22", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"musicclass" => array( "musicclass" => array(
@ -180,24 +215,41 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
$section = _("Settings"); $section = _("SCCP Extension Details");
$category = "general"; // $category = "general";
// Assigned DID/CID
$named_group = $this->getNamedGroup();
$tmparr = array(); $tmparr = array();
$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."); $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' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel); // $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
$tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1); // $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing."); $tt = _("Asterisk context this device will send calls to. Only change this is you know what you are doing.");
$tmparr['context'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1); $tmparr['context'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("Phone call group callgroup=1,3-4"); $tt = _("Phone call group callgroup=1,3-4");
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1); $tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$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);
// $tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tt = _("Phone pickup group pickupgroup=1,3-4"); $tt = _("Phone pickup group pickupgroup=1,3-4");
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1); $tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$tt = _("sets the named caller groups this line is a member of (ast111)"); $tt = _("Name picapuroup : ");
$tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1); if (!empty($named_group['namedpickupgroup'])) {
$tt = _("Phone pincode"); foreach ($named_group['namedpickupgroup'] as $val) {
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1); $tt .= $val. ', ';
}
$tt .= '... ';
}
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
// $tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
$tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)"); $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); $tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
unset($select); unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone'); $select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone');
@ -257,7 +309,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$select[] = array('value' => 'no', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Outside dialtone frequency (defaul 0x22)"); $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);
@ -265,30 +317,31 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Allow call transfer."); $tt = _("Allow call transfer.");
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => 'yes', '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' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select); unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Echo cancel"); $tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); $tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => 'yes', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select); unset($select);
$select[] = array('value' => 'off', 'text' => 'Off'); $select[] = array('value' => 'off', 'text' => 'Off');
$select[] = array('value' => 'reject', 'text' => 'Reject'); $select[] = array('value' => 'reject', 'text' => 'Reject');
$select[] = array('value' => 'silent', 'text' => 'Silent'); $select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => '', 'text' => 'UserDefined'); $select[] = array('value' => '', '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 / UserDefined").'<br>'. $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>'.
_("UserDefined - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<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>'. _("Reject - Usesr can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)"); _("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'); $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select); unset($select);
$select[] = array('value' => 'yes', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'no', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not suported"); $tt = _("Silence Suppression. Asterisk Not suported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => 'no', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section);
unset($select); unset($select);
$select[] = array('value' => 'default', 'text' => _('default')); $select[] = array('value' => 'default', 'text' => _('default'));
@ -302,13 +355,19 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
$tt = _("Music on hold"); $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' => 'no', '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)"); $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); $tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
$devopts = $tmparr; $devopts = $tmparr;
return $devopts; return $devopts;
} }
public function getDeviceHeaders() {
return array(
'secret' => array('identifier' => _('Secret'), 'description' => sprintf(_('Secret [Enter "%s" to regenerate]'),"REGEN")),
);
}
} }

View file

@ -11,6 +11,13 @@
// $dev_data = $this->sccp_getdevice_info($id_name); // $dev_data = $this->sccp_getdevice_info($id_name);
// print_r($dev_data); // print_r($dev_data);
/// $sccpdriver = $this->freepbx->Config->get_conf_setting('ASTSCCPDRIVER');
// $driver = $this->FreePBX->Core->getAllDriversInfo();
// $driver = $this->FreePBX->Config->get_conf_setting('ASTSCCPDRIVER');
// $driver = $this->FreePBX->Config->get_conf_setting('ASTSIPDRIVER');
// $tversion = $freepbx->Config;
// print_r($driver );
?> ?>
<form autocomplete="off" name="frm_general" id="frm_general" class="fpbx-submit" action="" method="post"> <form autocomplete="off" name="frm_general" id="frm_general" class="fpbx-submit" action="" method="post">