--- Add support for setting "setvar=xxx=xxx" entries

--- Writing sccp.conf also check/create sccp_custom.conf #87
--- Fix the getCodec function. #85
--- Switching around the general deny/permit order. #82
--- Thank Josh2893 for the templet #77
Special thanks for help Diederik de Groot
This commit is contained in:
PhantomVl 2020-11-11 15:16:41 +03:00
parent 932aae5cfd
commit ab6b45350e
7 changed files with 379 additions and 12 deletions

View file

@ -75,6 +75,11 @@
* - Add Warning Information on Server Info Page
* - ADD Reload Line
* - Add Call Map (show Current call Information)
* ---TODO ---
* <vendorConfig>
* <autoSelectLineEnable>0</autoSelectLineEnable>
* <autoCallSelect>0</autoCallSelect>
* </vendorConfig>
*/
namespace FreePBX\modules;
@ -530,7 +535,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
"page" => 'views/server.codec.php'
);
}
if ($this->sccpvalues['sccp_compatible']['data'] >= '433') {
$this->pagedata["advanced"] = array(
"name" => _("Device SCCP Advanced"),
"page" => 'views/form.devadvanced.php'
);
}
break;
case "cisco-sip":
$this->pagedata = array(
@ -974,6 +984,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
$dev_addon = null;
}
$dev_schema = $this->getSccpModelInformation('byciscoid', false, "all", array('model' => $dev_data['SCCP_Vendor']['model_id']));
if (empty($dev_schema)) {
$dev_schema[0]['model'] = "ERROR in Model Schema";
}
$result[] = array('name' => $id_name, 'mac' => $id_name, 'button' => '---', 'type' => $dev_schema[0]['model'], 'new_hw' => 'Y',
'description' => '*NEW* ' . $dev_ids['descr'], 'status' => '*NEW* ' . $dev_ids['status'], 'address' => $dev_ids['address'],
'addon' => $dev_addon);
@ -1530,11 +1543,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
break;
}
foreach ($allCodecs as $c => $v) {
if (array_search($c, $Sccp_Codec) != null) {
if (in_array($c, $Sccp_Codec)) {
$allSupported[$c] = $v;
}
}
if (empty($lcodecs) || (!is_array($lcodecs))) {
if (empty($allSupported)) {
$lcodecs = $allCodecs;
@ -1548,7 +1560,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}
}
}
if ($showDefaults) {
foreach ($allSupported as $c => $v) {
if (!isset($codecs[$c])) {
@ -2041,9 +2052,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case "allow":
case "disallow":
case "deny":
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
break;
case "localnet":
case "permit":
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
$content =$value['data'];
if (strpos($content, 'internal') !== false) {
$content = str_replace(';0.0.0.0/0.0.0.0','',$value['data']);
}
$this->sccp_conf_init['general'][$key] = explode(';', $content);
break;
case "devlang":
$lang_data = $this->extconfigs->getextConfig('sccp_lang', $value['data']);
@ -2056,12 +2073,30 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case "sccp_compatible":
break;
default:
if (!empty($value['data'])) {
$this->sccp_conf_init['general'][$key] = $value['data'];
}
}
}
}
// [Namesoftkeyset]
// type=softkeyset
//
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
// This will add problems when solving problems caused by unexpected solutions from users.
//
if (file_exists($this->sccppath["asterisk"] . "/sccp_custom.conf")) {
$this->sccp_conf_init['HEADER'] = array(
"; ;",
"; It is a very bad idea to add an external configuration file !!!! ;",
"; This will add problems when solving problems caused by unexpected solutions ;",
"; from users. ;",
";--------------------------------------------------------------------------------;",
"#include sccp_custom.conf"
);
}
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
$this->cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
}

View file

@ -0,0 +1,300 @@
<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>
<devicePool>
<dateTimeSetting>
<dateTemplate>D/M/Y</dateTemplate>
<timeZone></timeZone>
<ntps>
<ntp>
<name></name>
<ntpMode>unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<members>
<member priority="0">
<callManager>
<ports>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
</ports>
<processNodeName></processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>
<sipProfile>
<sipProxies>
<registerWithProxy>true</registerWithProxy>
</sipProxies>
<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
<callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
<callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
<callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
<meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
<abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
<rfc2543Hold>false</rfc2543Hold>
<callHoldRingback>1</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>3</anonymousCallBlock>
<callerIdBlocking>3</callerIdBlocking>
<dndControl>0</dndControl>
<remoteCcEnable>true</remoteCcEnable>
<retainForwardInformation>false</retainForwardInformation>
<uriDialingDisplayPreference>1</uriDialingDisplayPreference>
</sipCallFeatures>
<sipStack>
<sipInviteRetx>6</sipInviteRetx>
<sipRetx>10</sipRetx>
<timerInviteExpires>180</timerInviteExpires>
<timerRegisterExpires>3600</timerRegisterExpires>
<timerRegisterDelta>5</timerRegisterDelta>
<timerKeepAliveExpires>120</timerKeepAliveExpires>
<timerSubscribeExpires>120</timerSubscribeExpires>
<timerSubscribeDelta>5</timerSubscribeDelta>
<timerT1>500</timerT1>
<timerT2>4000</timerT2>
<maxRedirects>70</maxRedirects>
<remotePartyID>true</remotePartyID>
<userInfo>Phone</userInfo>
</sipStack>
<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>true</transferOnhookEnabled>
<enableVad>false</enableVad>
<preferredCodec>none</preferredCodec>
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>0</kpml>
<phoneLabel></phoneLabel>
<stutterMsgWaiting>0</stutterMsgWaiting>
<callStats>true</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
<startMediaPort>16384</startMediaPort>
<stopMediaPort>32766</stopMediaPort>
<natEnabled>false</natEnabled>
<natReceivedProcessing>false</natReceivedProcessing>
<natAddress></natAddress>
<sipLines>
<line button="1" lineIndex="1">
<featureID>9</featureID>
<featureLabel></featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name></name>
<displayName></displayName>
<autoAnswer>
<autoAnswerEnabled>0</autoAnswerEnabled>
</autoAnswer>
<callWaiting>3</callWaiting>
<authName></authName>
<authPassword></authPassword>
<contact></contact>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>3</messageWaitingLampPolicy>
<messageWaitingAMWI>0</messageWaitingAMWI>
<messagesNumber></messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>true</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
<maxNumCalls>5</maxNumCalls>
<busyTrigger>4</busyTrigger>
</line>
</sipLines>
<externalNumberMask></externalNumberMask>
<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate></dialTemplate>
<softKeyFile></softKeyFile>
</sipProfile>
<MissedCallLoggingOption>1</MissedCallLoggingOption>
<featurePolicyFile></featurePolicyFile>
<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<defaultWallpaperFile></defaultWallpaperFile>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<enableMuteFeature>false</enableMuteFeature>
<enableGroupListen>true</enableGroupListen>
<holdResumeKey>1</holdResumeKey>
<recentsSoftKey>1</recentsSoftKey>
<dfBit>1</dfBit>
<pcPort>0</pcPort>
<spanToPCPort>1</spanToPCPort>
<garp>0</garp>
<rtcp>1</rtcp>
<videoRtcp>1</videoRtcp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>1</videoCapability>
<hideVideoByDefault>0</hideVideoByDefault>
<separateMute>0</separateMute>
<ciscoCamera>1</ciscoCamera>
<usb1>1</usb1>
<usb2>1</usb2>
<usbClasses>0,1,2</usbClasses>
<sdio>1</sdio>
<wifi>1</wifi>
<bluetooth>1</bluetooth>
<bluetoothProfile>0,1</bluetoothProfile>
<btpbap>0</btpbap>
<bthfu>0</bthfu>
<ehookEnable>0</ehookEnable>
<autoSelectLineEnable>1</autoSelectLineEnable>
<autoCallSelect>1</autoCallSelect>
<incomingCallToastTimer>10</incomingCallToastTimer>
<dialToneFromReleaseKey>0</dialToneFromReleaseKey>
<joinAndDirectTransferPolicy>0</joinAndDirectTransferPolicy>
<minimumRingVolume></minimumRingVolume>
<simplifiedNewCall>0</simplifiedNewCall>
<actionableAlert>0</actionableAlert>
<showCallHistoryForSelectedLine>0</showCallHistoryForSelectedLine>
<kemOneColumn>0</kemOneColumn>
<lineMode>0</lineMode>
<allCallsOnPrimary>0</allCallsOnPrimary>
<softKeyControl>0</softKeyControl>
<settingsAccess>1</settingsAccess>
<webProtocol>0</webProtocol>
<webAccess>0</webAccess>
<webAdmin>1</webAdmin>
<adminPassword></adminPassword>
<sshAccess>0</sshAccess>
<detectCMConnectionFailure>0</detectCMConnectionFailure>
<g722CodecSupport>1</g722CodecSupport>
<handsetWidebandEnable>2</handsetWidebandEnable>
<headsetWidebandEnable>2</headsetWidebandEnable>
<headsetWidebandUIControl>1</headsetWidebandUIControl>
<handsetWidebandUIControl>1</handsetWidebandUIControl>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:00</displayOnDuration>
<displayIdleTimeout>00:10</displayIdleTimeout>
<displayOnWhenIncomingCall>1</displayOnWhenIncomingCall>
<displayRefreshRate>0</displayRefreshRate>
<daysBacklightNotActive>1,7</daysBacklightNotActive>
<backlightOnTime>08:00</backlightOnTime>
<backlightOnDuration>10:00</backlightOnDuration>
<backlightIdleTimeout>00:10</backlightIdleTimeout>
<backlightOnWhenIncomingCall>1</backlightOnWhenIncomingCall>
<recordingTone>0</recordingTone>
<recordingToneLocalVolume>100</recordingToneLocalVolume>
<recordingToneRemoteVolume>50</recordingToneRemoteVolume>
<recordingToneDuration></recordingToneDuration>
<moreKeyReversionTimer>5</moreKeyReversionTimer>
<peerFirmwareSharing>0</peerFirmwareSharing>
<loadServer></loadServer>
<problemReportUploadURL></problemReportUploadURL>
<enableCdpSwPort>1</enableCdpSwPort>
<enableCdpPcPort>0</enableCdpPcPort>
<enableLldpSwPort>1</enableLldpSwPort>
<enableLldpPcPort>0</enableLldpPcPort>
<cdpEnable>true</cdpEnable>
<outOfRangeAlert>0</outOfRangeAlert>
<scanningMode>2</scanningMode>
<applicationURL></applicationURL>
<appButtonTimer>0</appButtonTimer>
<appButtonPriority>0</appButtonPriority>
<specialNumbers></specialNumbers>
<sendKeyAction>0</sendKeyAction>
<powerOffWhenCharging>0</powerOffWhenCharging>
<homeScreen>0</homeScreen>
<accessContacts>1</accessContacts>
<accessFavorites>1</accessFavorites>
<accessVoicemail>1</accessVoicemail>
<accessApps>1</accessApps>
</vendorConfig>
<versionStamp>d902ed5a-c1e5-4233-b1d6-a960d53d1c3a</versionStamp>
<loadInformation></loadInformation>
<phoneServices useHTTPS="false">
<provisioning>2</provisioning>
<phoneService type="1" category="0">
<name>Missed Calls</name>
<url>Application:Cisco/MissedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Received Calls</name>
<url>Application:Cisco/ReceivedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="1" category="0">
<name>Placed Calls</name>
<url>Application:Cisco/PlacedCalls</url>
<vendor></vendor>
<version></version>
</phoneService>
<phoneService type="2" category="0">
<name>Voicemail</name>
<url>Application:Cisco/Voicemail</url>
<vendor></vendor>
<version></version>
</phoneService>
</phoneServices>
<userLocale>
<name></name>
<uid>1</uid>
<langCode></langCode>
<version></version>
<winCharSet>utf-8</winCharSet>
</userLocale>
<networkLocale></networkLocale>
<networkLocaleInfo>
<name></name>
<version></version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL></authenticationURL>
<messagesURL></messagesURL>
<servicesURL></servicesURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<proxyServerURL></proxyServerURL>
<secureAuthenticationURL></secureAuthenticationURL>
<secureMessagesURL></secureMessagesURL>
<secureServicesURL></secureServicesURL>
<secureDirectoryURL></secureDirectoryURL>
<secureInformationURL></secureInformationURL>
<secureIdleURL></secureIdleURL>
<transportLayerProtocol>1</transportLayerProtocol>
<TLSResumptionTimer>3600</TLSResumptionTimer>
<phonePersonalization>1</phonePersonalization>
<autoCallPickupEnable>true</autoCallPickupEnable>
<blfAudibleAlertSettingOfIdleStation>0</blfAudibleAlertSettingOfIdleStation>
<blfAudibleAlertSettingOfBusyStation>0</blfAudibleAlertSettingOfBusyStation>
<dndCallAlert>1</dndCallAlert>
<dndReminderTimer>5</dndReminderTimer>
<advertiseG722Codec>1</advertiseG722Codec>
<rollover>0</rollover>
<joinAcrossLines>0</joinAcrossLines>
<capfAuthMode>0</capfAuthMode>
<capfList></capfList>
<certHash></certHash>
<encrConfig>false</encrConfig>
<sshUserId></sshUserId>
<sshPassword></sshPassword>
</device>

View file

@ -1962,4 +1962,19 @@ and open the template in the editor. Base Version before all crash :-)
</page_group>
<page_group name="sccp_hw_addv_device">
<label>SIP Device config</label>
<item type="IED" id="1" seq="0">
<label>Set Vars</label>
<name>setvar</name>
<input value="NONE" field="setvar">
<options placeholder="inventoryNumber=AB123443" />
<class>col-md-9</class>
</input>
<add_pluss>+</add_pluss>
<help></help>
</item>
</page_group>
</root>

View file

@ -683,6 +683,7 @@ function InstallDB_fillsccpdevmodel()
"('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, ''), ('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, ''), ('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, ''), ('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, ''), ('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, ''), ('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, ''),".
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),".
"('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),".
"('9951-sip', 'CISCO-SIP', 1, 1, 'sip9951.9-2-2SR1-9', 'loadinformation537', 1, 'SEP0000000000.cnf.xml_99xx_sip_template'),".
"('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
$check = $db->query($sql);
if (db::IsError($check)) {

View file

@ -80,7 +80,7 @@
<input type="text" class="form-control" id="new_vendor" name="new_vendor" value="CISCO">
</div> </div></div>
<div class="row"><div class="col-md-12">
<span id="new_vendor-help" class="help-block fpbx-help-block">Help.</span>
<span id="new_vendor-help" class="help-block fpbx-help-block">Use "CISCO" for the Skinny Client Control Protocol and "CISCO-SIP" for the CISCO Sip Protocol</span>
</div></div></div>
<div class="element-container"><div class="row"> <div class="form-group"><div class="col-md-3">
@ -88,10 +88,10 @@
<i class="fa fa-question-circle fpbx-help-icon" data-for="new_dns"></i>
</div><div class="col-md-9">
<select name="new_dns" id="new_dns">
<option value="1">Phone - no sidecars.</option>
<option value="1" selected='selected'>Phone - no sidecars.</option>
<option value="2">Phone - one sidecar.</option>
<option value="3">Phone - two sidecars.</option>
<option value="0" selected='selected'>Sidecar</option>
<option value="0">Sidecar</option>
</select>
</div> </div></div>
<div class="row"><div class="col-md-12">

View file

@ -0,0 +1,16 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
?>
<form autocomplete="off" name="frm_advanced" id="frm_adddevice" class="fpbx-submit" action="" method="post" data-id="hw_edit">
<input type="hidden" name="category" value="deviceadvanced_form">
<input type="hidden" name="Submit" value="Submit">
<?php
echo $this->showGroup('sccp_hw_addv_device', 1, 'sccp_hw', $def_val);
?>
</form>

View file

@ -54,7 +54,7 @@ if (!empty($_REQUEST['id'])) {
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Audio (allow)") ?></label>
<label class="control-label" for="codecw"><?php echo _("Allow (audio)") ?></label>
</div>
<div class="col-md-9">
<div>
@ -104,7 +104,7 @@ if (!empty($_REQUEST['id'])) {
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="codecw"><?php echo _("Video (allow)") ?></label>
<label class="control-label" for="codecw"><?php echo _("Allow (video)") ?></label>
</div>
<div class="col-md-9">
<div>
@ -154,7 +154,7 @@ if (!empty($_REQUEST['id'])) {
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="sccp_disallow"><?php echo _("Codec Disallow") ?></label>
<label class="control-label" for="sccp_disallow"><?php echo _("Disallow") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="sccp_disallow"></i>
</div>
<div class="col-md-9 radioset">