Asterisk presence

Business SIP Providers
Provider Plan Details Monthly Rate *
Vonage Business SIP Trunking
  • One provider & nationwide coverage
  • Easily integrated into your existing infrastructure
  • More uptime, flexibility and disaster recovery options
$25.00
Details
8x8 8x8 IP Trunking
  • Unlimited calls to US and Canada
  • Softphone and mobile app available
  • 2012 Market Leader Award
$29.99
Details
Business PBX Solutions
Provider Solution Details
Bicom VoIP Become an ITSP Now!
  • Become a serious competitor in VoIP Immediately
  • FULL Consultancy, Installation, Training & Support
  • Sell Hosted IP PBXs, Biz Lines, Call Centre
  • Turnkey Provisioning at your data center
Details
3CX Software PBX for Windows
  • Windows Software Solution
  • Easy to Install and Manage
  • Auto Configures Phones & Trunks
  • Android, iOS, Windows & Mac clients
Details

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.
  • IMPORTANT: In Asterisk 1.6.2.X in sip.conf you need callcounter=yes for presence to work (http://lists.digium.com/pipermail/asterisk-users/2010-May/248222.html)


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 7931,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 and enable directed pickup. Directed pickup is enabled by adding the following lines to extensions.conf

exten => _*8.,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _*8.,n,Pickup(${EXTEN:2}@PICKUPMARK)

and in sip.conf

notifycid=yes

the notifycid=yes causes asterisk to add a "target uri = callID" to the XML of the SIP notify. Without this target uri the Polycom phone will not do a directed pickup.

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="205"
attendant.resourceList.1.label="205"
attendant.resourceList.2.address="217"
attendant.resourceList.2.label="217"

Following 4 lines added Sept/10
call.directedCallPickupMethod="legacy"
call.directedCallPickupString="*8"

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!



The Previous configuration DOES NOT WORK

When you press the ringing extension, it just calls that extension too. You will have to make a test case within Asterisk to figure out if the extension is ringing or idle.

There are certain gotchas, as Polycom only monitors the extension if the format is "exten@servername" ie. 4567@pbx.domain.com, so you cannot use any special characters like **4567@pbx.domain.com in the address field. If you do, then Asterisk cannot figure out which extension you want to monitor.
Gotchas, are if the other extension is ringing, you then dial that extension, it will pick up that ringing extension. Provided you actually did use the Pickup() function within asterisk.
Polycom should fix this by allowing two values to be entered, the attendant.address is what to send out, and maybe an attendant.monitor value.
This way, we can monitor exten 4567 but send out a different string when the button is pressed.

Anyone out there got a solution for this. !!!!


— See the extra cfg parameters above to enable directed pickup



Cisco Phones CP-79xx BLF configuration

1. Cisco phones BLF work only via TCP, so you need add tcpenable=yes in sip.conf
2. 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


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


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 here

Presence 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


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.
  • IMPORTANT: In Asterisk 1.6.2.X in sip.conf you need callcounter=yes for presence to work (http://lists.digium.com/pipermail/asterisk-users/2010-May/248222.html)


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 7931,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 and enable directed pickup. Directed pickup is enabled by adding the following lines to extensions.conf

exten => _*8.,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _*8.,n,Pickup(${EXTEN:2}@PICKUPMARK)

and in sip.conf

notifycid=yes

the notifycid=yes causes asterisk to add a "target uri = callID" to the XML of the SIP notify. Without this target uri the Polycom phone will not do a directed pickup.

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="205"
attendant.resourceList.1.label="205"
attendant.resourceList.2.address="217"
attendant.resourceList.2.label="217"

Following 4 lines added Sept/10
call.directedCallPickupMethod="legacy"
call.directedCallPickupString="*8"

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!



The Previous configuration DOES NOT WORK

When you press the ringing extension, it just calls that extension too. You will have to make a test case within Asterisk to figure out if the extension is ringing or idle.

There are certain gotchas, as Polycom only monitors the extension if the format is "exten@servername" ie. 4567@pbx.domain.com, so you cannot use any special characters like **4567@pbx.domain.com in the address field. If you do, then Asterisk cannot figure out which extension you want to monitor.
Gotchas, are if the other extension is ringing, you then dial that extension, it will pick up that ringing extension. Provided you actually did use the Pickup() function within asterisk.
Polycom should fix this by allowing two values to be entered, the attendant.address is what to send out, and maybe an attendant.monitor value.
This way, we can monitor exten 4567 but send out a different string when the button is pressed.

Anyone out there got a solution for this. !!!!


— See the extra cfg parameters above to enable directed pickup



Cisco Phones CP-79xx BLF configuration

1. Cisco phones BLF work only via TCP, so you need add tcpenable=yes in sip.conf
2. 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


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


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 here

Presence 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

Created by: juraj, Last modification: Wed 23 of Nov, 2011 (06:03 UTC) by kernelpanic
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+