aboutsummaryrefslogtreecommitdiffstats
path: root/doc/sla.txt
blob: acb9cb07b061ee74f35df3eb8b13bcca5984f619 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
-------------------------------------------------------------------------------
--- Shared Line Appearances ---------------------------------------------------
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
INTRODUCTION

The "SLA" functionality in Asterisk is intended to allow a setup that emulates
a simple key system.  It uses the various abstraction layers already built into
Asterisk to emulate key system functionality across various devices, including
IP channels.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
DIALPLAN CONFIGURATION

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 TRUNKS section.

[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)
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
TRUNKS

Be sure to configure the trunk's context to be the same one that is set for the
"autocontext" option in sla.conf if automatic dialplan configuration is used.
This would be done in the regular device entry in zapata.conf, sip.conf, etc.
Note that the automatic dialplan generation creates the SLATrunk() extension
at extension 's'.  This is perfect for Zap 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.


sla.conf:

[line4]
type=trunk
device=Local/disa@line4_outbound


extensions.conf:

[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.
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
STATIONS

Currently, the only channel driver that has all of the features necessary to
support an SLA environment is chan_sip.  Here are some hints on configuring
a SIP phone for use with SLA:

1) Add the SIP channel as a [station] in sla.conf.

2) 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.

3) 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".

   a) Two line buttons must be configured to subscribe to the state of the
      following extensions:
        - station1_line1
        - station1_line2

   b) The line appearance buttons should be configured to dial the extensions
      that they are subscribed to when they are pressed.

   c) 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.
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
VOICEMAIL

This is an example of how you could set up a single voicemail box for the
phone system.  The voicemail box number used in this example is 1234, which
would be configured in voicemail.conf.

For this example, assume that there are 2 trunks and 3 stations.  The trunks
are Zap/1 and Zap/2.  The stations are SIP/station1, SIP/station2, and
SIP/station3.

In zapata.conf, channel 1 has context=line1 and channel 2 has context=line2.

In sip.conf, all three stations are configured with context=sla_stations.

When the stations pick up their phones to dial, they are allowed to dial
NANP numbers for outbound calls, or 8500 for checking voicemail.


sla.conf:

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

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

[station](!)
type=station
trunk=line1
trunk=line2

[station1](station)
device=SIP/station1

[station2](station)
device=SIP/station2

[station3](station)
device=SIP/station3


extensions.conf:

[macro-slaline]
exten => s,1,SLATrunk(${ARG1})
exten => s,n,Goto(s-${SLATRUNK_STATUS}|1)
exten => s-FAILURE,1,Voicemail(1234|u)
exten => s-UNANSWERED,1,Voicemail(1234|u)

[line1]
exten => s,1,Macro(slaline|line1)

[line2]
exten => s,2,Macro(slaline|line2)

[line1_outbound]
exten => disa,1,Disa(no-password|line1_outbound)
exten => _1NXXNXXXXXX,1,Dial(Zap/1/${EXTEN})
exten => 8500,1,VoicemailMain(1234)

[line2_outbound]
exten => disa,1,Disa(no-password|line2_outbound)
exten => _1NXXNXXXXXX,1,Dial(Zap/2/${EXTEN})
exten => 8500,1,VoicemailMain(1234)

[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)

-------------------------------------------------------------------------------