Partial Revert of 212c437
This commit is contained in:
steve-lad 2021-06-13 09:10:55 +02:00 committed by GitHub
commit 3b5fb64589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,9 +35,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
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');
$settings['cid_num']['value'] = ''; $settings['cid_num']['value'] = '';
$settings['cid_name']['value'] = $label; $settings['cid_name']['value'] = '';
$settings['mailbox']['value']= ''; $settings['mailbox']['value']= '';
// Add $_REQUEST values to settings
if (isset($_REQUEST)){ if (isset($_REQUEST)){
foreach($add_fld as $key => $val) { foreach($add_fld as $key => $val) {
if (!empty($_REQUEST[$key])){ if (!empty($_REQUEST[$key])){
@ -53,10 +54,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
$settings['allow']['value'] = implode(",", $allow_codec); $settings['allow']['value'] = implode(",", $allow_codec);
// parse outboundcid content into cid_num and cid_name sccpline fields // If set, parse outboundcid content into cid_num and cid_name sccpline fields
if (empty($settings['cid_num']['value'])) { if (!empty($settings['cid_num']['value'])) {
$settings['cid_num']['value'] = $id;
} else {
$outboundcid = $settings['cid_num']['value']; $outboundcid = $settings['cid_num']['value'];
if (preg_match('/"(.*)"\s?<(.*)>/', $outboundcid, $matches)) { if (preg_match('/"(.*)"\s?<(.*)>/', $outboundcid, $matches)) {
$settings['cid_num']['value'] = $matches[2]; $settings['cid_num']['value'] = $matches[2];
@ -89,10 +88,15 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$sth->execute(); $sth->execute();
// Redirect to SCCP Phone page. This was last function in add so /*
// should be safe. Prefer to add in Hooks, but is not followed If called from SCCP Phone, redirect to SCCP Phone page on submit.
// even if set for $currentcomponent This was last function in add so should be safe.
Prefer to add in Hooks, but is not followed even if set for $currentcomponent
Do nothing if called from QuickCreateExtension when display is not set
*/
if (isset($_REQUEST['display'])) {
redirect("config.php?display=sccp_phone", false); redirect("config.php?display=sccp_phone", false);
}
return true; return true;
} }