Content
Asterisk offers a basic presence feature called device state, thanks to the XmlSubTags feature snom phones can take advantage of this feature.
Index:
A snom phone can subscribe to an extention and then parse the NOTIFY sent by Asterisk, this is pretty the same mechanism used in BLF & Pick-Up feature. A phone can receive presence-related NOTIFY subscribing to the PBX against an extension for the presence Event.
Applying some parsing rules to the received NOTIFY a snom phone can associate these states to a monitored extension:
Unlike the BLF feature using the presence Asterisk doesn't includes caller and callee information in NOTIFY message for Ringing and Busy states.
In this example we describe how to configure a function key monitoring another extension following these requirements:
You need to enable the allowsubscribe in your sip.conf and to setup hints for monitored extension in your extensions.conf, take a look on folllowing dialplan that add hints for all 15X extensions:
; route internal calls exten => _15[0-9],1,Dial(SIP/${EXTEN},30) ; internal hints for all 15X Extensions exten => _15[0-9],hint,SIP/${EXTEN}
First of all we need to configure the phone LEDs behavior associating the LED colors.
According with the previous defined rules we need to modify led_on and led_blink_fast settings adding our previously defined states:
led_on=ON BUSY IN_A_CALL CALLING IN_A_MEETING URGENT_INTERRUPTIONS_ONLY DND UNAVAILABLE ACTIVE INACTIVE BE_RIGHT_BACK AWAY SEIZED CONNECTED ON_HOLD OFFHOOK RINGBACK I-Am-Ready AVAILABLE I-Am-Busy PhoneHasCall PhoneHasMissedCalls CurrentIdentityHasVoiceMessages PhoneHasVoiceMessages Away Offline Busy Registered led_blink_fast=RINGING PICKUP PhoneHasCallInStateRinging Ringing Holding
Now we can configure the LED colors:
led_red=BUSY IN_A_CALL CALLING IN_A_MEETING URGENT_INTERRUPTIONS_ONLY HOLDING DND I-Am-Busy Busy Ringing led_green=AVAILABLE I-Am-Ready I-Am-Almost-Ready Registered led_orange=Offline Holding
Configure a function key as an Xml Definition applying the well modified XML Definition in the Number field. Be careful to modify the valiables defined in <initialization> tag (subscr_ext, subscr_proxy, pickup_code.
<general type="AsteriskPresenceField"/> <!-- Initialization: Here we define some variables used in the XML subscr_ext: this the extension of the SUBSCRIBE target subscr_proxy: this is the domain part of the SIP uri to SUBSCRIBE pickup_code: the pickup code to add in front of the extension in order to pickup the call subscr_uri: will be created sip:$(subscr_ext)@$(subscr_proxy) this is the SUBSCRIBE URI --> <initialization> <state value="initial"/> <!-- PLEASE EDIT THE "value" ATTRIBUTE WITH THE RIGHT EXTENSION --> <variable name="subscr_ext" value="153"/> <!-- PLEASE EDIT THE "value" ATTRIBUTE WITH THE RIGHT PROXY IP ADDR --> <variable name="subscr_proxy" value="172.16.18.40"/> <!-- PLEASE EDIT THE "value" ATTRIBUTE WITH THE RIGHT PICKU CODE --> <variable name="pickup_code" value="*8"/> <!-- DO NOT EDIT --> <variable name="subscr_uri" value="sip:$(subscr_ext)@$(subscr_proxy)"/> </initialization> <!-- Define the kind of SUBSCRIBE --> <subscription type="presence" to="<$(subscr_uri)>" for="$(subscr_uri)"/> <!-- Verify the validity of the NOTIFY --> <NotifyParsingRules type="applies"> <level1 translates_to='OK'>/presence/tuple/contact[.="$(subscr_uri)"]</level1> </NotifyParsingRules> <!-- set the monitored extension state --> <NotifyParsingRules type="state"> <!-- if <ep:away/> tag is present se the status to "Away" --> <level1 translates_to="Away">/presence/pp:person/status/ep:activities/ep:away</level1> <!-- when the status is closed set it "Offline" --> <level1-1 translates_to="Offline">/presence/tuple/status/basic[.="closed"]</level1-1> <!-- if <ep:busy/> tag is present se the status to "Busy" --> <level2 translates_to="Busy">/presence/pp:person/status/ep:activities/ep:busy</level2> <!-- if <note> content is "Ringing" set the status to "Ringing" --> <level2-1 translates_to="Ringing">/presence/note[.="Ringing"]</level2-1> <!-- if <note> content is "On Hold" set the status to "Holding" (the phone is holding another call) --> <level2-2 translates_to="Holding">/presence/note[.="On hold"]</level2-2> <!-- if status is open set it as "Registered" --> <level3 translates_to="Registered">/presence/tuple/status/basic[.="open"]</level3> </NotifyParsingRules> <action> <!-- Dial the pickup code only in Ringing (dial is for backward compatibility) --> <dial target="$(pickup_code)$(subscr_ext)" when="on press" states="Ringing"/> <invite target="$(pickup_code)$(subscr_ext)" when="on press" states="Ringing"/> <!-- Dial the extension when Registered --> <dial target="$(subscr_ext)" when="on press" states="Registered"/> <invite target="$(subscr_ext)" when="on press" states="Registered"/> <!-- Nothing in all others status --> </action>
Further Information
Related articles