Extensions.conf

From Wikislax

Revision as of 13:27, 7 April 2012 by WikiSysop (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Contexts

The extensions.conf file contains at the beginning a [general] and a [global] section, that you probably won't need to modify, and a set of additional sections - here named contexts - that define how Asterisk handles calls, the dialplan. All of the instructions placed after a context definition are part of that context, until the next context.

The sip.conf file affords defining which users and which channels are associated with which contexts, and this affords ensuring who can do what, and specially who can access expensive communication ressources.

Extensions

An extension is a line composed of :

exten => name,priority,application()     or
exten => name,priority(label),application()

An example of extension processing would be as follows. Priority n means the next sequence value. The call is answered then extension 1 is dialed and transferred if successful, otherwise return is with busy or unavail string and the call is transferred to the voicemail which gives a b (busy) or u (unavail) message then records :

exten => 1,1,Answer()
exten => 1,n,Dial(SIP/1,20,m)
exten => 1,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => 1,n(unavail),Voicemail(1@default,u)
exten => 1,n,Hangup()
exten => 1,n(busy),VoiceMail(1@default,b)
exten => 1,n,Hangup()

Special extensions

Applications

Let's mention a few useful applications :

Variables

Variables can be defined in the [global] using VARIABLE=value, or in the extensions using Set(VARIABLE=value) or Set(GLOBAL(VARIABLE)=value. It is also possible to use Linux environment variables thru ${ENV(VARIABLE)}. The ${EXTEN:start:number} gives back number characters starting at position start of the extension just dialed. ${EXTEN:-4:4} would start four digits from the end and return four digits.

Pattern Matching

To avoid always giving exact extensions it is possible to specify patterns. When several patterns match Asterisk chooses the more specific.

Patterns always start with an underscore _ then can include any of the below :

Example

Here is an example of extensions.conf file with the below behaviour :

[globals]

[general]
autofallthrough=yes

[incoming]
exten => s,1,Answer()
exten => s,n,Dial(SIP/1&SIP/2,20,m)
exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => s,n(unavail),Voicemail(1@default,u)
exten => s,n,Hangup()
exten => s,n(busy),VoiceMail(1@default,b)
exten => s,n,Hangup()

exten => a,1,Answer()
exten => a,n,Background(enter-ext-of-person)
exten => a,n,WaitExten()

exten => 1,1,Answer()
exten => 1,n,Dial(SIP/1,20,m)
exten => 1,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => 1,n(unavail),Voicemail(1@default,u)
exten => 1,n,Hangup()
exten => 1,n(busy),VoiceMail(1@default,b)
exten => 1,n,Hangup()

exten => 2,1,Answer()
exten => 2,n,Dial(SIP/2,20,m)
exten => 2,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => 2,n(unavail),Voicemail(2@default,u)
exten => 2,n,Hangup()
exten => 2,n(busy),VoiceMail(2@default,b)
exten => 2,n,Hangup()

exten => 7,1,Answer()
exten => 7,n,MeetMe(7,M,77)
exten => 7,n,Hangup()

exten => 8,1,Answer()
exten => 8,n,Playback(tt-allbusy)
exten => 8,n,MusicOnHold()

exten => 9,1,Answer()
exten => 9,n,VoiceMailMain()
exten => 9,n,Hangup()

exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(internal,a,1)

exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()

[outgoing]
exten => _0.,1,NoOp()
exten => _0.,n,Dial(SIP/free/${EXTEN},60)
exten => _0.,n,Playtones(congestion)
exten => _0.,n,Hangup()

[internal]
include => incoming
include => outgoing

[external]
include => incoming


Voicemail.conf Main Page Desktop software
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox