📜 ⬆️ ⬇️

Sharpen Astesrisk to work with Cisco BLF

BLF (Busy Lamp Field) - in general, it is a set of indicators on an IP phone that show the status of a line: free or busy.



In this article, we will teach Asterisk to work properly with Cisco phones to display BLF statuses.

Theory


Let's enter the command in the Asterisk console:
asterisk*CLI> core show hints -= Registered Asterisk Dial Plan Hints =- 1196@ext-local : SIP/1196 State:Ringing Watchers 3 1188@ext-local : SIP/1188 State:InUse Watchers 3 5030@ext-local : SIP/5030 State:Idle Watchers 1 

The State column shows, in fact, the state of the line, Watchers - the number of people listening to this line. When the state of the line changes, Asterisk sends a message to the telephone and turns on the telephone. The performance of BLF on Asterisk can first be checked on a soft phone, for example, on DrayTek SoftPhone. After adding the contacts, you can see the indication of the busy line. By default, Asterisk sends such messages that the Cisco phone cannot read, and, accordingly, the BLF does not work for them.
')

Patching Asterisk source codes


Downloading the patch: issues.asterisk.org/jira/secure/attachment/32739/cisco-blf-asterisk.1.8.0.patch
Installing this patch will not compile asterisk.
There is a small typo in the patch, it needs to be fixed.
In line 23, switch (state) is corrected to switch (data-> state) ;
in line 40 of the state, correct to data-> state ;
in line 60 state correct for data ;
in line 66 state corrected to data .

Next, copy the Asterisk source to a folder, for example / usr / src / asterisk.
We put the patch in the channels folder and immediately rename it, for example in patch.
Execute the command:
 patch chan_sip.c patch 

On the request “File to patch”, enter the path where sip.h is located (usually in include / sip / sip.h).
If Asterisk is installed, you must remove it. To do this, stop Asterisk:
 service asterisk stop 

Remove Asterisk:
 yum remove asterisk 

Before installing asterisk, you need to install all the modules for compiling sources, in particular gcc, gcc-c ++, kernel-devel, ncurses-devel, openssl-devel, m2crypto, libssl-devel.
Next, perform:
 ./configure make menuselect --    make make install 

Run:
 asterisk start 

On this with Asterisk done.

Configure phone files config


config.file
 <?xml version="1.0" encoding="UTF-8"?> <device xsi:type="axl:XIPPhone" ctiid="94"> <fullConfig>true</fullConfig> <deviceProtocol>SIP</deviceProtocol> <sshUserId>cisco</sshUserId> <sshPassword>cisco</sshPassword> <devicePool> <dateTimeSetting> <dateTemplate>YMD</dateTemplate> <timeZone>Central Asia Standard Time</timeZone> <ntps> <ntp> <name>PBX-IP Address</name> <ntpMode>Unicast</ntpMode> </ntp> </ntps> </dateTimeSetting> <callManagerGroup> <members> <member priority="0"> <callManager> <ports> <ethernetPhonePort>2000</ethernetPhonePort> <sipPort>5060</sipPort> <securedSipPort>5061</securedSipPort> </ports> <processNodeName>PBX-IP Address</processNodeName> </callManager> </member> </members> </callManagerGroup> <srstInfo> <srstOption>Disable</srstOption> <ipAddr1></ipAddr1> <port1>2000</port1> <ipAddr2></ipAddr2> <port2>2000</port2> <ipAddr3></ipAddr3> <port3>2000</port3> <sipIpAddr1></sipIpAddr1> <sipPort1>5060</sipPort1> <sipIpAddr2></sipIpAddr2> <sipPort2>5060</sipPort2> <sipIpAddr3></sipIpAddr3> <sipPort3>5060</sipPort3> <isSecure>false</isSecure> </srstInfo> <connectionMonitorDuration>120</connectionMonitorDuration> </devicePool> <sipProfile> <sipProxies> <backupProxy></backupProxy> <backupProxyPort></backupProxyPort> <emergencyProxy></emergencyProxy> <emergencyProxyPort></emergencyProxyPort> <outboundProxy></outboundProxy> <outboundProxyPort></outboundProxyPort> <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>2</callHoldRingback> <localCfwdEnable>true</localCfwdEnable> <semiAttendedTransfer>true</semiAttendedTransfer> <anonymousCallBlock>2</anonymousCallBlock> <callerIdBlocking>2</callerIdBlocking> <dndControl>0</dndControl> <remoteCcEnable>true</remoteCcEnable> <retainForwardInformation>false</retainForwardInformation> </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>None</userInfo> </sipStack> <autoAnswerTimer>1</autoAnswerTimer> <autoAnswerAltBehavior>false</autoAnswerAltBehavior> <autoAnswerOverride>true</autoAnswerOverride> <transferOnhookEnabled>false</transferOnhookEnabled> <enableVad>false</enableVad> <preferredCodec>none</preferredCodec> <dtmfAvtPayload>101</dtmfAvtPayload> <dtmfDbLevel>3</dtmfDbLevel> <dtmfOutofBand>avt</dtmfOutofBand> <kpml>3</kpml> <alwaysUsePrimeLine>false</alwaysUsePrimeLine> <alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail> <phoneLabel></phoneLabel> <stutterMsgWaiting>2</stutterMsgWaiting> <callStats>true</callStats> <offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer> <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts> <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig> <poundEndOfDial>false</poundEndOfDial> <startMediaPort>16384</startMediaPort> <stopMediaPort>32766</stopMediaPort> <sipLines> <line button="1" lineIndex="1"> <featureID>9</featureID> <proxy>USECALLMANAGER</proxy> <port>5060</port> <autoAnswer> <autoAnswerEnabled>2</autoAnswerEnabled> </autoAnswer> <callWaiting>3</callWaiting> <sharedLine>false</sharedLine> <messageWaitingLampPolicy>3</messageWaitingLampPolicy> <messagesNumber></messagesNumber> <ringSettingIdle>4</ringSettingIdle> <ringSettingActive>5</ringSettingActive> <forwardCallInfoDisplay> <callerName>true</callerName> <callerNumber>false</callerNumber> <redirectedNumber>false</redirectedNumber> <dialedNumber>true</dialedNumber> </forwardCallInfoDisplay> <!-- ***************************** --> <featureLabel>LineName 5037</featureLabel> <displayName>LineName</displayName> <name>5037</name> <authName>5037</authName> <authPassword>password</authPassword> </line> <line button="2"> <featureID>21</featureID> <featureLabel>Description</featureLabel> <speedDialNumber>Directory Number</speedDialNumber> </line> </sipLines> <externalNumberMask></externalNumberMask> <!-- ***************************** --> <voipControlPort>5060</voipControlPort> <dscpForAudio>184</dscpForAudio> <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy> <dialTemplate>dialplan.xml</dialTemplate> </sipProfile> <commonProfile> <phonePassword></phonePassword> <backgroundImageAccess>true</backgroundImageAccess> <callLogBlfEnabled>1</callLogBlfEnabled> </commonProfile> <vendorConfig> <disableSpeaker>false</disableSpeaker> <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset> <forwardingDelay>1</forwardingDelay> <pcPort>0</pcPort> <settingsAccess>1</settingsAccess> <garp>0</garp> <voiceVlanAccess>0</voiceVlanAccess> <videoCapability>0</videoCapability> <autoSelectLineEnable>0</autoSelectLineEnable> <webAccess>1</webAccess> <daysDisplayNotActive>1,7</daysDisplayNotActive> <displayOnTime>09:00</displayOnTime> <displayOnDuration>12:00</displayOnDuration> <displayIdleTimeout>01:00</displayIdleTimeout> <spanToPCPort>1</spanToPCPort> <loggingDisplay>2</loggingDisplay> <loadServer>10.1.96.31</loadServer> <recordingTone>0</recordingTone> <recordingToneLocalVolume>100</recordingToneLocalVolume> <recordingToneRemoteVolume>50</recordingToneRemoteVolume> <recordingToneDuration></recordingToneDuration> <displayOnWhenIncomingCall>0</displayOnWhenIncomingCall> <rtcp>0</rtcp> <moreKeyReversionTimer>5</moreKeyReversionTimer> <autoCallSelect>1</autoCallSelect> <logServer>10.1.96.31</logServer> <g722CodecSupport>0</g722CodecSupport> <headsetWidebandUIControl>0</headsetWidebandUIControl> <handsetWidebandUIControl>0</handsetWidebandUIControl> <headsetWidebandEnable>0</headsetWidebandEnable> <handsetWidebandEnable>0</handsetWidebandEnable> <peerFirmwareSharing>0</peerFirmwareSharing> <enableCdpSwPort>1</enableCdpSwPort> <enableCdpPcPort>1</enableCdpPcPort> </vendorConfig> <versionStamp>1200501729-ee9247c4-1a10-481c-8fdc-612737c5aadd</versionStamp> <deviceSecurityMode>1</deviceSecurityMode> <idleTimeout>0</idleTimeout> <authenticationURL></authenticationURL> <directoryURL></directoryURL> <idleURL></idleURL> <informationURL></informationURL> <messagesURL></messagesURL> <proxyServerURL></proxyServerURL> <servicesURL></servicesURL> <dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig> <dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices> <dscpForCm2Dvce>96</dscpForCm2Dvce> <transportLayerProtocol>2</transportLayerProtocol> <singleButtonBarge>0</singleButtonBarge> <capfAuthMode>0</capfAuthMode> <capfList> <capf> <phonePort>3804</phonePort> <processNodeName>PBX-ip-address</processNodeName> </capf> </capfList> <certHash></certHash> <encrConfig>false</encrConfig> <advertiseG722Codec>1</advertiseG722Codec> </device> 


Consider the basic lines for BLF
 <line button="2"> <featureID><b>21</b></featureID> <featureLabel>Description</featureLabel> <speedDialNumber>Directory Number</speedDialNumber> </line> 

featureID 21 means that you must use BLF for this Directory Number.
In the /etc/asterisk/sip_general_additional.conf file, add or modify, if any, the lines:
 allowsubscribe=yes notifyhold=yes callcounter=yes notifyringing=yes limitonpeers=yes buggymwi=yes 


Used devices


The following devices were used to organize BLF:
Phones: Cisco 7961, 7962, FreePBX 2.0.2, Asterisk 1.8.11.

Source: https://habr.com/ru/post/159783/


All Articles