[Asterisk-Users] SIP Presence

Faris Raouf asterisk at raouf.net
Thu Jun 1 04:50:44 MST 2006


Forrest Beck wrote:
> Does anyone have a working implementation of SIP Presence?  I have a new
> Grandstream GX-2000 phone with the supported hardware and I am not sure how
> to setup presence with asterisk.  
> 

I've just been through this myself. It is relatively simple once you 
manage to figure it out but really hard until you do!

1) Upgrade to the latest beta firmware for the gpx-2000.
(details here: http://www.voip-info.org/wiki/view/GXP-2000)

2) Assign a speed dial button as type "Asterisk BLF" in the drop down in 
the Basic page of the grandstream web config system and have it watch a 
particular extension. Lets call it extension 100 for the purposes of 
this example. It does not matter what name you give this speed dial 
entry - it is just a label.

In the above step you are effectively telling the grandstream to "watch" 
a special "hint" extension, number 100.

3) Now here's the confusing bit. In extensions.conf you need to use a 
"hint" priority which you need to define in the same section as you have 
your normal extensions defined (you can do it elsewhere but for the 
purposes of this explanation we'll keep things simple).

We are using 100 as our example in step 2. BUT extension 100 does not 
have to exist in your current dial plan! This is a key thing to get in 
your head. And if you do have 100 in your current dial-plan it doesn't 
matter either because adding a hint for that extension will not harm the 
existing extension. You do not need to have your "hint" priority 
anywhere near the lines where you define extension 100 in your dial-plan 
either -- you can have a block of hints anywhere (as long as they are in 
the same section as your normal extensions)

The syntax is:

exten => xxx,hint,sip/yyyyy

where xxx would be 100 in our example.

But what is yyyyy? Basically it is the name of the phone/device you want 
to monitor, as defined between the [ and ] in your sip.conf for that device.

You can monitor more than one phone/device at a time by using a syntax 
like this:

exten => xxx,hint,sip/yyyyy&sip/zzzz

(add as many as you like on that line with a & inbetween)


But lets get specific:

In extension.conf, in the same [heading] as your other sip extensions 
are defined, add:

exten => 100,hint,sip/phone1

(where phone1 is a phone as defined in sip.conf and is what you want to 
watch)

IMPORTANT: It is not necessary for phone1 to be configured as extension 
100 in extensions.conf. "hint" extensions and "real" extensions are 
separate entities. This is crucial to understand. There is no link 
between them. As mentioned previously it is not even necessary for 
extension 100 to be defined previously in extensions.conf at all.

Now, at this point, any device set to watch "hint" extension 100 will be 
alerted to the status of phone1. (In step 2 we set the grandstream to 
watch 100, so it will respond to changes in status on that "hint" 
extension).

It is THAT simple. Only it isn't, because there are some "gotchas".

First of all, in sip.conf you need to have type=peer in your phone's 
definition, NOT type=friend. It just doesn't work if you have 
type=friend for Grandstream phones (polycom phones, on the other hand, 
won't work if you have type=friend -- they have to be type=peer but at 
least hints work with them when set to type=peer)

The other thing you need for granstreams at least is call-limit=1 in 
your phone's definition in sip.conf. You may like to experiment with 
this though, as I'm not 100% sure it really is required. In any case it 
prevents more than one call ever going into the phone at the same time, 
which may not be what you want.

So, having done all this, restart asterisk, then reboot your phones (an 
asterisk restart confuses hints/presence on grandstream phones sometimes)

At the asterisk command line, enter the command: show hints

You should see that extension 100 is shown, and that it was status Idle 
and 1 watcher.

If you use the phone (you have to dial something not just lift the 
handset) and then use "show hints" again you should see status = InUse 
and the red light next to the speed dial button on the "watching" phone 
will light up like magic.

It is wondrous when it works.

Additional info:

When setting up a speed dial in the grandstream gxp-2000 as "asterisk 
BLF" you can also define which "account" you want this to work on. If 
each of the four possible accounts (sip registrations) is connected to 
different asterisk servers (as opposed to all being configured to 
register on the same one), depending on which account you select in the 
Basic page when defining the speed dial, the grandstream will watch the 
extension defined on that account. This allows you to monitor presence 
on up to four different asterisk servers.

In contrast (and VERY annoyingly), Polycom phones always use the account 
defined in in the first account (Line 1) - there does not seem to be any 
way at all to get them to watch extensions on multiple asterisk servers.


Faris.




More information about the asterisk-users mailing list