Asterisk SLA (Shared Line Appearances) – Part 1

Terminology and SLA Concepts

Terminology
We have attempted to use the correct terminology (as recognised throughout the telephony industry) within the explanations on this web page. However, as it is so important to be clear about the meaning of the terminology used here, it seemed like a good idea to set it out explicitly at the start:

  • Asterisk Server or Asterisk PBX refers to the Asterisk server that is being used as a PBX or Business Phone System. In this role, it would have some trunk lines connecting it to the public telephone network (PSTN) and some extensions that would typically be used as desk phones. The trunks could be analogue lines, ISDN (PRI or BRI), SIP trunks, etc.
  • Asterisk SLA feature refers to the enhancements added in version 1.4 to support shared line appearances, including the new configuration file sla.conf
  • BLF (Busy Lamp Field) originally referred to a panel of lamps showing the status of every extension. This would be located alongside the receptionist’s phone so they could see at a glance which extensions were in use. The BLF terminology has come through into modern phones to refer to the functionality of a having a lamp indicating the current status of another phone on the system.
  • Extensions or extension phones are the local phones that connect directly to the PBX. In Asterisk, these could be IP phones, softphones, analogue phones (POTS) etc. Asterisk SLA documentation tends to refer to these as “stations”. (Note: Don’t be confused by the configuration file extensions.conf which contains the “dial plans” for the Asterisk PBX and does not contain a list of extensions)
  • Key Telephone System (also known as KSU) is a legacy business phone system still used extensively by many small businesses. It shows the status of the trunk lines on every desk phone using a number of line keys. The trunk lines on KSU’s would almost always be analogue. Key Telephone Systems – Wikipedia
  • Shared line keys are the combined key/lamp buttons on a phone-set that show the status of a trunk line and can be used to access that line (e.g. to make a call on that line or answer a ringing call on that line). Originally found on the key telephone units (KTU’s) of key telephone systems, but inherited through to modern IP phones.
  • SLA (Shared Line Appearances) are explained in a paragraph below
  • Trunks or “trunk lines” are the lines that link the Asterisk PBX to the public telephone network (the PSTN)

You may also find this link useful:

Business Telephone Systems – terminology (BBC website guide)

General principles of operation of Shared Line Appearances
The shared line key should have a lamp either under the key or next to it. At any given moment, the lamp shows the status of the corresponding line – this is shown on every phone that has access to the line and is equipped with the shared line key feature.

When an incoming call arrives, it may ring one or more of the extension phones, but it will also appear as a flashing light on the lamp next to the relevant shared line key. If a user wants to answer the call when it is ringing they simply press the button for that line. After the call has been answered, the lamp for that line will be on continuously. Other users can join the call by pressing the button for that line – in effect they become conferenced into the call. Calls can be parked (put on hold) and then any user can retrieve the call by pressing the button for that line. When the call ends, the lamp for that line goes out.

Calls are transferred by first putting the call on hold, then telling the other user to pick up the call on the relevant line. For example, if user A wants to transfer the call on line 2 to user B, they would press the “Hold” button on their phone, then call user B and tell user B to pick up the call on line 2. User B would end the call with user A and immediately press the shared line key for line 2.

When a user wants to make an outbound call, they press the button for any of the trunk lines that are not already in use. It is easy to see which lines are free because the lamp will not be on. As soon as they press the button, the lamp for that line comes on (on every phone) and the user who selected the line hears dial tone. They dial the number and make the call.

What does Asterisk support in terms of BLF and SLA?

Busy Lamp Field vs Shared Line Appearance
It is easy to think that one status lamp is much the same as another on a telephone system. However, the distinctions between Busy Lamp Field and Shared Line Appearance lamps for Asterisk is of great importance. A Busy Lamp Field is normally used to show the status of extensions whereas SLA is essentially showing the status of trunk lines.

Asterisk support for BLF
Asterisk uses “hints” to support basic BLF functionality. These are lines within the dial plan in extensions.conf that map a nominal “name tag” with a specific device whose state is known to Asterisk. If the device you want to monitor is an extension phone, then the name tag is likely to be the extension number. It is recommended that you use the subscribecontext parameter in sip.conf to avoid any possible confusion about the location of hints in extensions.conf.

extensions.conf example:

exten => 2001,hint,SIP/2001
exten => 3002,hint,Zap/6

BLF involves a cooperation between the IP phone and the Asterisk server. Asterisk supports BLF through the use of hints in the dial plan, but the phone must subscribe (using SIP SUBSCRIBE requests) to participate. The subscription it sends will be associated with a particular key/lamp on the phone-set. On the Aastra and Grandstream GXP2000 phones this is done using the programmable keys (Grandstream calls them Multi-Purpose keys) by setting them to be of type BLF and then setting the value field to match the name tag used in the hint e.g. the extension number of the phone you want to monitor.

Asterisk support for SLA
Support for SLA was introduced in Asterisk version 1.4 after a lot of requests and general disgruntlement in Digium and other forums. If you are wondering why there is such demand for an old technology like SLA to be available on very new technology like Asterisk and IP phones, click here

The documentation for Asterisk SLA provided on the wiki and by Digium is somewhat limited and it is not altogether obvious how to use it. I suspect it is not widely used and that many of the resellers who were clamouring for it were not very impressed when they saw the result – it has to be said that the Asterisk implementation of SLA does not work seemlessly with any of the IP phones used in our tests. With one IP phone we tried it did not work at all. Circumstantial evidence suggests that some of the other VoIP solution providers – Broadsoft, PBXnSIP, Sylantro etc – have found much better ways to integrate SLA with commonly available IP phones than Digium has managed. I would be very pleased to hear your views on this or any other aspect of SLA and the advice available on this web page – send me an email at info(AT)smartvox.co.uk.

The Asterisk SLA feature relies on hints in much the same way as described above for BLF. The control of the key-lamps on the IP phone requires a SIP subscription to be established with the Asterisk server. All the IP phones we tested could only do this using a key programmed for the BLF function and not with a key programmed as a “shared line”. This is hugely disappointing and leaves you thinking there must be a better way of doing SLA, but Digium haven’t yet discovered what it is.

So, to make Asterisk SLA work, you must configure BLF function keys on the IP phone, hints in the extensions.conf file, entries in the SLA.CONF file and dial plans to handle inbound trunk calls and outbound dialling in extensions.conf. To get the best user experience, a little care is also required with other configuration options on the IP phones. Unfortunately, some makes and models of IP phone are much better suited to Asterisk SLA than others. For example, the Linksys SPA941 does not play nicely at all with Asterisk SLA because it doesn’t have suitable programmable keys. (Note, later models sold under the Cisco Small Business brand such as the SPA303 include options to reconfigure the line keys as BLF and Speed Dial buttons).

Shared Line Appearances and IP Phone Line keys
First the bad news. Phones like the Aastra 53i, the Grandstream GXP2000 and Linksys SPA941 have permanently assigned line keys. If you think the Phone’s own Line Keys can be directly mapped to the trunk lines on a small Asterisk PBX, then prepare to be disappointed.

For a more detailed discussion about the different types of line keys and buttons on a typical IP phone, please refer to the section below Programmable Keys vs Line Keys.

Programmable keys to the rescue
Now the slightly better news. Most IP phones have programmable keys that can be used with the Asterisk Shared Line Appearance feature. The Aastra range of IP phones is one example. Smartvox have tested the feature using the Aastra 53i, but the slightly higher spec 55i and 57i models would actually be more appropriate because they have a better display and more keys. We have also tested SLA with a Grandstream GXP2000 (software version 1.1.6.16), a Snom 360 and a Linksys SPA941. On the Grandstream you use the “Multi Purpose Keys” which are shown under the Basic Settings tab. The Snom 360 has various fixed assignment keys, but also has a bank of 12 programmable keys. To get the Snom to work with Asterisk SLA, it once again proved necessary to set the key type as “BLF”, even though the options include both “line keys” and “shared line keys”.

As mentioned above, the Linksys SPA941 does not have programmable keys so it is virtually impossible to configure it to work with the Asterisk SLA feature.

Programmable Keys vs Line Keys
CloseUp53iControlsProgrammable keys are not the same as the “line keys” on a multi-line phone. The line keys generally represent channels from the phone to the PBX (or possibly direct to the VoIP service provider). Each line key can beassociated with a different VoIP account. In use, each line key will be associated with a different call (when more than one call is connected to the phone). However, they do not represent trunk lines – if you start thinking that they do while trying to configure Asterisk SLA it is likely to lead to your brain exploding or your needing to lie down in a dark room for some time.

To appreciate the difference, just think what happens when you make an internal call – it uses the first line on the phone to connect to the PBX, but it does not use the first trunk on the PBX. If you put a call on hold and make an enquiry call to a colleague, it uses the second line on your IP phone, yet that enquiry call has absolutely no cast-iron connection with trunk line 2 on the PBX (even if the call that is on hold is using trunk line 1).

The line keys on those IP phones tested by the author simply could not be programmed to have all the characteristics required to correctly participate in the Asterisk SLA system. The conclusion reached by the author is that phone line keys alone cannot be used for Asterisk Shared Line Appearances. They cannot always give you a one-to-one mapping between each line key and each shared trunk on the PBX. In particular it is very unlikely that you can make Asterisk control the lamps on such line keys correctly. Instead use a group of “programmable keys”. This provides a useable solution and keeps the configuration reasonably simple. However, it is usually possible to make the line keys act as if they were shared line keys for a subset of functions. In particular, to make an outbound call on a specific trunk the line keys can mimic the behaviour of the equivalent shared line keys provided the phone has an auto-dial function. More details are given later – see On-hook dialling and use of the phone’s own line keys.

On this web page we concentrate mainly on showing you how to configure basic SLA operation centred around the use of programmable keys configured for Asterisk SLA. This generally means setting the programmable keys for the BLF function.

Please feel free to contact Smartvox Limited if you want to discuss this in more detail or would like a quotation for an installed solution. Call John on 01727-221221 or email us at info(AT)smartvox.co.uk.

Prerequisites for Asterisk SLA

Asterisk version 1.4.17 or later
It took a while for Digium to fix some of the bugs in SLA and versions earlier than 1.4.17 are likely to contain bugs, some of which have a serious impact on the reliability of SLA.

Single channel trunk lines
The way that SLA works means that it only makes sense if the trunk lines represented by each key/lamp are single channel “circuits”. That is, each trunk line can only carry one call at a time. If your trunks are analogue lines then this will already be the case anyway (after all, the whole concept was inherited from key telephone systems that worked with analogue circuits).

If you want to use SLA with a SIP trunk, or perhaps a BRI trunk, capable of carrying multiple simultaneous calls then you will have to do some tricks in the dial plan to identify if a call is the first, the second etc on that trunk. The trunk number can usually be identified by inspecting the value of ${CHANNEL} – this is an internal Asterisk channel variable. The examples shown here assume that each trunk, even when the trunk is a SIP connection, is a single channel device or connection.

Programmable keys on the IP phones
The programmable key must be able to operate in a role where it subscribes to call event notifications for a specific device ID. The lamp next to it must show the state of the device that has been subscribed to. When pressed, the key must issue an INVITE (i.e. try to make a call) to the device ID that has been programmed for that key. It can use the authorisation credentials of the main account on the phone when subscribing and calling. The BLF key type is suitable on Aastra 5x, Grandstream GXP2000 and Snom 360 phones.

Just because a phone-set does not have the correct type of programmable keys, this does not mean that it cannot participate at all in the SLA system. A phone that does not have suitable buttons can still be included in the “ring group” as defined in SLA.CONF and it will ring when an incoming call arrives on the trunk line. The user can answer the call and Asterisk will correctly show the line status as “in use” on all the other stations which do have suitable status lamps. The other phones can join the first one in a conference by pressing their trunk line buttons. Through cunning workarounds in the dial plan it should even be possible for the incompatible phone to make an outbound call using one of the trunk lines and for the status lamps on the other phones to be updated correctly.

Manual configuration of Asterisk conf files
This is not mandatory for SLA, but it is assumed in the explanations given here. At Smartvox we have always preferred manual configuration of conf files over any of the GUI interfaces such as FreePBX or AsteriskNow. It gives far more flexibility and forces you to understand how the systems work in detail. It also means that the only bugs you have to contend with are those in the core program plus those in your own configuration!

Autocontext
In keeping with the strategy of manual configuration, the “autocontext” parameter is not used in the examples described on this web page. Autocontext is an optional parameter in SLA.CONF that automatically and dynamically creates entries in the dial plan of Asterisk. We recommend that autocontext is not used – at best, it saves you typing a few lines in the dial plan, but the penalties you then pay in terms of inflexibility in the dial plan leading to a poor user experience (not to mention an annoying quirk whereby the “dialplan reload” command will erase all the auto-created entries) completely outweigh the minor benefits of less typing. For the sake of those readers who are too timid to discard autocontext, we will point out the parts of the dial plan where it could be used, but generally all the descriptions given in this article assume that autocontext is disabled. When a sample of dial plan is shown that is incompatible with autocontext we will bring this to your attention.

For part 2 of this article, click here

1 thought on “Asterisk SLA (Shared Line Appearances) – Part 1”

Comments are closed.