Fix Issue #20
This commit is contained in:
steve-lad 2021-06-19 15:24:56 +02:00 committed by GitHub
commit aad6fa31c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,21 +2,51 @@
// vim: set ai ts=4 sw=4 ft=php: // vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.X // 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; namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver { class Sccp extends \FreePBX\modules\Core\Driver {
private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account', private $data_fld = array("pin"=>'pin', "label" => 'label', "accountcode" => 'account',
"context" =>'lcontext',"incominglimit"=>'incominglimit', "context" =>'lcontext',"incominglimit"=>'incominglimit',
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup', "callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
"transfer" => 'transfer', "echocancel" => 'echocancel', "transfer" => 'transfer', "echocancel" => 'echocancel',
"language" => 'language', "description" => 'callerid', "language" => 'language', "description" => 'callerid',
"cid_num" => 'cid_num', "cid_name" => 'cid_name', "mailbox" => 'mailbox', "cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
"musicclass" => 'musicclass',"allow" => 'allow',"disallow" => 'disallow', "musicclass" => 'musicclass', "allow" => 'allow',"disallow" => 'disallow',
"videomode" => 'videomode', "videomode" => 'videomode',
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression', "dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
"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'
);
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() { public function getInfo() {
@ -26,14 +56,14 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"prettyName" => _("Sccp Custom Driver"), "prettyName" => _("Sccp Custom Driver"),
"shortName" => "SCCP", "shortName" => "SCCP",
"description" => _("Sccp Device"), "description" => _("Sccp Device"),
"Version" => "11.4", "Version" => "11.5",
"about" => "Sccp mysql class Base ver: 11.3, Sccp ver: default" "about" => "Sccp class Base ver: 11.5, Sccp ver: default"
); );
} }
public function addDevice($id, $settings) { public function addDevice($id, $settings) {
global $currentcomponent; 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_num']['value'] = '';
$settings['cid_name']['value'] = ''; $settings['cid_name']['value'] = '';
$settings['mailbox']['value']= ''; $settings['mailbox']['value']= '';
@ -79,9 +109,14 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$sqlCol = 'name'; $sqlCol = 'name';
$sqlVal = "'{$id}'"; $sqlVal = "'{$id}'";
foreach($this->data_fld as $key => $val) { foreach($this->data_fld as $key => $val) {
if (isset($settings[$val]['value'])){ if (isset($tech[$key])) {
$sqlCol .= ", {$key}"; if (isset($settings[$val]['value'])){
$sqlVal .= ", '{$settings[$val]['value']}'"; $sqlCol .= ", {$key}";
$sqlVal .= ", '{$settings[$val]['value']}'";
} else {
$sqlCol .= ", {$key}";
$sqlVal .= ", DEFAULT( {$key} )";
}
} }
} }
$sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} );"; $sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} );";
@ -97,141 +132,218 @@ class Sccp extends \FreePBX\modules\Core\Driver {
if (isset($_REQUEST['display'])) { if (isset($_REQUEST['display'])) {
redirect("config.php?display=sccp_phone", false); 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; return true;
} }
public function delDevice($id) { public function delDevice($id) {
$sql = "DELETE FROM sccpline WHERE name = ?"; $sql = "DELETE FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
return true; return true;
} }
public function getDevice($id) { public function getDevice($id) {
$sccp_line = array(); $sccp_line = array();
// $sql = "SELECT name as id, name as name"; $sql = "SELECT name as id, name as name ";
$sql = "SELECT name as id, name as name "; foreach($this->data_fld as $key => $val) {
foreach($this->data_fld as $key => $val) { $sql .= ',`'. $key .'` as '.$val;
$sql .= ',`'. $key .'` as '.$val;
} }
$sql .= " FROM sccpline WHERE name = ?"; $sql .= " FROM sccpline WHERE name = ?";
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$result = array(); $result = array();
$tech = array(); $tech = array();
try { try {
$sth->execute(array($id)); $sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC); $result = $sth->fetch(\PDO::FETCH_ASSOC);
$tech = $result; $tech = $result;
$tech['dial']='SCCP/'.$id; $tech['dial']='SCCP/'.$id;
} catch(\Exception $e) {} } catch(\Exception $e) {}
return $tech; return $tech;
} }
public function getDefaultDeviceSettings($id, $displayname, &$flag) { public function getDefaultDeviceSettings($id, $displayname, &$flag) {
$dial = 'SCCP'; $dial = 'SCCP';
$settings = array( $settings = array(
"pin" => array( "mailbox" => array(
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"incominglimit" => array( "pin" => array(
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"lcontext" => array( "incominglimit" => array(
"value" => "from-internal", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"callgroup" => array( "lcontext" => array(
"value" => "", "value" => "from-internal",
"flag" => $flag++ "flag" => $flag++
), ),
"namedcallgroup" => array( "callgroup" => array(
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"pickupgroup" => array( "namedcallgroup" => array(
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"namedpickupgroup" => array( "pickupgroup" => array(
"value" => "", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"transfer" => array( "namedpickupgroup" => array(
"value" => "on", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"adhocNumber" => array( "transfer" => array(
"value" => "", "value" => "on",
"flag" => $flag++ "flag" => $flag++
), ),
"echocancel" => array( "adhocNumber" => array(
"value" => "no", "value" => "",
"flag" => $flag++ "flag" => $flag++
), ),
"dnd" => array( "echocancel" => array(
"value" => "UserDefined", "value" => "no",
"flag" => $flag++ "flag" => $flag++
), ),
"silencesuppression" => array( "dnd" => array(
"value" => "no", "value" => "UserDefined",
"flag" => $flag++ "flag" => $flag++
), ),
"secondary_dialtone_digits" => array( "silencesuppression" => array(
"value" => "9", "value" => "no",
"flag" => $flag++ "flag" => $flag++
), ),
"secondary_dialtone_tone" => array( "secondary_dialtone_digits" => array(
"value" => "0x22", "value" => "9",
"flag" => $flag++ "flag" => $flag++
), ),
"musicclass" => array( "secondary_dialtone_tone" => array(
"value" => "default", "value" => "0x22",
"flag" => $flag++ "flag" => $flag++
) ),
); "musicclass" => array(
return array( "value" => "default",
"dial" => $dial, "flag" => $flag++
"settings" => $settings ),
); "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. foreach ($allVCodecs as $c => $v) {
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { if (array_search($c,$Sccp_Codec) !=null) {
$section = _("Settings"); $currentcomponent->addoptlistitem('devinfo_sccp_vcodec', "devinfo_codec_"."$c", "$c");
$category = "general"; 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(); $tmparr = array();
$tt = _("The maximum number of incoming calls on this line."); $tt = _("Name or id of linked maibox");
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel); $tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
// !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 = _("Asterisk context which this line will use to send and receive calls (Note: Only change this is you know what you are doing)."); $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['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1); $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 = _("Asterisk context this device will send calls to. Only change this is you know what you are doing.");
$tt = _("Phone call group (numeric only, example:1,3-4)"); $tmparr['lcontext'] = array('prompttext' => _('Line context'), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$tmparr['callgroup'] = array('prompttext' => _('Call group id'),'value' => '', 'tt' => $tt, 'level' => 1);
// !TODO!: -TODO-: multiple allowed (not sure if that is implemented here). See Sccp.class.php.v431 $tt = _("Asterisk context this device will can pickup calls. Only change this is you know what you are doing.");
$tt = _("Phone named call group (>asterisk-11)"); $tmparr['directed_pickup_context'] = array('prompttext' => _('Directed PickUp Сontext '), 'value' => 'from-internal', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$tmparr['namedcallgroup'] = array('prompttext' => _('Named Call Group'),'value' => '', 'tt' => $tt, 'level' => 1);
$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."); $tt = _("Sets the named caller groups this line is a member of (ast111) : ");
$tmparr['pickupgroup'] = array('prompttext' => _('Pickup group id'),'value' => '', 'tt' => $tt, 'level' => 1); 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 = _("Named PickupGroup : ");
$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)."); if (!empty($named_group['namedpickupgroup'])) {
$tmparr['namedpickupgroup'] = array('prompttext' => _('Named Pickup Group'),'value' => '', 'tt' => $tt, 'level' => 1); 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)"); $tt = _("Digits to indicate an external line to user (secondary dialtone) Sample 9 or 8 (max 9 digits)");
$tmparr['pin'] = array('value' => '', 'tt' => $tt, 'level' => 1); $tmparr['secondary_dialtone_digits'] = array('prompttext' => _('Secondary dialtone digits'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$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);
unset($select); unset($select);
$select[] = array( 'value' => '0x21', 'text' => 'Inside Dial Tone'); $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' => '0x7A', 'text' => 'MLPP Bpa');
$select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea'); $select[] = array( 'value' => '0x7B', 'text' => 'MLPP Bnea');
$select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa'); $select[] = array( 'value' => '0x7C', 'text' => 'MLPP Upa');
/* !TODO!: +TODO+: I would remove the values below this line, except for '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' => '0x7F', 'text' => 'No Tone');
$select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone'); $select[] = array( 'value' => '0x80', 'text' => 'Meetme Greeting Tone');
$select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone'); $select[] = array( 'value' => '0x81', 'text' => 'Meetme Number Invalid Tone');
$select[] = array( 'value' => '0x82', 'text' => 'Meetme Number Failed 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'); $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,'category' => $gn_category);
# !TODO!: -TODO-: is there no easier way to specify a boolean radio group ? No.
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'On'); $select[] = array('value' => '', 'text' => 'Inherit');
$select[] = array('value' => 'off', 'text' => 'Off'); $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."); $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); unset($select);
$select[] = array('value' => 'on', 'text' => 'On'); $select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'Off'); $select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Echo cancel"); $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); 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' => 'UserDefined', 'text' => 'UserDefined'); $select[] = array('value' => 'user', 'text' => 'Cycle');
# !TODO!: -TODO-: The next entry should be "null/empty" (not UserDefined) -> to indicate the trie-state behaviour $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>'.
# !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 _("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'.
$tt = _("DND: How will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / UserDefined").'<br>'.
_("UserDefined - 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' => 'UserDefined', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio'); $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => 'reject', 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'On'); $select[] = array('value' => 'on', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'Off'); $select[] = array('value' => 'off', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not supported"); $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); unset($select);
$select[] = array('value' => 'default', 'text' => _('default')); $select[] = array('value' => 'default', 'text' => _('default'));
@ -338,9 +463,63 @@ 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' => '', 'tt' => $tt, 'select' => $select, 'level' => 1, 'section' => $section,'category' => $gn_category);
unset($select);
$devopts = $tmparr; $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)");
return $devopts; $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")),
);
} }
} }