Beruflich Dokumente
Kultur Dokumente
Support
Contact Us
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.
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. 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.
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.
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.
About the examples and conf file samples used in this article
The following sections will guide you through the setup of a small Asterisk system using shared line appearances. Each step is explained to show how it works. The dial plan examples will start with a fairly simple configuration and we will then gradually improve the dial plan to make it handle a broader range of user actions. All examples are based on a setup with two IP phones being used as extensions (or stations) and two shared trunk lines. The device types used for the trunk lines are not completely fixed and may vary a little from example to example this is to show you how the configuration would be done for different technologies. For example, we will illustrate how to use zap FXO trunks, Pika FXO and a single channel SIP account such as you might have with a VoIP service provider.
The examples are taken from a test rig using a Grandstream GXP2000 configured as extension 4001 and an Aastra 53i configured as extension 4003. Details for other makes and models of phone will be added as and when those phones become available for inclusion in our test rig. If you are in a position to provide an IP phone on loan that you would like to see included then please contact John using the phone or email contact details provided on this web site. Dial patterns used in the examples The dial plans on the test rig are based on the assumption that internal extensions all have 4 digit numbers - analogue extensions are 3001, 3002, etc and IP phones are 4001, 4002, 4003 etc. PSTN numbers are assumed to start with zero and to be more than 5 digits long.
Devices The device parameter has a different role in trunks than it has in stations. For the trunks, it tells Asterisk how to get access to the relevant trunk line when the user wants to make a call. For the stations, it tells Asterisk what device to ring when an inbound call arrives on a trunk. For greatest flexibility, we recommend that you set the trunk device to "Local" with a start point in your dial plan similar to the example below.
Device The device parameter tells Asterisk what to do when a user presses the programmed key on their phone to seize a trunk line and make an outbound call. If you are using Zap ports for the trunks, then Asterisk will recognise a definition such as "device=Zap/1". However, if you want to use non-Zap ports then you should use a setting such as the one shown in the above example. By using "Local" followed by a start point in extensions.conf, you can control how Asterisk seizes the line. The start point in our example would be in the context [line1-out] at priority 1 of the section defined for extension "sla". A line such as this: [line1-out] exten => sla,1,Disa(no-password|fxo-out)
The dial plan associated with dialling and making outbound calls is explained in more detail later here. Ringtimeout The ringtimeout parameter determines for how long (in secoonds) an incoming call should ring before the SLATrunk function returns with a RINGTIMEOUT result. For more details see the explanation for the SLATrunk function below. Barge The barge parameter determines whether other extensions are permitted to join an existing call in a conference by
The barge parameter determines whether other extensions are permitted to join an existing call in a conference by pressing their shared line key. If extension A answers the call on line 1, the lamp for line 1 will be lit on all the other participating extensions. At this point, if a user at extension B presses the key for line 1, they will become conferenced with the existing call. Setting "barge=no" would prevent this from happening. The default setting is "yes". Hold The hold parameter determines whether a call placed on hold by a particular extension can be retrieved from hold by other stations. It takes one of two values: "open" or "private". The default option is "open", meaning that any other extension participating in SLA can retrieve a call that has been put on hold. The alternative, "private", means that only the extension that put the call on hold is allowed to retrieve it.
Device The device parameter tells Asterisk which device to ring when an incoming call arrives on an associated trunk line. In the example shown above, we have said that SIP extension 4001 should ring immediately any call arrives on line1 or line2. It is permitted to have many "station" entities participating in SLA thereby allowing multiple extensions to ring simultaneously when an incoming call arrives. Ringdelay The ringdelay parameter determines a delay (in seconds) before this extension should start ringing. The timer starts when the SLATrunk function is called from within the dial plan. You can set different ringdelay values against each trunk line if you want - this option allows quite complex ringing patterns to be programmed for different trunks and different extension phones. Ringtimeout The ringtimeout parameter determines how long the ringing should last at this station. You can set different ringtimeout values against each trunk line if you want - this option, when used in conjunction with ringdelay, allows quite complex ringing patterns to be programmed such as delivering a splash ring on secondary extensions if an incoming call has not been answered within, say, 20 seconds. Trunk The trunk parameter tells Asterisk which trunk lines are presented at this extension. What do I mean by "presented"? It means two things - first it defines for which trunks this phone should ring (i.e. when an incoming call arrives on the trunk); second, it tells Asterisk to expect that this extension phone has got programmed keys assigned to those trunk lines. Asterisk will maintain an array of internal states for the shared line keys it knows are on the phone and will accept SUBSCRIBE requests that are mapped to those line states from the phone. Tip: Although it is not stated in the developer's documentation, it does not actually matter if the phone doesn't have any programmed keys assigned. This means you could, for example, make an analogue extension be part of the ring group. It would not have any shared line keys so you would not get a lamp showing line activity and it would be difficult for the phone to participate in other SLA features like call transfer, but it would ring and could therefore answer incoming calls.
The Aastra-53i allows accounts to be created for up to 9 lines, although only the first three have line keys on the phone set. If you want, you can associate a different SIP user account with each line. Furthermore, under Preferences, there is an option to set which line account is the preferred one. However, if you don't have a specific need for multiple accounts, keep things simple and for line 1 just use the same login details already given in your Global SIP account. Lines 2 to 9, just leave blank. Using the web interface, login as admin then select Advanced Settings|Line 1 To use the default settings from the Global SIP account, you can leave various fields with their default values. For example, Server addresses can be left as 0.0.0.0 and port numbers can be left as 0. The Global defaults are then used. However, if you enter new data into some of the fields for Caller ID, Authentication and Password, then it is best to enter values for all of these fields. Leave Line Mode set to "Generic".
file. For this purpose it uses something called Hints. Hints are simply a user-configurable mapping between an arbitrary name tag and a specific telephony device or application that Asterisk knows about. When Asterisk receives a SIP SUBSCRIBE request it checks for a hint in the dial plan that matches the name of the device to be monitored. The hint tells Asterisk which physical device this corresponds to. It is best understood by seeing some examples. Some examples of Asterisk Hints Hints usually map an extension number (or name) to a device. However, hints can also map to other special internal states (virtual devices) such as the state of a specific call park slot or the state of a specific meetme conference. SLA introduces a new virtual device that is used in a hint to allow subscriptions to the state of a trunk line as defined in the SLA.CONF file. Here are some examples of Asterisk hints: [mysubscribes] exten => 4001,hint,SIP/4001 exten => 2001,hint,Zap/5 exten => parked01,hint,park:701@parkedcalls exten => 6555,hint,Meetme:555 exten => 8*4001_line1,hint,SLA:8*4001_line1 exten => 8*4001_line2,hint,SLA:8*4001_line2
Hints used for Asterisk SLA Note particularly the last two lines in the above example. These hint lines are used to map the tag "8*4001_line1" to the state of the virtual device "SLA:8*4001_line1" and the tag "8*4001_line2" to the state of the virtual device "SLA:8*4001_line2". What this means is that a programmable key on an IP phone can now subscribe to the state of "8*4001_line1" and it will then receive updates (in the form of SIP NOTIFY messages) every time the corresponding virtual device changes state. Virtual devices prefixed with "SLA:" identify elements within the array of internal states mentioned earlier. These internal states are updated when your dial plan calls the functions SLATrunk or SLAStation or when a call on one of those trunk lines ends. At this point, all the subscribing phones are sent a NOTIFY message to tell them the new state. For Asterisk SLA to work properly, you must define appropriate hints for all the programmable keys assigned as shared line keys on your IP phones. If you had 4 trunk lines and 10 IP phones using SLA then this might mean you need to define a total of 40 hints in your dial plan! This is where the use of "autocontext" looks like an attractive option - it automatically creates the hints for you. However, there is a major downside to using autocontext for this purpose - any subsequent reload of the dial plan will erase all the auto-created hints. Therefore, you are advised to grit your teeth and just add all 40 hints manually. Unfortunately, you cannot use exten number patterns and the ${EXTEN} variable for hints - Asterisk checks if the hint device exists when the dial plan is first read so it throws errors up for hints that try to use variables. Where does Asterisk look for the hints in extensions.conf? To avoid any possible confusion about the location of these hints, it is recommended that you use the subscribecontext parameter in your sip.conf file to identify the location of all hints within extensions.conf. There is a little documentation about subscribecontext within the Asterisk wiki:
http://www.voip-info.org/wiki-Asterisk+config+sip.conf
You may find the examples in this link slightly more useful:
http://www.voip-info.org/wiki/view/480i+Busy+lamp+field+'BLF'+support
The following example shows how to call the SLATrunk function within a dial plan context that is common to all the FXO ports, using a variable whose value is set from the ${CHANNEL} variable. (This sample code would only be suitable for a maximum of 9 FXO ports!): [fxo] exten => s,1,Noop('Channel ID is '${CHANNEL}) exten => s,n,Set(linetag=line${CHANNEL:-1}) exten => s,n,SLATrunk(${linetag}) exten => s,n,Noop('SLATrunk status is '${SLATRUNK_STATUS}) exten => s,n,Gotoif($[${SLATRUNK_STATUS} = SUCCESS] ?exit) exten => s,n,Answer() exten => s,n,Wait(1) exten => s,n,Background(greeting1) ..... here the dial plan depends on call handling choices and so is not shown exten => s,n(exit),Hangup
Explanation for the above example dial plan: The variable ${CHANNEL} is pre-set by Asterisk to show the channel. On a Pika Appliance, it might look like this "Pika/fxo/1" for FXO port 1 etc. ${CHANNEL:-1} gets only the last character from that variable - the channel number. The variable "linetag" is created by the Set function and given a value of "line1" for FXO port 1, "line2" for FXO port 2 etc. The call to SLATrunk uses this variable as its parameter. The function SLATrunk will eventually return and the dial plan will then execute the next step. We can check the outcome of the SLATrunk function using the variable ${SLATRUNK_STATUS} - it is a kind of return code. A value of "SUCCESS" indicates that the call was answered within SLATrunk so our dial plan does not need to do anything more. Any other return value shows that the call has not been answered, so we may want Asterisk to answer it and play a greeting then do further processing such as record a voicemail message or whatever. Answering an incoming call There are actually two ways that a user can answer an incoming call using SLA: 1. If their phone is ringing, they can pick up the handset (or press the speaker phone button). 2. If a shared line key is correctly programmed for the relevant trunk line, then the lamp will be flashing to show there is an incoming call - the user can press that shared line key to answer the call. It is possible for a phone to ring and have no shared line key. It is also possible for a phone to be showing the incoming call on a shared line key, but to not be ringing (for example, when the station "ringdelay" parameter in sla.conf has a non-zero value). It is also possible for a phone to ring and show the incoming call on a shared line key at the same time. These things are all controlled by settings in SLA.CONF.
Which section of the dial plan is relevant for outbound call handling
Which section of the dial plan is relevant for outbound call handling
When the user of an IP phone makes a call, the section of the dial plan that handles it is normally defined by the "context" parameter given in your SIP.CONF file. There may be a default context that applies to every SIP peer, but it is recommended that an explicit context is given, as shown in the following example: Definition for IP Phones 4001 and 4003 within file SIP.CONF [4001] type = friend username = 4001 callerid = "Grandstream GXP2000" <4001> secret = 123 host = dynamic context = sip-out subscribecontext = mysubscribes qualify = no call-limit=4 disallow = all allow = alaw allow = ulaw [4003] type = friend username = 4003 callerid = "Aastra 53i" <4003> secret = 123 host = dynamic context = sip-out subscribecontext = mysubscribes qualify = no call-limit=4 disallow = all allow = alaw allow = ulaw
It is also possible that a domain specific context has been defined, in which case this setting may over-ride the explicit setting for the peer. It is important to get this right for correct sla operation so you should confirm which context is being used when the IP phone makes a call: Try increasing the "verbose" level to 3 and making a call from the IP phone, then check which context was used. The console output will show something like "Executing [number@context] ..." From the Asterisk CLI (Command Line Interface) type the command "sip show users". Look for the context name in the column "Def.Context". However, be aware that this setting will be trumped by a different setting for the domain that the phone is registered on. You can see domain specific context settings by typing "sip show domains" at the CLI prompt and looking at the column called "Context". Once you are sure that calls from extension 4001 are being processed in a specific context (in the examples it is called "sip-out"), then it is ok to proceed to the next step.
if users did find this confusing. If you program the phone's own line keys to auto-dial an SLA name tag, then you can make them behave the same as the shared line keys, but only for a limited set of cases. Auto-dial is available on the Aastra and the adjacent screen shot shows how you might want to make use of this feature with SLA.
Other line keys would need to use SLA name tags that were appropriate for their line number. For example, line 2 would be set to auto-dial "8*4003_line2" etc. Unfortunately, the Grandstream GXP2000 does not seem to provide an auto-dial facility, but if anyone knows better, please contact me.
The following cases are deliberately omitted from the list at this point because they cannot be handled correctly when autocontext is used. Techniques for handling them are discussed later: Pick up handset (or press the speaker button): user hears dial tone and dials an external number User dials a PSTN (external) number and presses a phone line key to make the call User dials a PSTN (external) number and presses the Dial soft key Fortunately, several of the five cases described above will look exactly the same once they reach Asterisk, so the dial plan is a lot less complicated than you might expect. By the way, it is assumed in this example that you have assigned the same user account to all the auto-dial lines. Cases 1 and 2 will produce identical interactions with Asterisk. Assuming the same internal number is called, cases 3, 4 and 5 will all result in an identical INVITE being sent to Asterisk. So really, there are just two different cases that must be handled. Not so bad after all. Without autocontext: The dial plan to handle all this could be manually constructed as follows: Dial plan snippet from EXTENSIONS.CONF [sip-out] ; User pressed a shared line key and will be presented with dial tone exten => 8*4001_line1,1,SLAStation(8*4001_line1) exten => 8*4001_line2,1,SLAStation(8*4001_line2) exten => 8*4003_line1,1,SLAStation(8*4003_line1) exten => 8*4003_line2,1,SLAStation(8*4003_line2) ; User dialled an internal extension (4 digit number starting with 4) exten => _4XXX,1,Dial(SIP/${EXTEN},26) exten => _4XXX,n,VoiceMail(${EXTEN}@other,b) exten => _4XXX,n,Congestion(5)
With autocontext: If you were using autocontext for the stations, then the four lines of the dial plan that call the SLAStation function would be generated automatically, so you could simply have a dial plan like this: Dial plan snippet from EXTENSIONS.CONF [sip-out] ; User dialled an internal extension (4 digit number starting with 4) exten => _4XXX,1,Dial(SIP/${EXTEN},26) exten => _4XXX,n,VoiceMail(${EXTEN}@other,b) exten => _4XXX,n,Congestion(5) The section of SLA.CONF that tells Asterisk to use autocontext would look like this: [8*4003] ; Aastra 53i type=station device=SIP/4003 autocontext=sip-out ringdelay=0
What happens inside Asterisk when a shared line key is pressed? When the key for Shared Line 1 is pressed on the Aastra phone, it causes an INVITE to be sent to Asterisk. The target number of the INVITE will be "8*4003_line1" so it will match the corresponding line in the dial plan and call the command SLAStation(8*4003_line1). What this does depends on what you configured for the "Device" parameter of line1 in SLA.CONF. You may remember that I recommended you to set device like this: device=Local/sla@line1-out By specifying a "Local" device, this actually means that Asterisk will jump to a new position in the dial plan and will start to execute the lines at that position. In the example shown above, it will jump to the context [line1-out] and try to find a step within that context matching the target extension ID - in this case, the target is set to "sla", but it could be almost anything. What you specify in your dial plan depends if you want to use DISA to present dial tone or if you want to take the trunk line off-hook. If it is a SIP trunk, then you have no choice - you must use the DISA function. If it is a Zap port or a Pika FXO port, then you should take it off hook as shown in the examples below: [line1-out] ; The following three blocks show alternatives for shared line 1. ; You would only have one of them in a real dial plan. ; Select the one that matches your trunk's hardware/technology ; For a SIP trunk, use the Asterisk DISA function to generate dial tone exten => sla,1,Disa(no-password|line1-out) ; Take Zap channel 1 off-hook. Assumes that channel 1 is an FXO port exten => sla,1,Dial(Zap/1/) ; Take Pika FXO channel 1 off-hook to allow direct dialling on the trunk exten => sla,1,Dial(PIKA/fxo/1//) ; The following is required only for the Disa mechanism used with a SIP trunk ; Calls to numbers matching PSTN numbers use the SIP trunk exten => _0XXXX.,1,Dial(SIP/${EXTEN}@provider1|50|w) ; Calls to any other number are considered invalid exten => i,1,Playback(invalid) exten => i,n,Hangup Why you should take the FXO trunk line off-hook There is a major advantage in taking the trunk line off-hook as soon as the shared line key is pressed. When you present dial tone this way, there is no risk of an incoming call arriving on the trunk while the user is dialling. If, instead, you were to use the Asterisk DISA function, there would be a significant risk that an inbound call may start ringing the trunk line before the user has finished dialling. This is a situation that you really don't want to allow - it would result in mis-handling of both the inbound and the outbound calls. Another advantage of using the FXO "off-hook" technique is that it requires fewer entries in the dial plan and generally keeps the dial plan simpler.
Aastra or other suitable IP phone: Select a shared trunk line, hear dial tone, dial external number Pick up handset, hear dial tone, dial an internal number Dial an internal number, press the 'Dial' soft key (or press a phone line key) However, it will fail if the user tries to dial an external number without first selecting one of the shared trunk lines. This would be a very annoying limitation for users - ok, you could regard it as a problem that can be addressed by suitable "user training", but I have seen too many instances of poor equipment design being explained away with the limp excuse that the users just need to be better trained. If a user can dial an external number by pressing the line key then dialling, it is reasonable for them to expect to be able to dial and then press the line key. What you should be aiming for is a consistent and reasonably intelligent user interface - Asterisk is perfectly capable of pattern matching on dialled numbers, so how can we upgrade the dial plan to handle it correctly? Unburden yourself from the chains of "autocontext" Yes, this is the point where you have to abandon "autocontext". We mentioned much earlier that autocontext was probably not worth using and if you want to take Asterisk shared line appearances to the next level, with an improved user experience, then autocontext must be disabled. With autocontext disabled, you can now take advantage of the slightly curious naming convention we recommended for the stations in SLA.CONF. The recommendation was to prefix the extension number with "8*". This was chosen because it allows extension patterns to be used in the dial plan. This means that a single line in the dial plan can now be used for tens or hundreds of different stations and lines. Look for the pattern "_8*." in the samples below.
How can SLAStation offer DISA and also handle pre-dialled numbers?
This is the problem that has to solved - when a user dials a number on the IP phone, it sends an INVITE to Asterisk that must be handled in one specific dial plan context. However, depending on how the user dialled the number you may want the dial plan to do any one of the following three things: 1. Use the Dial command to call an internal number - no shared trunk line is required 2. Use the SLAStation command to select a specific shared trunk line, present dial tone to the user and then wait for the user to dial an external number 3. Use the SLAStation command to select any available shared trunk line, then immediately place a call on that shared trunk line using a pre-dialled number Our previous examples for the dial plan would not be able to handle the last of those three cases and it is not immediately obvious how you can use SLAStation to perform two different jobs. The trick that must be used is to set a variable before calling SLAStation and then make the dial plan inspect the variable just after SLAStation has been called. We have also made an assumption that the Caller ID number of the IP phone that is making the call is preset to the correct extension number of that device. This data is then used as part of the parameter passed to the SLAStation function. If your IP phones are not configured with their extension number as the caller ID, then you would have to find some other way of identifying which extension is making the call and ensuring that the correct parameter is passed to SLAStation. The code for the dial plan now looks like this: [sip-out] ; User pressed a shared line key and will be presented with dial tone exten => _8*.,1,Set(_MYDATA=disa) exten => _8*.,n,SLAStation(${EXTEN}) ; User dialled an internal extension (4 digit number starting with 4) exten => _4XXX,1,Dial(SIP/${EXTEN},26) exten => _4XXX,n,VoiceMail(${EXTEN}@other,b) exten => _4XXX,n,Congestion(5) ; User dialled an external number - grab any free shared trunk line exten => _0XXXX.,1,Set((_MYDATA=${EXTEN}) exten => _0XXXX.,n,SLAStation(8*${CALLERID(num)}) ; Handle unrecognised number dialled exten => i,1,Answer() exten => i,2,Playback(invalid) exten => i,3,Hangup [line1-out] ; this context is used to process outbound calls on shared line 1 (Zap FXO) exten => sla,1,Gotoif($[${MYDATA} = disa] ?disa:data) ; disa - wait for caller to dial a number (presents trunk dial tone as prompt) exten => sla,n(disa),Dial(Zap/1/) exten => sla,n,Hangup ; data - user has already dialled a number and SLAStation has selected this line exten => sla,n(data),Dial(Zap/1/${MYDATA},40) exten => sla,n,Congestion(5) [line2-out] ; this context is used to process outbound calls on shared line 2 (Pika FXO) exten => sla,1,Gotoif($[${MYDATA} = disa] ?disa:data)
exten => sla,1,Gotoif($[${MYDATA} = disa] ?disa:data) ; disa - wait for caller to dial a number (presents trunk dial tone as prompt) exten => sla,n(disa),Dial(Pika/FXO/2//) exten => sla,n,Hangup ; data - user has already dialled a number and SLAStation has selected this line exten => sla,n(data),Dial(Pika/FXO/2/${MYDATA},40) exten => sla,n,Congestion(5) [line3-out] ; this context is used to process outbound calls on shared line 3 (SIP Provider1) exten => sla,1,Gotoif($[${MYDATA} = disa] ?disa:data) ; disa - wait for caller to dial a number (presents dial tone as prompt) exten => sla,n(disa),Disa(no-password,line3-out) exten => sla,n,Hangup ; data - user has already dialled a number and SLAStation has selected this line exten => sla,n(data),Dial(SIP/${MYDATA}@provider1,40,w) exten => sla,n,Congestion(5) ; handle the results from the Asterisk Disa function ; User dialled an external number exten => _0XXXX.,1,Dial(SIP/${EXTEN}@provider1,40,w) ; All other dialled number patterns are considered invalid exten => i,1,Playback(invalid) exten => i,n,Hangup
Explanation for the above example dial plan: The variable ${MYDATA} is set before the SLAStation function is called and can be inspected and used by the part of the dial plan that executes after SLAStation is called. Note that you must prefix the variable name with the underscore character when you set it - this tells Asterisk to make the variable available to child processes spawned from the original thread that was handing the call. Inside the [line1-out] and [line2-out] contexts the variable is tested. If it has been set to "disa" then the trunk is taken offhook using the appropriate parameter in the Dial command. Otherwise the variable is assumed to contain the pre-dialled number and a call is placed on the line using the stored number. Inside the [line3-out] context the variable is tested. If it has been set to "disa" then the Asterisk DISA function is called, but otherwise it is assumed to contain the pre-dialled number and a call is placed on the SIP line using the stored number. Extra dial plan code is required in this context to handle the results from the Asterisk Disa function - only calls to external numbers are permitted using Disa because the SLA mechanism has already allocated the trunk line.
What is good and what is bad about the Asterisk implementation of SLA?
Benefits of Asterisk Shared Line Appearances
Replacement of legacy systems: The main reason for wanting to configure Shared Line Appearances in Asterisk is because the Asterisk system is replacing a traditional key and lamp telephone system. However, this is certainly not the only reason for using SLA.
Visual representation of call activity: SLA provides users with clear visual indications of call activity and, given enough programmable keys on the IP phones, you could have a key/lamp for every trunk line and every extension on your system. Where the system size is too large you would be able to use an expansion module such as the Grandstream GXP-2000EXT. Highly configurable ring groups: SLA offers a rich combination of options for including and excluding different "stations", assigning different ring delays and ring durations. In some ways it offers a superior set of features for configuring ring groups/pickup groups than the native features of Asterisk.
answers the call. Now phones B and C will both report a missed call. What makes this even more annoying is that even phone A can report it as a missed call if you pressed the shared line key to answer the call! No call progress heard after dialling with DISA: If you set the dial plan to use the Asterisk DISA function as described in earlier examples on this web page, you will find that there is no audible feedback of call progress after you dial. The DISA function sends dial tone before you dial, but after you dial it just goes silent until the call is answered. Digium said that this had been fixed in a later release. There is no reload option for SLA.CONF: Any changes that you make to the SLA.CONF file will have no effect until you restart Asterisk. Again, Digium said that this problem had been addressed in a later release. Subscriptions are not persistent: Following on from the previous point, after you have restarted Asterisk you will now have to reboot all the IP phones. This is because Asterisk does not remember the subscriptions through a restart without the subscriptions you will find that the lamps on the shared line keys do not come on during call activity. SLATrunk function sets line state to idle on exit: This is a bit of a technical gripe, but is relevant if you use the sample dial plans shown earlier on this web page. The dial plan to handle inbound calls can perform a twofold function (provided autocontext is not used): First it can make a bunch of extension phones ring, but then - if none of those phones is answered - it can perform further processing of the inbound call. For example, it could send the call to voicemail. However, there is a problem - the status lamps for the shared trunk line will show the line as idle while it is actually still in use. This is because the subscribe/notify status for the line gets reset to idle as soon as the next step in the dial plan is executed after the line that executed SLATrunk. It would be preferable if the status remained as "inuse" until the trunk line hangs up. It should be possible to find a work around for this using Asterisk version 1.6 software.
Note: The information in this article is essentially original material prepared by the author following his own detailed investigations which involved a search through existing documentation (both online and comments included within the sample conf files) and practical tests using Asterisk 1.4.14 running on a Pika Warp Appliance with an Aastra 53i IP phone and Grandstream GXP2000 (among others). It is freely offered as guidance and advice for other Asterisk users who may have found the documentation of SLA somewhat lacking. The author cannot accept responsibility for any errors or omissions within this article, but if you want to send feedback to info at smartvox.co.uk please do so and I will do my best to incorporate any suggestions or correct any errors. The text of this article is copyright 2008, 2009 Smartvox Limited. Do not copy this text or any substantive part of it to other web sites or documents. If you want to refer to it please use a link. Last updated on Wednesday 14th January 2009. Products and Services | Support | Contact Us | Home | Affiliates