Finalise Codec Management

Add video codec treatment
Correct missing defaults
Simplify defaults in Sccp.class
This commit is contained in:
steve-lad 2021-07-08 08:56:42 +02:00
parent 11da8356a5
commit 6429b6add9
5 changed files with 111 additions and 183 deletions

View file

@ -1051,12 +1051,20 @@ and open the template in the editor. Base Version before all crash :-)
</item> </item>
<item type="IS" id="11"> <item type="IS" id="11">
<name>pickup_modeanswer</name> <name>pickup_modeanswer</name>
<label>Directed Pickup</label> <label>Directed Pickup Answer</label>
<default>off</default> <default>off</default>
<button value="yes">Yes</button> <button value="yes">Yes</button>
<button value="no">No</button> <button value="no">No</button>
<help>Directed Pickup Mode (Answer): If a call is sent with the "directed pickup" flag, the phone will answer when set to "Yes".</help> <help>Directed Pickup Mode (Answer): If a call is sent with the "directed pickup" flag, the phone will answer when set to "Yes".</help>
</item> </item>
<item type="IS" id="11">
<name>directed_pickup</name>
<label>Directed Pickup</label>
<default>off</default>
<button value="yes">Yes</button>
<button value="no">No</button>
<help>Enable/disable Pickup button to do directed pickup from a specific extension.</help>
</item>
<item type="IS" id="12"> <item type="IS" id="12">
<name>transfer_on_hangup</name> <name>transfer_on_hangup</name>
<label>Transfer on hangup</label> <label>Transfer on hangup</label>

View file

@ -144,7 +144,7 @@ function Get_DB_config($sccp_compatible)
'softkeyset' => array('def_modify' => "softkeyset") 'softkeyset' => array('def_modify' => "softkeyset")
), ),
'sccpline' => array( 'sccpline' => array(
'directed_pickup' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), 'directed_pickup' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"), 'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickup_modeanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"), 'pickup_modeanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"), 'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),

View file

@ -11,14 +11,30 @@
* getInfo * getInfo
* addDevice * addDevice
* delDevice * delDevice
* getDevice * getDevice - Called by core to read sccpline returning fields in data_fld
* getDefaultDeviceSettings * getDefaultDeviceSettings -
* getDeviceDisplay * getDeviceDisplay - Called by functionsInc to load sccp tab using values from Device and getDevice.
* *
*/ */
// //
namespace FreePBX\modules\Core\Drivers; namespace FreePBX\modules\Core\Drivers;
class Sccp extends \FreePBX\modules\Core\Driver { class Sccp extends \FreePBX\modules\Core\Driver {
// This is a map between sccpline fields and FreePBX fields.
// TODO: List needs to be extended. Missing fields, not necessarily all required              
/* adhocNumber
              meetme
                meetmenum
               meetmeopts
                 regexten
          directed_pickup
  directed_pickup_context
        pickup_modeanswer
                 amaflags
setvar
            phonecodepage
                  trnsfvm
                    vmnum
*/
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',
@ -31,18 +47,19 @@ 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'
); );
// These are gui defaults used by freePBX to for the elements in the SCCP tab in add/edit phone.
private $guiDefaults =array( private $guiDefaults =array(
'gui_checkset' => array( "elemname" => "", 'gui_checkset' => array( "elemname" => "",
"prompttext" => "", "prompttext" => "", //ok
"helptext" => "", "helptext" => "",
"currentvalue" => "", "currentvalue" => "",
"valarray" => array(), "valarray" => array(),
"jsonclick" => '', "jsonclick" => '',
"jsvalidation" => "", "jsvalidation" => "", //ok
"failvalidationmsg" => "", "failvalidationmsg" => "", //ok
"canbeempty" => true, "canbeempty" => true,
"maxchars" => 0, "maxchars" => 0,
"disable" => false, "disable" => false, //ok
"inputgroup" => false, "inputgroup" => false,
"class" => "", "class" => "",
"cblabel" => 'Enable', "cblabel" => 'Enable',
@ -50,20 +67,25 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"check_enables" => 'true', "check_enables" => 'true',
"cbdisable" => false, "cbdisable" => false,
"cbclass" => '') "cbclass" => '')
); );
private $line_defaults = array(); private $line_defaults = array();
public function __construct($parent_class = null) { public function __construct($parent_class = null) {
$this->freepbx = $parent_class; $this->freepbx = $parent_class;
$this->database = $parent_class->Database(); $this->database = $parent_class->Database();
// Get system defaults [systemdefault] and sitedefaults [data] from sccpsettings.
$stmt = $this->database->prepare('DESCRIBE sccpline'); $stmt = $this->database->prepare("SELECT * FROM sccpsettings WHERE systemdefault !=''");
$stmt->execute(); $stmt->execute();
$raw_settings = $stmt->fetchAll(\PDO::FETCH_ASSOC); $raw_settings = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($raw_settings as $row) { foreach ($raw_settings as $key => $valueArray) {
$this->line_defaults[$row["Field"]] = $row["Default"]; $sccpDefaults[$valueArray['keyword']] = $valueArray['systemdefault'];
$siteDefaults[$valueArray['keyword']] = $valueArray['data'];
} }
// This will produce an array where site defaults take precedence over system defaults
$this->line_defaults = array_intersect_key($siteDefaults,$sccpDefaults);
unset($raw_settings, $siteDefaults, $sccpDefaults);
} }
public function getInfo() { public function getInfo() {
@ -79,6 +101,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
public function addDevice($id, $settings) { public function addDevice($id, $settings) {
// This is actually save line and is used by add and edit.
global $currentcomponent; global $currentcomponent;
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox'); $add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
$settings['cid_num']['value'] = ''; $settings['cid_num']['value'] = '';
@ -95,8 +118,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
$allow_codec = array(); $allow_codec = array();
foreach($settings as $key => $val) { foreach($settings as $key => $val) {
if (strpos($key,'codec_') !== false ) { if (strncmp($key,'codec_',6) === 0 ) {
$allow_codec[] =substr($key,6); $allow_codec[] = str_replace('codec_','',$key);
} }
} }
$settings['allow']['value'] = implode(",", $allow_codec); $settings['allow']['value'] = implode(",", $allow_codec);
@ -121,18 +144,17 @@ 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 (array_key_exists($key, $this->line_defaults)) { if (isset($settings[$val]['value'])){
if (isset($settings[$val]['value'])){ $sqlCol .= ", {$key}";
$sqlVal .= ", '{$settings[$val]['value']}'";
} else {
if (array_key_exists($key, $this->line_defaults)) {
$sqlCol .= ", {$key}"; $sqlCol .= ", {$key}";
$sqlVal .= ", '{$settings[$val]['value']}'"; $sqlVal .= ", '{$this->line_defaults[$key]}'";
} else {
$sqlCol .= ", {$key}";
$sqlVal .= ", DEFAULT( {$key} )";
} }
} }
} }
$sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} );"; $sql = "REPLACE INTO sccpline ( {$sqlCol} ) VALUES ( {$sqlVal} )";
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$sth->execute(); $sth->execute();
/* /*
@ -157,124 +179,35 @@ class Sccp extends \FreePBX\modules\Core\Driver {
return true; return true;
} }
public function getDevice($id) { 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) { 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 = '{$id}'";
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$result = array();
$tech = array(); $tech = array();
try { try {
$sth->execute(array($id)); $sth->execute(array($id));
$result = $sth->fetch(\PDO::FETCH_ASSOC); $tech = $sth->fetch(\PDO::FETCH_ASSOC);
$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) {
// FreePBX required method
$dial = 'SCCP'; $settingsFields = array('mailbox', 'incominglimit', 'context', 'directed_pickup_context', 'callgroup', 'pickupgroup', 'namedcallgroup',
$settings = array( 'namedpickupgroup', 'adhocNumber', 'secondary_dialtone_digits', 'secondary_dialtone_tone', 'directed_pickup', 'pickup_modeanswer',
"mailbox" => array( 'transfer', 'echocancel', 'dnd', 'silencesuppression', 'musicclass', 'pin', 'allow', 'disallow');
"value" => $this->line_defaults['mailbox'], foreach ($settingsFields as $key) {
"flag" => $flag++ $settings[$key] = array('value' => $this->line_defaults['$key'], 'flag' => $flag++);
), }
"incominglimit" => array( return array('dial' => 'SCCP', 'settings' => $settings);
"value" => $this->line_defaults['incominglimit'],
"flag" => $flag++
),
"context" => array(
"value" => $this->line_defaults['context'],
"flag" => $flag++
),
"directed_pickup_context" => array(
"value" => $this->line_defaults['directed_pickup_context'],
"flag" => $flag++
),
"callgroup" => array(
"value" => $this->line_defaults['callgroup'],
"flag" => $flag++
),
"pickupgroup" => array(
"value" => $this->line_defaults['pickupgroup'],
"flag" => $flag++
),
"namedcallgroup" => array(
"value" => $this->line_defaults['namedcallgroup'],
"flag" => $flag++
),
"namedpickupgroup" => array(
"value" => $this->line_defaults['namedpickupgroup'],
"flag" => $flag++
),
"adhocNumber" => array(
"value" => $this->line_defaults['adhocNumber'],
"flag" => $flag++
),
"secondary_dialtone_digits" => array(
"value" => $this->line_defaults['secondary_dialtone_digits'],
"flag" => $flag++
),
"secondary_dialtone_tone" => array(
"value" => $this->line_defaults['secondary_dialtone_tone'],
"flag" => $flag++
),
"directed_pickup" => array(
"value" => $this->line_defaults['directed_pickup'],
"flag" => $flag++
),
"pickup_modeanswer" => array(
"value" => $this->line_defaults['pickup_modeanswer'],
"flag" => $flag++
),
"transfer" => array(
"value" => $this->line_defaults['transfer'],
"flag" => $flag++
),
"echocancel" => array(
"value" => $this->line_defaults['echocancel'],
"flag" => $flag++
),
"dnd" => array(
"value" => $this->line_defaults['dnd'],
"flag" => $flag++
),
"silencesuppression" => array(
"value" => $this->line_defaults['silencesuppression'],
"flag" => $flag++
),
"musicclass" => array(
"value" => $this->line_defaults['musicclass'],
"flag" => $flag++
),
"pin" => array(
"value" => $this->line_defaults['pin'],
"flag" => $flag++
),
"allow" => array(
"value" => $this->line_defaults['allow'],
"flag" => $flag++
),
"disallow" => array(
"value" => $this->line_defaults['disallow'],
"flag" => $flag++
),
);
return array(
"dial" => $dial,
"settings" => $settings
);
} }
public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) { public function getDeviceDisplay($display, $deviceInfo, $currentcomponent, $primarySection) {
dbug('deviceInfo', $deviceInfo);
$section = _("SCCP Extension Details"); $section = _("SCCP Extension Details");
$section_с = _("SCCP Codec Details"); $section_с = _("SCCP Codec Details");
$gn_category = "sccp"; $gn_category = "sccp";
@ -283,46 +216,29 @@ class Sccp extends \FreePBX\modules\Core\Driver {
//add sccp category //add sccp category
$currentcomponent->addTabTranslation('sccp',_('SCCP')); $currentcomponent->addTabTranslation('sccp',_('SCCP'));
//Fill Codecs Informations $systemCodecs = array_fill_keys(explode(",",$this->line_defaults['allow']),true);
// Fill Audio codecs information
$Sccp_Codec = array('alaw', 'ulaw', 'g722', 'g723', 'g726', 'g729', 'gsm', 'h264', 'h263', 'h261'); $siteAudioCodecs = array_intersect_key($systemCodecs, $this->freepbx->Codecs->getAudio());
$allCodecs = $this->freepbx->Codecs->getAudio(true); foreach ($siteAudioCodecs as $key => $value) {
$allVCodecs = $this->freepbx->Codecs->getVideo(); $audioCodecButtons[] = array('value' => "devinfo_codec_{$key}", 'text' => $key);
$ACodec_cur = array('all'); $activeAudioCodecs[] ="devinfo_codec_{$key}";
$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";
}
}
}
} }
// Fill Video codecs information
foreach ($allVCodecs as $c => $v) { $siteVideoCodecs = array_intersect_key($systemCodecs, $this->freepbx->Codecs->getVideo());
if (array_search($c,$Sccp_Codec) !=null) { foreach ($siteVideoCodecs as $key => $value) {
$currentcomponent->addoptlistitem('devinfo_sccp_vcodec', "devinfo_codec_"."$c", "$c"); $videoCodecButtons[] = array('value' => "devinfo_codec_{$key}", 'text' => $key);
if (isset($deviceInfo['allow'])) { $activeVideoCodecs[] ="devinfo_codec_{$key}";
if (strpos($deviceInfo['allow'],$c)!== false) {
$VCodec_cur[] ="devinfo_codec_"."$c";
}
}
}
} }
$el = array( $el = array(
"elemname" => "devinfo_sccp_codec", "elemname" => "devinfo_sccp_codec",
"prompttext" => _('Line Audio Codec:'), "prompttext" => _('Line Audio Codec:'),
"helptext" => _("Line Audio Codec"), "helptext" => _("Line Audio Codec"),
"currentvalue" => $ACodec_cur, "currentvalue" => $activeAudioCodecs,
"valarray" => $currentcomponent->getoptlist('devinfo_sccp_codec'), "valarray" => $audioCodecButtons,
"class" => $section_с, "class" => $section_с,
"disable" => 0 "disable" => 0
); );
// Override defaults with $el
$currentcomponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category); $currentcomponent->addguielem($section_с, new \gui_checkset(array_merge($this->guiDefaults['gui_checkset'],$el)), $gn_category);
unset($el); unset($el);
@ -330,8 +246,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
"elemname" => "devinfo_sccp_vcodec", "elemname" => "devinfo_sccp_vcodec",
"prompttext" => _('Line Video Codec:'), "prompttext" => _('Line Video Codec:'),
"helptext" => _("Line Video Codec"), "helptext" => _("Line Video Codec"),
"currentvalue" => $VCodec_cur, "currentvalue" => $activeVideoCodecs,
"valarray" => $currentcomponent->getoptlist('devinfo_sccp_vcodec'), "valarray" => $videoCodecButtons,
"class" => $section_с, "class" => $section_с,
"disable" => 0 "disable" => 0
); );
@ -341,7 +257,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$tt = _("Name or id of linked maibox"); $tt = _("Name or id of linked maibox");
$tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => $this->line_defaults['mailbox'], 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); $tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => $this->line_defaults['mailbox'], 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$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 are planning 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'), $this->line_defaults['incominglimit'], 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category); $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), $this->line_defaults['incominglimit'], 'tt' => $tt, 'level' => 1, 'section' => $section,'category' => $gn_category);
$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.");
@ -433,14 +349,14 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => $this->line_defaults['secondary_dialtone_tone'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select', 'section' => $section,'category' => $gn_category); $tmparr['secondary_dialtone_tone'] = array('prompttext' => _('Secondary dialtone'), 'value' => $this->line_defaults['secondary_dialtone_tone'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'select', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Enable/Disable the `directed` pickup softkey"); $tt = _("Enable/Disable the `directed` pickup softkey");
$tmparr['directed_pickup'] = array('prompttext' => _('Directed pickup'), 'value' => $this->line_defaults['directed_pickup'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['directed_pickup'] = array('prompttext' => _('Directed pickup'), 'value' => $this->line_defaults['directed_pickup'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Should the picked/gpicked-up call be answered automatically"); $tt = _("Should the picked/gpicked-up call be answered automatically");
$tmparr['pickup_modeanswer'] = array('prompttext' => _('Pickup Modeanswer'), 'value' => $this->line_defaults['pickup_modeanswer'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['pickup_modeanswer'] = array('prompttext' => _('Pickup Modeanswer'), 'value' => $this->line_defaults['pickup_modeanswer'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
@ -452,8 +368,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => $this->line_defaults['transfer'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['transfer'] = array('prompttext' => _('Call Transfer'), 'value' => $this->line_defaults['transfer'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Echo cancel"); $tt = _("Echo cancel");
$tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => $this->line_defaults['echocancel'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['echocancel'] = array('prompttext' => _('Echo cancel'), 'value' => $this->line_defaults['echocancel'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
@ -463,23 +379,23 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$select[] = array('value' => 'silent', 'text' => 'Silent'); $select[] = array('value' => 'silent', 'text' => 'Silent');
$select[] = array('value' => 'user', 'text' => 'Cycle'); $select[] = array('value' => 'user', 'text' => 'Cycle');
$tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / Cycle").'<br>'. $tt = _("DND: Means how will dnd react when it is set on the device level dnd can have three states: off / busy(reject) / silent / Cycle").'<br>'.
_("Cycle - dnd that cycles through all three states off -> reject -> silent -> off (this is the normal behaviour)").'<br>'. _("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 - Users can only switch off and on (in reject/busy mode)").'<br>'.
_("Silent - Usesr can only switch off and on (in silent mode)"); _("Silent - Users can only switch off and on (in silent mode)");
$tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => $this->line_defaults['dnd'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['dnd'] = array('prompttext' => _('DND'), 'value' => $this->line_defaults['dnd'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'on', 'text' => 'Yes'); $select[] = array('value' => 'yes', 'text' => 'Yes');
$select[] = array('value' => 'off', 'text' => 'No'); $select[] = array('value' => 'no', 'text' => 'No');
$tt = _("Silence Suppression. Asterisk Not supported"); $tt = _("Silence Suppression. Asterisk Not supported");
$tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => $this->line_defaults['silencesuppression'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category); $tmparr['silencesuppression'] = array('prompttext' => _('Silence Suppression'), 'value' => $this->line_defaults['silencesuppression'], 'tt' => $tt, 'select' => $select, 'level' => 1, 'type' => 'radio', 'section' => $section,'category' => $gn_category);
unset($select); unset($select);
$select[] = array('value' => 'default', 'text' => _('default'));
if (function_exists('music_list')){ if (function_exists('music_list')){
$moh_list = music_list(); $moh_list = music_list();
} else { } else {
$moh_list = array('default'); $select[] = array('value' => 'default', 'text' => _('default'));
} }
foreach ($moh_list as $value) { foreach ($moh_list as $value) {
$select[] = array('value' => $value, 'text' => _($value)); $select[] = array('value' => $value, 'text' => _($value));
@ -506,7 +422,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$devopts = $tmparr; $devopts = $tmparr;
return $devopts; return $devopts;
} }
public function reload_line($id) { public function reload_line($id) {
global $astman; global $astman;

View file

@ -397,10 +397,10 @@ trait ajaxHelper {
$errors = array(); $errors = array();
$i = 0; $i = 0;
$action = isset($request['sccp_createlangdir']) ? $request['sccp_createlangdir'] : ''; $action = isset($request['sccp_createlangdir']) ? $request['sccp_createlangdir'] : '';
// if uncheck all codecs, voicecodecs key is missing so nothing changes in db. // if uncheck all codecs, audiocodecs key is missing so nothing changes in db.
// Unsetting all codecs will now return to chan-sccp defaults. // Unsetting all codecs will now return to chan-sccp defaults.
if (!isset($request['voicecodecs'])) { if (!isset($request['audiocodecs'])) {
$request['voicecodecs'] = array_fill_keys(explode(',',$this->sccpvalues['allow']['systemdefault']),true); $request['audiocodecs'] = array_fill_keys(explode(',',$this->sccpvalues['allow']['systemdefault']),true);
} }
if ($action == 'yes') { if ($action == 'yes') {
$this->initializeTFtpLanguagePath(); $this->initializeTFtpLanguagePath();
@ -499,8 +499,7 @@ trait ajaxHelper {
} }
} }
switch ($key) { switch ($key) {
case 'voicecodecs': case 'audiocodecs':
case 'vcodec':
foreach ($value as $keycodeс => $valcodeс) { foreach ($value as $keycodeс => $valcodeс) {
$save_codec[$i] = $keycodeс; $save_codec[$i] = $keycodeс;
$i++; $i++;
@ -516,6 +515,10 @@ trait ajaxHelper {
); );
} }
break; break;
case 'videocodecs':
// currently not used. To reach this case, name in video codec section of
// server.codec needs to be changed from audiocodecs to videocodecs.
break;
case 'ntp_timezone': case 'ntp_timezone':
$tz_id = $value; $tz_id = $value;

View file

@ -74,7 +74,7 @@ if (empty($sccp_disallow_def)) {
<br>Higher priority enabled codecs are at the top <br>Higher priority enabled codecs are at the top
<br>Precedence for ulaw and alaw, if used, should be set according to your region <br>Precedence for ulaw and alaw, if used, should be set according to your region
<br>If your region uses alaw, it is important that alaw has the highest priority <br>If your region uses alaw, it is important that alaw has the highest priority
<br>To return to chan-sccp defaults, uncheck all codecs."),"Helpful information",true) ?> <br>To return to chan-sccp defaults, uncheck ALL codecs (both Audio and Video)."),"Helpful information",true) ?>
</div> </div>
<?php <?php
$seq = 1; $seq = 1;
@ -87,7 +87,7 @@ if (empty($sccp_disallow_def)) {
. '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> ' . '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> '
. '<input type="checkbox" ' . '<input type="checkbox" '
. ($codec_checked ? 'value="' . $seq++ . '" ' : '') . ($codec_checked ? 'value="' . $seq++ . '" ' : '')
. 'name="voicecodecs[' . $codec . ']" ' . 'name="audiocodecs[' . $codec . ']" '
. 'id="' . $codec . '" ' . 'id="' . $codec . '" '
. 'class="audio-codecs" ' . 'class="audio-codecs" '
. $codec_checked . $codec_checked
@ -131,6 +131,7 @@ if (empty($sccp_disallow_def)) {
$seq = 1; $seq = 1;
echo '<ul class="sortable">'; echo '<ul class="sortable">';
// Although classed as video codecs, all stored under allow so name is audiocodecs.
foreach ($video_codecs as $codec => $codec_state) { foreach ($video_codecs as $codec => $codec_state) {
$codec_trans = _($codec); $codec_trans = _($codec);
$codec_checked = $codec_state ? 'checked' : ''; $codec_checked = $codec_state ? 'checked' : '';
@ -138,7 +139,7 @@ if (empty($sccp_disallow_def)) {
. '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> ' . '<img src="assets/sipsettings/images/arrow_up_down.png" height="16" width="16" border="0" alt="move" style="float:none; margin-left:-6px; margin-bottom:-3px;cursor:move" /> '
. '<input type="checkbox" ' . '<input type="checkbox" '
. ($codec_checked ? 'value="' . $seq++ . '" ' : '') . ($codec_checked ? 'value="' . $seq++ . '" ' : '')
. 'name="videocodecs[' . $codec . ']" ' . 'name="audiocodecs[' . $codec . ']" '
. 'id="' . $codec . '" ' . 'id="' . $codec . '" '
. 'class="video-codecs" ' . 'class="video-codecs" '
. $codec_checked . $codec_checked