Asterisk-sla.conf

From 탱이의 잡동사니
Jump to: navigation, search

Overview

원문은 이곳[1]에서 확인할 수 있다.

SLA 는 Asterisk 설정을 간단하게 할 수 있도록 고안된 간단 키 시스템이다. 가상화된 계층 구조를 사용하여 하나의 가상 장치를 통해 연결된 IP channel 및 여러 Device 장치에 접근할 수 있도록 한다.

SLA trunk configuration

설정 원문은 이곳[2]에서 확인할 수 있다.

SLA trunk 는 virtual trunk 와 실제 Asterisk device 를 엮어주는 매핑 장치이다. Device 는 Analog FXO 라인이 될 수도, 혹은 SIP trunk 와 같은 장치일 수도 있다.

이 SLA trunk 는 두 곳에 설정해야 하는데, 첫번째로는 sip.conf 와 dahdi.conf 와 같은 실제 채널 설정 파일에 설정해야 하고, 그 다음 sla.conf 파일에 매핑 설정을 하는 것이다.

  • sla.conf
[line1]
type=trunk
device=DAHDI/1

자동 설정 dialplan 을 사용하기 위해서는, sla.conf 에서 설정한 autocontext 설정과 dahdi.conf 와 sip.conf 에서의 context 설정과 서로 같은 설정값을 가지도록 설정해야 한다. 한 가지 알아두어야 할 점은 이 자동 설정 dialplan 은 SLATrunk() extension 을 생성한다는 것이다. DAHDI 및 FXO 트렁크에서는 완벽히 작동한다.

This would be done in the regular device entry in dahdi.conf, sip.conf, etc. Note that the automatic dialplan generation creates the SLATrunk() extension at extension 's'. This is perfect for DAHDI channels that are FXO trunks, for example. However, it may not be good enough for an IP trunk, since the call coming in over the trunk may specify an actual number.

If the dialplan is being built manually, ensure that calls coming in on a trunk execute the SLATrunk() application with an argument of the trunk name, as shown in the dialplan example before.

IP trunks can be used, but they require some additional configuration to work.

For this example, let's say we have a SIP trunk called "mytrunk" that is going to be used as line4. Furthermore, when calls come in on this trunk, they are going to say that they are calling the number "12564286000". Also, let's say that the numbers that are valid for calling out this trunk are NANP numbers, of the form _1NXXNXXXXXX.

In sip.conf, there would be an entry for [mytrunk]. For [mytrunk], set context=line4.

[line4]
type=trunk
device=Local/disa@line4_outbound
 
[line4]
exten => 12564286000,1,SLATrunk(line4)
 
[line4_outbound]
exten => disa,1,Disa(no-password,line4_outbound)
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@mytrunk)

So, when a station picks up their phone and connects to line 4, they are connected to the local dialplan. The Disa application plays dialtone to the phone and collects digits until it matches an extension. In this case, once the phone dials a number like 12565551212, the call will proceed out the SIP trunk.

SLA dialplan configuration

설정 원문은 이곳[3]에서 확인할 수 있다.

The SLA implementation can automatically generate the dialplan necessary for basic operation if the "autocontext" option is set for trunks and stations in sla.conf. However, for reference, here is an automatically generated dialplan to help with custom building of the dialplan to include other features, such as voicemail.

However, note that there is a little bit of additional configuration needed if the trunk is an IP channel. This is discussed in the section on Trunks.

There are extensions for incoming calls on a specific trunk, which execute the SLATrunk application, as well as incoming calls from a station, which execute SLAStation. Note that there are multiple extensions for incoming calls from a station. This is because the SLA system has to know whether the phone just went off hook, or if the user pressed a specific line button.

Also note that there is a hint for every line on every station. This lets the SLA system control each individual light on every phone to ensure that it shows the correct state of the line. The phones must subscribe to the state of each of their line appearances. Please refer to the examples section for full dialplan samples for SLA.

SLA station configuration

설정 원문은 이곳[4]에서 확인 할 수 있다.

An SLA station is a mapping between a virtual station and a real Asterisk device. Currently, the only channel driver that has all of the features necessary to support an SLA environment is chan_sip. So, to configure a SIP phone to use as a station, you must configure sla.conf and sip.conf.

[station1]
type=station
device=SIP/station1
trunk=line1
trunk=line2

Here are some hints on configuring a SIP phone for use with SLA:

  • Add the SIP channel as a station in sla.conf.
Configure the phone in sip.conf.
If automatic dialplan configuration was used by enabling the "autocontext" option in sla.conf, then this entry in sip.conf should have the same context setting.
On the phone itself, there are various things that must be configured to make everything work correctly.
Let's say this phone is called "station1" in sla.conf, and it uses trunks named "line1" and line2".
Two line buttons must be configured to subscribe to the state of the following extensions: - station1_line1 - station1_line2
The line appearance buttons should be configured to dial the extensions that they are subscribed to when they are pressed.
If you would like the phone to automatically connect to a trunk when it is taken off hook, then the phone should be automatically configured to dial "station1" when it is taken off hook.

Basic SLA configuration example

설정 원문은 [5]에서 확인할 수 있다.

This is an example of the most basic SLA setup. It uses the automatic dialplan generation so the configuration is minimal.

  • sla.conf
[line1]
type=trunk
device=DAHDI/1
autocontext=line1
 
[line2]
type=trunk
device=DAHDI/2
autocontext=line2
 
[station]
type=station
trunk=line1
trunk=line2
autocontext=sla_stations
 
[station1](station)
device=SIP/station1
 
[station2](station)
device=SIP/station2
 
[station3](station)
device=SIP/station3

With this configuration, the dialplan is generated automatically. The first DAHDI channel should have its context set to "line1" and the second should be set to "line2" in dahdi.conf. In sip.conf, station1, station2, and station3 should all have their context set to "sla_stations". For reference, here is the automatically generated dialplan for this situation:

  • extension.conf
[line1]
exten => s,1,SLATrunk(line1)
 
[line2]
exten => s,2,SLATrunk(line2)
 
[sla_stations]
exten => station1,1,SLAStation(station1)
exten => station1_line1,hint,SLA:station1_line1
exten => station1_line1,1,SLAStation(station1_line1)
exten => station1_line2,hint,SLA:station1_line2
exten => station1_line2,1,SLAStation(station1_line2)
exten => station2,1,SLAStation(station2)
exten => station2_line1,hint,SLA:station2_line1
exten => station2_line1,1,SLAStation(station2_line1)
exten => station2_line2,hint,SLA:station2_line2
exten => station2_line2,1,SLAStation(station2_line2)
exten => station3,1,SLAStation(station3)
exten => station3_line1,hint,SLA:station3_line1
exten => station3_line1,1,SLAStation(station3_line1)
exten => station3_line2,hint,SLA:station3_line2
exten => station3_line2,1,SLAStation(station3_line2)

References

  1. https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4816923
  2. https://wiki.asterisk.org/wiki/display/AST/SLA+Trunk+Configuration
  3. https://wiki.asterisk.org/wiki/display/AST/SLA+Dialplan+Configuration
  4. https://wiki.asterisk.org/wiki/display/AST/SLA+Station+Configuration
  5. https://wiki.asterisk.org/wiki/display/AST/Basic+SLA+Configuration+Example