Thursday, March 8, 2012

Shared Line Appearance/Bridged Line Appearance in Asterisk

1.    Design Overview:

When someone calls Boss’ line, it will ring Boss’ as well as Assistants’ phone (Asterisk SLA/conference function and Line Trunking allows this feature).
Assistants can see the presence of their Boss’ line (Presence feature on Polycom phone and Asterisk HINT allows this).  Assistants can pick up the call by pressing the line button. Boss can join the conversation by pressing the line button as well (Barge In function, Asterisk Conference and Line Trunking allows us to do this)
You can simply put a call on hold from one phone and pick it up from another. Also, if multiple phones press the key for the shared extension, they will all be bridged into the same call(Asterisk SLA/conference function allows this feature).

2.    Terminologies:
  • Asterisk Technologies/Channels/Devices: There are various technologies/channels/devices available in Asterisk.
                Local
                SIP
                Agent
                & more ….

           Examples:
                 device=Local/disa@SLA_Outbound
           Defined  Local channel that lands the call in ‘disa’ extension of context [SLA_Outbound] in extensions.conf
  • DISA:  DISA (Direct Inward System Access) allows someone calling in from outside the telephone switch(PBX) to obtain an “internal” system dialtone and dial calls as if from one of the extensions attached to the telephone switch.  Check more @ http://www.voip-info.org/wiki/view/Asterisk+cmd+DISA
  • SLA: Shared Line Appearance
  • BLA: Bridged Line Appearance
  • Station: It is any SIP phone that will be using SLA
  • Trunk:  It is a literal trunk or shared extension that will be appearing on two or more stations
  • SLAStation() : Shared Line Appearance Station application. It should be executed by an SLA station. The argument to this application depends on how the call was initiated. If the phone was just taken off hook, then the argument ‘station’ should be just the station name. If the call was initiated by pressing a line key, then the station name should be preceded by an underscore and the trunk name associated with that line button.
      exten =>20000, n,SLAStation(20000)
      exten => 20000_line1,1,SLAStation(20000_line1)
  •  SLATrunk(): Shared Line Appearance Trunk application. This application takes care of ringing of all the appropriate stations.   

exten => 20000,1,Verbose(1,### Dialing trunk line1)
        same => n,Goto(sla,1)

exten => sla,1,SLATrunk(line1)


3.    Implementation:
  • Check if all the required Asterisk applications are installed properly
SLA application uses two key technologies: Device State Processing and Conferencing. Conferencing uses MeetMe() application. MeetMe() application is offered by app_meetme module. App_meetme module requires DAHDI to be installed (even if you don’t use PRIs).
Warning!!!
You have to load dahdi and dahdi_dummy before you start asterisk. You can check if those are loaded or not.
# lsmod|grep dahdi
dahdi                 210879  0
crc_ccitt               1651  1 dahdi


If you don’t get output like above, you might want to load it manually
#modprobe dahdi
#modprobe dahdi_dummy

Now check if app_meetme module is loaded or not.
*CLI> module show like app_meetme.so
Module                         Description                              Use Count
app_meetme.so                  MeetMe conference bridge                 0
1 modules loaded


[If it says 0 modules loaded, double check if dahdi and dahdi_dummy are loaded successfully or not. You might also get “WARNING[15929]: app_meetme.c:1228 build_conf: Unable to open DAHDI pseudo device” for not having dahdi_dummy]
Check if SLAStation() and SLATrunk() applications are available
*CLI> core show applications like SLA
    -= Matching Asterisk Applications =-
            SLAStation:
              SLATrunk:
    -= 2 Applications Matching =-


  • Asterisk Configuration
You have to understand and edit sla.conf, extensions.conf and sip.conf.

Trunks and Stations are defined in sla.conf. Mapping of devices to trunks and stations are also done here.
Station: It is any SIP phone that will be using SLA
Trunk:  It is a literal trunk or shared extension that will be appearing on two or more stations

#sla.conf
[general]
attemptcallerid=yes

[line1]
type=trunk
device=Local/disa@SLA_Outbound

[line2]
type=trunk
device=Local/disa@SLA_Outbound

[station](!)  ;Template for stations 
type=station
trunk=line1
;trunk=line2

[20000](station)   ;Note:section name do not need to match SIP device name
device=SIP/20000

[20001](station)
device=SIP/20001


Warning!!!
Trunk must be tied up with a device. Otherwise it will crash asterisk.

Here, we defined
•    two trunks [line1] and [line2]
•    two stations [20000] and [20001]   

If you watch very closely on above configuration, you will see that
•    trunk [line1] is tied up with device=Local/disa@SLA_Outbound
•    stations [20000] and [20001] are tied up with  device=SIP/20000
and device=SIP/20001 and will use trunk [line1] as defined in [station](!)  template

In our current scenario, we will not be using trunk [line2] to simplify the demonstration.

You can verify those by executing ‘sla’ commands in asterisk
*CLI> sla show trunks

=============================================================
=== Configured SLA Trunks ===================================
=============================================================
===
=== ---------------------------------------------------------
=== Trunk Name:       line1
=== ==> Device:       Local/disa@SLA_Outbound
=== ==> AutoContext:  (none)
=== ==> RingTimeout:  (none)
=== ==> BargeAllowed: Yes
=== ==> HoldAccess:   Open
=== ==> Stations ...
===    ==> Station name: 20000
===    ==> Station name: 20001
===    ==> Station name: 20002
=== ---------------------------------------------------------
===
=== ---------------------------------------------------------
=== Trunk Name:       line2
=== ==> Device:       Local/disa@SLA_Outbound
=== ==> AutoContext:  (none)
=== ==> RingTimeout:  (none)
=== ==> BargeAllowed: Yes
=== ==> HoldAccess:   Open
=== ==> Stations ...
=== ---------------------------------------------------------
===
=============================================================



*CLI> sla show stations

=============================================================
=== Configured SLA Stations =================================
=============================================================
===
=== ---------------------------------------------------------
=== Station Name:    20000
=== ==> Device:      SIP/20000
=== ==> AutoContext: (none)
=== ==> RingTimeout: (none)
=== ==> RingDelay:   (none)
=== ==> HoldAccess:  Open
=== ==> Trunks ...
===    ==> Trunk Name: line1
===       ==> State:       SLA_TRUNK_STATE_IDLE
===       ==> RingTimeout: (none)
===       ==> RingDelay:   (none)
=== ---------------------------------------------------------
===
=== ---------------------------------------------------------
=== Station Name:    20001
=== ==> Device:      SIP/20001
=== ==> AutoContext: (none)
=== ==> RingTimeout: (none)
=== ==> RingDelay:   (none)
=== ==> HoldAccess:  Open
=== ==> Trunks ...
===    ==> Trunk Name: line1
===       ==> State:       SLA_TRUNK_STATE_IDLE
===       ==> RingTimeout: (none)
===       ==> RingDelay:   (none)
=== ---------------------------------------------------------
===

Asterisk dialplan (extensions.conf) allows to setup extension state hints and extensions that define how calls get into and out of an SLA setup.
#extensions.conf

[SLA_Stations]
exten => 20000,1,Verbose(1,### Incoming Call to extension${EXTEN})
        same => n, Dial(SIP/${EXTEN})

exten => 20000_line1,hint,SLA:20000_line1

exten => 20000_line1,1,SLAStation(20000_line1)) ;This puts the call thru' disa@SLA_Outbound as it forces the call thru' the trunk
    
exten => 20001,1,Verbose(1,### Incoming Call to SLAStation)
        same => n, Dial(SIP/${EXTEN})

exten => _X.,1,Verbose(1,### Incoming Call from ${CALLERID(name)} : ${CALLERID(num)}) 


CUSTOMIZE YOUR DIALPLAN ACCORDING TO YOUR ENVIRONMENT



[SLA_Outbound]
exten => disa,1,DISA(no-password,SLA_Outbound)

exten => _X.,1,Verbose(1,### Incoming Call from ${CALLERID(name)} : ${CALLERID(num)})
CUSTOMIZE YOUR DIALPLAN ACCORDING TO YOUR ENVIRONMENT
[External]
exten => 20000,1,Verbose(1,### Dialing trunk line1)
        same => n, SLATrunk(line1)

exten => _X.,1,Verbose(1,### Incoming Call from ${CALLERID(name)} : ${CALLERID(num)}) 


CUSTOMIZE YOUR DIALPLAN ACCORDING TO YOUR ENVIRONMENT

SIP users are defined in sip.conf. SIP users for SLA stations are assigned [SLA_Stations] context.

#sip.conf
context=External

[SLA-sip-phone](!) ;Template
type=friend
host=dynamic
secret=mysecretpassword
context=SLA_Stations

[20000](SLA-sip-phone)
callerid= "Boss" <20000>
mailbox=20000

[20001](SLA-sip-phone)
callerid= "Secretary" <20001>
mailbox=20001

[sip-phone](!) ;Template
type=friend
host=dynamic
secret=mysecretpassword
context=External

[20002](sip-phone)
callerid= "John Doe" <20002>
mailbox=20002




Here 20000 and 20001 are using SLA-sip-phone template, thus they land in [SLA_Stations] of dialplan
And 20002 is using sip-phone template and it lands in [External] context

  • Polycom phone configuration
For phone with extension 20001
Make sure that directories, buddies and presence features are enabled.
Then define the directory for the phone.

#[MAC-ADDRESS]-directory.xml

   
      
         
         Boss Line1
         20000_line1@mysipserver.phones
         1
         1
      
   


Similar configuration for phone with extension 20000

You can now start testing. Please remember that you have to customize your dialplan according to your environment. Good Luck!


3 comments:

Unknown said...

Have you seen this work with Asterisk 11?

Thank you

BF

infotech said...

I Read Your Post Which was Really Good
Asterisk Solutions

Unknown said...

The aim of art is to represent not the outward appearance of things, but their inward significance. See the link below for more info.


#appearance
www.ufgop.org