Asterisk presence
Current CVS -HEAD provides some support of SIP presence as defined in RFC 3856 - A Presence Event Package for the Session Initiation Protocol (SIP). The release version (1.0.9) has some support too.
To support this, you have to somehow tell which SIP user is mapped to the extension mentioned. A "hint" priority is used to describe this, as in this example:
exten => 100,hint,SIP/peername
(it says, that for presence purposes, extension 100's presence should be mapped the SIP peer)
- IMPORTANT: In Asterisk 1.4 the inner workings of the hint functionality have slightly changed. It is now imperative that you set a call-limit (even if it's an arbitrarily-high value like 100) and/or the new limitonpeers value in sip.conf. Presence will not work without this. If you are using friend instead of peer, you will need limitonpeers = yes as well as a call-limit statement (new in Asterisk 1.4) for each SIP device
- If you do not add a hint, the extension will be free ("open") always, more or less.
- If you add incominglimit=1 to your peer (in Asterisk 1.2 only) in sip.conf, the SIP channel will notify you when that extension is busy.
Extension and device state combined, no user state!
Asterisk - with or without the patch - does not currently support PUBLISH method for publishing presence documents in Presence Information Data Format (PIDF) defined in RFC 3863, but it can generate NOTIFY to SUBSCRIBEd users when REGISTER occurs and also when the client disconnects.This works for example with Xten's Eyebeam client, but can also work with several other phones that support SIP presence. Due to the lack of PUBLISH method support, there's no support of extended states (Away, Do not disturb, Busy). You can subscribe to extension state for any channel that supports device state notification. In CVS head, the Agent channel, SIP and IAX2 supports it.
In order to fix this, we need a user abstraction in Asterisk, something that will be worked on in development version 1.3.
Phones known to work with the current implementation of SIP Presence
- Snom (various models)
- Polycom IP30x/IP50x/IP600
- Xten EyeBeam
- Grandstream GXP2000 (Firmware >= 1.0.1.13)
- Aastra 480i
- Aastra 9133i
- Thomson ST2030
- Linksys SPA962/932 - Tutorial
- Jin302 (Firmware > 1.7)
- Cisco CP-79xx (tested on 7965 and 7945) - Tutorial
Specific Phone Configuration
Polycom Phones (updated for 3.2.X firmware with asterisk 1.6.1 Jan/2010)
With SIP 3.2.X firmware (available on the Polycom download site) and Asterisk 1.6.1, Polycom phones now support a full featured BLF showing statuses of Ringing, Inuse and Online and one touch directed call pickup.On the asterisk side all that needs to be done is to add a hint to the extension. On the phone side for each line that is going to be monitored add lines like the following to the phone's cfg file.
attendant.reg="1"
attendant.resourceList.1.address="sip:205@192.168.1.102"
attendant.resourceList.1.label="205"
attendant.resourceList.2.address="sip:217@192.168.1.102"
attendant.resourceList.2.label="217"
Assuming my server is at 192.168.1.102, this will add two BLF lines to the phone for extensions 205 and 217. Calls incoming to those extensions will show a blinking green led on the monitoring phone, pressing the hard key will pick the call up, if it is answered elsewhere the led will change to solid red. AFAIK this cannot be configured via the phones web gui, you must use the cfg files. You can also use versions of Asterisk older than 1.6.1 if you remove the restriction on what asterisk thinks Polycom phones can handle. Look in chan_sip.c for
if (strstr(p->useragent, "Polycom")) {
p->subscribed = XPIDF_XML;
and change that line to
p->subscribed = DIALOG_INFO_XML;
To enable presence on the Polycom phones you must add a contact to the contact directory. The CONTACT parameter must match the extension of the phone you wish to monitor and the WATCH BUDDY parameter must be set to "enabled". Also, make sure that the first line of the Polycom is registred with your Asterisk server. Polycom tends to use the configuration from the first line for all subscriptions.
With SIP v1.5.2, The Polycom phones may "forget" their subscription for presence information, and return a 450 error to the presence notification. There is no indication on the phone that this has happened, except that the buddy status no longer changes. The only workarounds is to this is to reboot the phone or toggle the WATCH BUDDY parameter to disabled, then to enabled. This bug does not affect other operations on the phone.
Note: There is a quoted limit of 8 (I've found an actual limit of 7) watchable buddies, so if you go to buy the attendant console solution, don't expect to be able to monitor more than 7 other extensions. (see below)
Note: As of firmware version 1.6.6 the limit has been raised on the 601 to 48 watchable buddies. Still 8 on the 501s tho. Yay polycom!
Cisco Phones CP-79xx BLF configuration
1. Cisco phones BLF work only via TCP, so you need add tcpenable=yes in sip.conf2. chan_sip.c must be patched. I do patch for Asterisk 1.6.0.18 patch for chan_sip.c
3. in SEPMAC.cnf.xml config of cisco phone just add speed dial lines, for example:
<device>
....skip....
<sipProfile>
....skip....
<sipLines>
<line button="2">
<featureID>21</featureID>
<featureLabel>one hundred</featureLabel>
<speedDialNumber>100</speedDialNumber>
</line>
</sipLines>
</sipProfile>
</device>
Parking and BLF
This can be achieved in asterisk 1.2 with a patch, and is built in to asterisk 1.4.Parking BLF in Asterisk 1.2
- Patch/bug 5779 added hint support for the Local channel construct which allows for monitoring of the parking lot/ parked calls (by checking for existence of a dialplan extension).
- NOTE: In order to set up a parking BLF with this patch in Asterisk 1.2.X, you must set up the following in the context where your SIP phone registers:
exten => 701,1,ParkedCall(701)
exten => 701,hint,Local/701@ParkedCalls
exten => 701,hint,Local/701@ParkedCalls
Parking BLF in Asterisk 1.4
- NOTE: In order to set up the built-in parking BLF functionality in Asterisk 1.4, you must set up the following in the context where your SIP Phone registers...
include => parkedcalls
exten => 701,1,ParkedCall(701)
exten => 701,hint,park:701@parkedcalls
exten => 701,1,ParkedCall(701)
exten => 701,hint,park:701@parkedcalls
This differs from the syntax originally described in the patch/bug report for 1.2 above. If you are using metermaid patch with Asterisk 1.2.X and decide to upgrade to 1.4 expecting it to 'just work' you are in for a harsh and poorly documented surprise.
Update for Asterisk 1.6 (under development)
Russel (Digium) has implemented a DEVSTATE function that is described here in more detail. There is a new version that works with 1.4 herePresence across PBXs
Nuitari wrote a PHP script which connects to the manager of multiple PBXs and uses Russel's (Digium) devstate to set blf across PBXs. You can find it here
See also
- Asterisk Presence for Cisco 79x1 Phones
- Asterisk standard extensions
- Asterisk cli show hints
- Asterisk SIP Messaging: A hack/patch
- Asterisk Jabber
- BLF
- Asterisk SLA
- Asterisk func Devstate
- Unified communications DialApplet

Comments
333Polycom and Enhanced BLF to work?
I placed this line in sip.cfg
<attendant.reg="1" attendant.resourceList.1.address="sip:2849@asterisk-server" attendant.resourceList.1.label="2849" />
and modified Asterisk to (BTW: not changed as of * 1.6.1.6)
if (strstr(p->useragent, "Polycom")) {
p->subscribed = XPIDF_XML;
and change that line to
p->subscribed = DIALOG_INFO_XML;
The monitoring phone rings when exten 2849 is called and it show Pickup, Silence on the phone menu, but I cannot pick the line up.
What am I doing wrong?
333Re: Polycom BLF limits
Are you saying that if you have a directory file with 300 people in it, even if you only have, say, 14 of them marked with <bw>1</bw>, that if you attach an <sd>N</sd> tag to all 300 extensions, this will cause the phone to crash?
I mean, you can only assign as many <sd> tags as you have BLF keys, period?
333Polycom BLF limits
333polycom phones
to set up asterisk for buddy list notifications (presence)
-make the following changes to the extensions.conf file
exten => 1001,hint,SIP/1001
repeat this procedure for all the other extensions that need to advertise themselves
-reload the extensions
asterisk -rx "extensions reload"
to set up polycom phones with buddy list and ready for buddy list notifications
-modify the <macaddress>-directory.xml file to look something like this (change it accordingly with the needed extensions):
NOTE: the extension the phone is using should not be on this list
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<directory>
<item_list>
<item>
<fn>X-Lite</fn> ;first name
<ln>1001</ln> ;last name
<ct>1001</ct> ;actual extension
<sd>1</sd> ;speed-dial index
<rt>6</rt> ;ring type
<dc/> ;divert contact - usually blank
<ad>0</ad> ;auto divert
<ar>0</ar> ;auto reject
<bw>1</bw> ;enables buddy watching - used to set up presence
<bb>0</bb> ;buddy block - blocks this contact from watching this phone
</item>
<item>
<fn>501</fn> ;first name
<ln>1002</ln> ;last name
<ct>1002</ct> ;actual extension
<sd>2</sd> ;speed-dial index
<rt>5</rt> ;ring type
<dc/> ;divert contact - usually blank
<ad>0</ad> ;auto divert
<ar>0</ar> ;auto reject
<bw>1</bw> ;enables buddy watching - used to set up presence
<bb>0</bb> ;buddy block - blocks this contact from watching this phone
</item>
</item_list>
</directory>
-modify the /srv/tftp/sip.cfg file making the following changes (this will enable the phone to watch the status of the other devices):
feature.1.name="presence" feature.1.enabled="0"
it should look like this:
feature.1.name="presence" feature.1.enabled="1"
<presense pres.reg=""/>
it should look like this:
<presense pres.reg="1"/>
-powercycle the phones
333polycom phones 2
After enabling presence on the sip.conf file then restarting the phones, it all worked.
333
What did you try? Did you subscribe to a SIP-URI without user name?
I'm getting "BAD EVENT" for all SUBSCRIBE-Requests
-solved-
333One Question
Can I send a Subscribe for a whole domain, let's say SIP:domain.de and get notified when any user who belongs to this domain (SIP:anybody@domain.de for example) goes online?
If someone knows this, please tell me!
333Presence across servers
333Line status monitor
333Line status monitor
Asterisk handle well the status of the line but the phone doesn't show it and I don't find any information about the configuration needed by the SPA942.
If somebody has already setup thi feature on this phone please feel free to tell me :)