Provide mechanism to reset codecs to system defaults

Unchecking all codecs will return to chan-sccp defaults
Document this behaviour
Remove various debug code
This commit is contained in:
steve-lad 2021-07-06 16:12:25 +02:00
parent 2e5028f438
commit f929267910
5 changed files with 7 additions and 14 deletions

View file

@ -976,10 +976,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
*/ */
private function saveSccpSettings($save_value = array()) { private function saveSccpSettings($save_value = array()) {
// global $db;
// global $amp_conf;
// $save_settings = array();
if (empty($save_value)) { if (empty($save_value)) {
$this->dbinterface->write('sccpsettings', $this->sccpvalues, 'replace'); //Change to replace as clearer $this->dbinterface->write('sccpsettings', $this->sccpvalues, 'replace'); //Change to replace as clearer
} else { } else {

View file

@ -982,7 +982,6 @@ function cleanUpSccpSettings() {
// 2 special cases deny|permit & disallow|allow where need to parse on |. // 2 special cases deny|permit & disallow|allow where need to parse on |.
$newKeyword = explode("|", $valueArray['Name'], 2); $newKeyword = explode("|", $valueArray['Name'], 2);
if (isset($newKeyword[1])) { if (isset($newKeyword[1])) {
dbug('',$newKeyword);
$newSysDef = explode("|", $valueArray['DefaultValue'], 2); $newSysDef = explode("|", $valueArray['DefaultValue'], 2);
$i = 0; $i = 0;
foreach ($newKeyword as $dummy) { foreach ($newKeyword as $dummy) {

View file

@ -397,6 +397,11 @@ 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.
// Unsetting all codecs will now return to chan-sccp defaults.
if (!isset($request['voicecodecs'])) {
$request['voicecodecs'] = array_fill_keys(explode(',',$this->sccpvalues['allow']['systemdefault']),true);
}
if ($action == 'yes') { if ($action == 'yes') {
$this->initializeTFtpLanguagePath(); $this->initializeTFtpLanguagePath();
} }

View file

@ -578,15 +578,6 @@ $thisSccpView = new class{
} }
} }
$select_opt= $syslangs; $select_opt= $syslangs;
foreach (array_keys($select_opt) as $k => $v) {
if ($k !== $v) {
dbug('sys list is an associative array');
} else {
dbug('sys list is a simple array');
}
}
break; break;
case 'SLT': case 'SLT':
$select_opt= $tftp_lang; $select_opt= $tftp_lang;

View file

@ -73,7 +73,8 @@ if (empty($sccp_disallow_def)) {
<br>Order can be changed by dragging and dropping to indicate priority. This priority applies for all extensions <br>Order can be changed by dragging and dropping to indicate priority. This priority applies for all extensions
<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"),"Helpful information",true) ?> <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) ?>
</div> </div>
<?php <?php
$seq = 1; $seq = 1;