In traditional telephony we are generally using the line supervision feature, more often in enterprise. Supervision feature is used to see the status of someone else’s phone line on our phone (or soft phone). It is useful to check availability prior placing a call to this person or to see if the phone is ringing in order to pickup the line in case the person is not at his desk. In order to put this feature in place we should establish a real time dialog between the phone and the PBX system in order to have the status of the supervised line which is not following the distributed model of IP telephony.
This article is providing some elements to understand how it works and how to configure it on the Asterisk solution.
A legacy PBX can handle line supervision in a very easy way: each line is connected physically to the PBX, this it is really easy to know if the line is busy or not. IP telephony is using a distributed model where nobody else than the phone itself knows if a call is engaged or not. It is therefor necessary to put in place some extra communication in order to keep the information at a central point and enable this supervision feature.
The model used is a subscription model: each phone willing to know the status of a specific line should subscribe to this specific information with a central repository that should be informed of each line status. This whole process should be kept synchronous in order for user to have real time information.
On Asterisk
Asterisk is proposing this supervision feature but some configuration steps are still necessary. Two main points are required: a way to keep track of line status and a way to manage subscriptions. We have two different elements: phone lines (ie SIP/xxx) and phone subscriptions.
In extensions.conf, we create a specific context where we put information on which lines are supervised. A phone can subscribe to one specific context and see the status of each lines described inside.
The configuration can look like:
[blf-sales]exten => 11,hint,SIP/11
exten => 13,hint,SIP/13
[blf-boss]
exten => 11,hint,SIP/11
exten => 13,hint,SIP/13
exten => 14,hint,SIP/14
exten => 19,hint,SIP/19
Here we defined two contexts with various lines supervised. The first parameter is the extension that can be used to call the line in the default phone context. The third parameter is a line (ie SIP/13) but can also be a specific virtual line like a parking slot (ie park:701@parkedcalls).
Once created, the CLI command core show hints can be issued to check the status of each line.
asterisk*CLI> core show hints
asterisk*CLI>
-= Registered Asterisk Dial Plan Hints =-
19@blf-boss : SIP/19 State:Unavailable Watchers 0
14@blf-boss : SIP/14 State:Idle Watchers 0
13@blf-boss : SIP/13 State:Idle Watchers 0
11@blf-boss : SIP/11 State:Idle Watchers 0
13@blf-sales : SIP/13 State:Idle Watchers 0
11@blf-sales : SIP/11 State:Idle Watchers 0
----------------
6 hints registered
Here, the SIP line 19 is a soft phone not yet registered with the Asterisk (we will use it as a supervision client). For each line we could see the identifier, the context, the line and the state of this one. The last information shows the number of subscribed phone to the information.
One of the main complexity with IP telephony is the fact everything is dematerialised. A phone line is not associated to a phone, each phone can use multiple lines… Within Asterisk, we should configure for each line the number of simultaneous calls that it can handle. If a line does not have any limit we will not be able to know when this one is considered as busy. But be careful, this parameter is a limit to the number of call a line can handle at the same time. Each new call to it will be refused if the limit is already reached.
The main configuration in sip.conf looks like:
[general]
notifyringing=yes
notifyhold=no
You can check the “hold” status of a line, but on the release 1.4.4 it was not stable enough, so we suppressed this information. In addition, this suppresses some messages on the network for an information which is maybe not interesting for your users.
For each line that needs to be supervised we add:
call-limit=2
Here, the line can accept 2 calls at the same time, but when the line is engaged we will have a status “On the phone” which is what we are looking for.
On the other hand, subscribers should be allowed to look at line status. We place each line in a specific supervision context, previously defined in our extensions.conf (ie blf-sales and blf-boss):
subscribecontext=blf-boss
On the phone
Each SIP phone on the market is using a proprietary approach for configuration, the documentation is therefor important to consult. The feature is mainly called BLF.
We have used the X-lite softphone for this example. First the “Presence Agent” should be enabled in the configuration, after each line that needs to be supervised can be added. The easiest way for this configuration is to use the specific icon on the screen when a call is engaged with the line we want to supervised.
How it works
Each phone that supervises lines should subscribe to each individual line. The SIP message is a SUBSCRIBE with the To: field containing the URI of the line to be supervised. It can be necessary to make a new registration of the phone since subscription are made when registering the line (usually every hour or so).
Each time the status of a line is changed in the Asterisk, a specific SIP message is sent to all subscribers (SIP NOTIFY).
Here are some screen shots of our soft phone
Every supervised lines are available:

When line 13 calls line 11:

When line 13 calls line 14 :

Conclusion
Asterisk has a nice implementation of the line supervision, but be carreful on the phones that are not all handling well the feature and can use very specific configuration.