Explain the list of commands you can use in extensions.conf or dialplan?
jackson 28-July-2008 03:27:30 PM

Comments


AbsoluteTimeout: Set absolute maximum time of call. Deprecated in favor of TIMEOUT(absolute)
AddQueueMember: Dynamically adds queue members
ADSIProg: Load Asterisk ADSI Scripts into phone
AgentCallbackLogin: Call agent callback login. Deprecated.
AgentLogin: Call agent login
AgentMonitorOutgoing: Monitor Outgoing Agent Calls (0.7.3)
AGI: Executes an AGI compliant application
AlarmReceiver: Emulate an Ademco Contact ID Alarm Receiver
ALSAMonitor: Monitor the ALSA console
Answer: Answer a channel if ringing
AppendCDRUserField: Append data to the CDR user field. Deprecated in favor of CDR(userfield)
Authenticate: Authenticate a user
BackGround: Play a file while awaiting extension
BackgroundDetect: Background a file with talk detect
Bridge: Connect two arbitrary callers (new in Asterisk v1.6)
Busy: Indicate busy condition and wait for hangup
CallingPres: Change the presentation for the callerid in a ZAP channel
ChangeMonitor: Change monitoring filename of a channel
ChanIsAvail: Check if channel is available
ChannelRedirect: Redirect an existing channel to the dialplan
ChanSpy: Universal channel barge-in
CheckGroup: checks if the total # of channels exceeds max
Congestion: Indicate congestion and wait for hangup
ControlPlayback: Play a sound file with fast forward, rewind and exit controls
DBdel: Delete a key from the database.
DBdeltree: Delete a family or keytree from the database.
DBQuery: Execute predefined queries against MySQL Servers, and get the result back into the dialplan.
DBRewrite: Execute perl compatible regular expression and substitution out of a MySQL Database.
DeadAGI: Executes AGI on a hungup channel
Dial: Place an call and connect to the current channel
Dictate: Records and plays back a dictation
DigitTimeout: Set maximum timeout between digits. Deprecated in favor of TIMEOUT(digit)
Directory: Provide directory of voicemail extensions
DISA: DISA (Direct Inward System Access)
DTMFToText: Enter alphanumeric strings with DTMF phone
DUNDiLookup: Look up a number with DUNDi
EAGI: Executes an AGI compliant application on local or remote machine (FastAGI)
Echo: Echo audio read back to the user
EnumLookup: Lookup number in ENUM
ExtenSpy: Listen/whisper to a specific extension (new in 1.4)
Festival: Say text with the Festival voice synthesizer
Flash: Flashes a Zap Trunk
Flite: Say text with the Festival Lite voice synthesizer (faster response than Festival)
ForkCDR: Fork The CDR into 2 seperate entities
GetCPEID: Get ADSI CPE ID
GetGroupCount: group count for specified group or channel is in
GetGroupMatchCount: Calculates group count for all groups that match pattern
Gosub: Jump to a subroutine and return
GosubIf: Conditional jump to a subroutine and return
Goto: Goto a particular priority, extension, or context
GotoIf: Conditional goto
GotoIfTime: Conditional goto on current time
Hangup: Unconditional hangup
HasNewVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
HasVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
ICES: Streaming calls to the Internet
ImportVar: Set variable to value
JabberStatus: Return presence status of client or transport as values 1-7
JabberSend: Send a message to a buddy
LookupBlacklist: Look up Caller*ID name/number from blacklist database. Deprecated in favor of DB.
LookupCIDName: Look up CallerID Name from local database. Deprecated in favor of DB.
Macro: Macro Implementation
MacroExclusive: Only one channel at a time may call this macro, all others have to wait (1.4)
MacroExit: Exit the macro as if it had fully completed (1.4)
MailboxExists: Checks if voicemail mailbox exists
MeetMe: Simple MeetMe conference bridge
MeetMeAdmin: MeetMe conference Administration
MeetMeCount: MeetMe participant count
Milliwatt: Generate a constant 1000Hz tone at 0dbm (mu-law)
MiniVM: Mini-Voicemail (new in v1.6)
MixMonitor: Record and mix call legs
Monitor: Record a telephone conversation to a sound file
MP3Player: Play an MP3 sound file or stream
MusicOnHold: Play Music On Hold indefinitely
MYSQL: Perform various mySQL database activities
NBScat: Play an NBS local stream
NoCDR: Make sure asterisk doesn't save CDR for a certain call
NoOp: No operation. For debugging, see Verbose or Log.
Page: Page multiple endpoints at once
ParkAndAnnounce: Park and Announce
ParkedCall: Answer a parked call
PauseQueueMemeber: Pauses an agent
Perl: res_perl is the mod_perl of Apache, only for Asterisk
Asterisk cmd Pickup: Directed call pickup (in Asterisk 1.2.x)
PickUP: Pickup a Zap Channel before answered
Playback: Play a file
Playtones: Play a tone list while executing other commands
PPPD: PPP daemon connector
PrivacyManager: Require phone number to be entered, if no CallerID sent
Progress: Play early audio to the caller before answering the line
Queue: Queue a call for a call queue
Read: Read a variable
RealTime: Populate variables with details from database using RealTime
Record: Record a telephone conversation to a sound file
RemoveQueueMember: Dynamically removes queue members
ResetCDR: Reset CDR data
ResponseTimeout: Set maximum timeout awaiting response. Deprecated in favor of TIMEOUT(response)
RetryDial: Place a call, retrying on failure allowing optional exit extension.
Return: Return from a Gosub or GosubIf (new in v1.2)
Ringing: Indicate ringing tone
Rpt: Support Amatuer Radio and Commercial Two Way Repeater Linking
SayAlpha: Say Alpha
SayDigits: Say Digits
SayNumber: Say Number
SayPhonetic: Say Phonetic
SayUnixTime: Say the date and/or time
SendDTMF: Sends arbitrary DTMF digits
SendImage: Send an image file
SendText: Send client a text message
SendURL: Send client a URL to display
Set: Set channel variable(s) or function value(s)
SetAccount: Sets account code
SetAMAflags: Set the channel AMA Flags for billing
SetCallerID: Set CallerID. Deprecated in favor of CALLERID.
SetCallerPres: Channel independent setting of caller presenation
SetCDRUserField: Set CDR User Field. See Billing. Deprecated in favor of CDR(userfield)
SetGlobalVar: Set variable to value. Deprecated in favor of GLOBAL.
SIPAddHeader: Add header to outbound SIP invite
SIPCallPickup: Pickup a ringing phone in the pickup group.
SIPGetHeader: Pick any header from a SIP invite message. Deprecated in favor of SIP_HEADER.
SIPdtmfMode: Change DTMF mode during SIP call
SMS: Send and receive SMS (short messaging service)
SoftHangup: Soft Hangup Application
SrxEchoCan: Disable/enable Echo Cancellation
SrxDeflect: Deflect an incoming call
SrxMWI: Set / reset MessageWaitingIndication (MWI) on a Sirrix group
Steal: Steal a Zap Channel after answered
StackPop: Remove a return address without returning (new in v1.2)
StopMonitor: Stop monitoring a channel
StopPlaytones: Stop playing a tone list
System: Execute a system command
Transfer: Transfer caller to remote extension
TestClient: Execute Interface Test Client
TestServer: Execute Interface Test Server
TrySystem: Execute a system command with always 0 returned
TXTCIDName: Lookup caller name from TXT record
UnpauseQueueMemeber: Resumes an agent
UserEvent: Send an arbitrary event to the manager interface
VMAuthenticate: Authenticate a user based on voicemail.conf
VoiceMail: Leave a voicemail message
VoiceMailMain: Enter voicemail system
Wait: Waits for some time
WaitExten: Waits for some time
WaitForRing: Wait for Ring Application
WaitMusicOnHold: Wait, playing Music On Hold
Zapateller: Block telemarketers with SIT
ZapBarge: Barge in (monitor) Zap channel
ZapSendKeypadFacility: Send digits out of band over a PRI
ZapRAS: Provide ISDN data service
ZapScan: Scan Zap channels to monitor calls




Posted by crouse


The extensions.conf file is one of the most used and most important configuration file in Asterisk PBX - it contains the dialplan. What is a dialplan? The dialplan , or we can say "the heart of the Asterisk System", defines how Asterisk PBX will handle incoming and outgoing calls, it also contains all extension numbers. The dialplan is divided in sections called contexts. Every context consists from more than one extensions. What is an extension? The extension is the telephone number, it can be numbers, letters or both. Every extension has a priority and an application. With the help of contexts we can organize our dialplan.

he "extensions.conf" file is made up of sections or contexts between brackets [ ]
There are always two special contexts; [ general ] and [ globals]

[general] context
The [general] manages a few general options:

- static: It indicates if a "save dialplan" command from the console is possible. By default "yes". It works altogether with "writeprotect"
- writeprotect: If writeprotect=no and static=yes "save dialplan" command from the console is possible. The default value is "no".
- autofallthrough: If it is activated and an extension is without things to do the call is finished with a BUSY, CONGESTION or HANGUP message If it is not activated it will be waiting for another extension. It is not convenient that an extension remains without things to do as we explain later.
- clearglobalvars: If it is activated Asterisk release the global variables when the extensions are recharged or when Asterisk is restarted.
- priorityjumping: with 'yes' value the application supports ' jumping' or jump to different priorities. Deprecated

[globals] context
In this context global variables are defined and can be used in the rest of contexts. For example

CONSOLE=Console/dsp ; when we use CONSOLE word we are calling to /Console/dsp

Variables usually are always in capital letters to differentiate them later.

Other contexts[]

We are going to show now how to create an specific context and to assign it a dialplan. All lines of a certain context have the same format:

exten => extension , priority, Command(parameters)

Extensión is the caller number
Priority is the order that commands are run. First the one with priority 1, then with 2, ...
Command is the thing to do.

We are going to learn the commands with some examples.

Example 1: Hangup
exten => 333,1,Hangup ; when someone calls the number 333 the priority 1 is executed and the system makes a hangup

Example 2 : Call to 3000 SIP user and if it is not available call the voicemail.
exten => 3000,1,Dial(SIP/3000,30,Ttm) ; call to the 3000 SIP user that must be defined in sip.conf with that context
exten => 3000,2,Hangup ; hangup when the call finishs
exten => 3000,102,Voicemail(3000) ; 102 Priority is when the user is not connected and the voicemail number 3000 starts.
exten => 3000,103,Hangup ; hangup when the message is left

To call to 3000 extension we use Dial(destination,timeout time,options) command
The destination is the user 3000 of the file sip.conf, we have a timeout of 30 seconds. The user 3000 should exist in sip.conf
The options are options of the dial command:
"T" allows the user to transfer the call pressing #
"t" allows the user to transfer the call pressing #
"m" puts music on hold while we are waiting the other user to respond. You can try without it

If user 3000 is not connected the systems goes to the actual priority + 101 if it exists (in this case 102) and the voicemail number 3000 starts.

It is very important that all the branches finish with a hangup command.

Example 3 : Echo and latency
exten => 600,1,Playback(demo-echotest) ; Sound of echotest
exten => 600,2,Echo ; echo test is run
exten => 600,3,Playback(demo-echodone) ; sound what we said
exten => 600,4,Hangup ; hangup

We call number 600 and the things we said are going to be repeated. We can test the latency of the system

Example 4 : Extension "start"
exten => s,1,Wait,1 ; Wait a second
exten => s,2,Answer ; Answer. Asterisk itself get the call
exten => s,3,DigitTimeout,5 ; Digit Timeout to 5 seconds
exten => s,4,ResponseTimeout,10 ; Response Timeout to 10 seconds
exten => s,5,BackGround(demo-congrats) ; A sound archive
exten => s,6,hangup ; hangup
exten => 1000,1,Goto(mycontext,s,1) ; When we call 1000 number it goes to s extension with priority 1 of "mycontext"

In this case we learn the s (start) extension. It is the one that takes the calls when we are in this context but do not know the extension. Also, it is possible to enter from another extension, for example in this case calling to 1000 extension. With Goto we can go to the context, extension and priority that we want.

Example 5 : Call to a Voip SIP provider

exten => _340.,1,Dial(SIP/${EXTEN:3}@sipprovider,90,Tt)
exten => _340.,2,hangup ; hangup

exten => _20.,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt)
exten => _20.,2,hangup ; hangup

In this case what we do is that when we call 340 followed by any number (340 is the prefix) we will call to a SIP number. For example in the first case if we press 340600600 number we are calling to the 600600 number of the sipprovider defined in sip.conf. (EXTEN:3 means that we deleted the three first numbers)

In the second case if we also press 2060600 we will be calling to the same one number "600600" of "sipprovider" (EXTEN:2)

In the previous cases the point . replaces any character but we can also use
X - number from 0 to 9
Z - number from 1 to 9
N - number from 2 to 9
[1,5-7] - number 1, 5, 6 or 7

exten => _20XX,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20 and two numbers more (no characters)
exten => _20ZZ.,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20, and two numbers from 1 to 9 and anything more
exten => _20[1-3]..,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20, a number from 1 to 3 and anything more

Posted by sagitraz


AbsoluteTimeout: Set absolute maximum time of call. Deprecated in favor of TIMEOUT(absolute)
AddQueueMember: Dynamically adds queue members
ADSIProg: Load Asterisk ADSI Scripts into phone
AgentCallbackLogin: Call agent callback login. Deprecated.
AgentLogin: Call agent login
AgentMonitorOutgoing: Monitor Outgoing Agent Calls (0.7.3)
AGI: Executes an AGI compliant application
AlarmReceiver: Emulate an Ademco Contact ID Alarm Receiver
ALSAMonitor: Monitor the ALSA console
Answer: Answer a channel if ringing
AppendCDRUserField: Append data to the CDR user field. Deprecated in favor of CDR(userfield)
Authenticate: Authenticate a user
BackGround: Play a file while awaiting extension
BackgroundDetect: Background a file with talk detect
Bridge: Connect two arbitrary callers (new in Asterisk v1.6)
Busy: Indicate busy condition and wait for hangup
CallingPres: Change the presentation for the callerid in a ZAP channel
ChangeMonitor: Change monitoring filename of a channel
ChanIsAvail: Check if channel is available
ChannelRedirect: Redirect an existing channel to the dialplan
ChanSpy: Universal channel barge-in
CheckGroup: checks if the total # of channels exceeds max
Congestion: Indicate congestion and wait for hangup
ControlPlayback: Play a sound file with fast forward, rewind and exit controls
DBdel: Delete a key from the database.
DBdeltree: Delete a family or keytree from the database.
DBQuery: Execute predefined queries against MySQL Servers, and get the result back into the dialplan.
DBRewrite: Execute perl compatible regular expression and substitution out of a MySQL Database.
DeadAGI: Executes AGI on a hungup channel
Dial: Place an call and connect to the current channel
Dictate: Records and plays back a dictation
DigitTimeout: Set maximum timeout between digits. Deprecated in favor of TIMEOUT(digit)
Directory: Provide directory of voicemail extensions
DISA: DISA (Direct Inward System Access)
DTMFToText: Enter alphanumeric strings with DTMF phone
DUNDiLookup: Look up a number with DUNDi
EAGI: Executes an AGI compliant application on local or remote machine (FastAGI)
Echo: Echo audio read back to the user
EnumLookup: Lookup number in ENUM
ExtenSpy: Listen/whisper to a specific extension (new in 1.4)
Festival: Say text with the Festival voice synthesizer
Flash: Flashes a Zap Trunk
Flite: Say text with the Festival Lite voice synthesizer (faster response than Festival)
ForkCDR: Fork The CDR into 2 seperate entities
GetCPEID: Get ADSI CPE ID
GetGroupCount: group count for specified group or channel is in
GetGroupMatchCount: Calculates group count for all groups that match pattern
Gosub: Jump to a subroutine and return
GosubIf: Conditional jump to a subroutine and return
Goto: Goto a particular priority, extension, or context
GotoIf: Conditional goto
GotoIfTime: Conditional goto on current time
Hangup: Unconditional hangup
HasNewVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
HasVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
ICES: Streaming calls to the Internet
ImportVar: Set variable to value
JabberStatus: Return presence status of client or transport as values 1-7
JabberSend: Send a message to a buddy
LookupBlacklist: Look up Caller*ID name/number from blacklist database. Deprecated in favor of DB.
LookupCIDName: Look up CallerID Name from local database. Deprecated in favor of DB.
Macro: Macro Implementation
MacroExclusive: Only one channel at a time may call this macro, all others have to wait (1.4)
MacroExit: Exit the macro as if it had fully completed (1.4)
MailboxExists: Checks if voicemail mailbox exists
MeetMe: Simple MeetMe conference bridge
MeetMeAdmin: MeetMe conference Administration
MeetMeCount: MeetMe participant count
Milliwatt: Generate a constant 1000Hz tone at 0dbm (mu-law)
MiniVM: Mini-Voicemail (new in v1.6)
MixMonitor: Record and mix call legs
Monitor: Record a telephone conversation to a sound file
MP3Player: Play an MP3 sound file or stream
MusicOnHold: Play Music On Hold indefinitely
MYSQL: Perform various mySQL database activities
NBScat: Play an NBS local stream
NoCDR: Make sure asterisk doesn't save CDR for a certain call
NoOp: No operation. For debugging, see Verbose or Log.
Page: Page multiple endpoints at once
ParkAndAnnounce: Park and Announce
ParkedCall: Answer a parked call
PauseQueueMemeber: Pauses an agent
Perl: res_perl is the mod_perl of Apache, only for Asterisk
Asterisk cmd Pickup: Directed call pickup (in Asterisk 1.2.x)
PickUP: Pickup a Zap Channel before answered
Playback: Play a file
Playtones: Play a tone list while executing other commands
PPPD: PPP daemon connector
PrivacyManager: Require phone number to be entered, if no CallerID sent
Progress: Play early audio to the caller before answering the line
Queue: Queue a call for a call queue
Read: Read a variable
RealTime: Populate variables with details from database using RealTime
Record: Record a telephone conversation to a sound file
RemoveQueueMember: Dynamically removes queue members
ResetCDR: Reset CDR data
ResponseTimeout: Set maximum timeout awaiting response. Deprecated in favor of TIMEOUT(response)
RetryDial: Place a call, retrying on failure allowing optional exit extension.
Return: Return from a Gosub or GosubIf (new in v1.2)
Ringing: Indicate ringing tone
Rpt: Support Amatuer Radio and Commercial Two Way Repeater Linking
SayAlpha: Say Alpha
SayDigits: Say Digits
SayNumber: Say Number
SayPhonetic: Say Phonetic
SayUnixTime: Say the date and/or time
SendDTMF: Sends arbitrary DTMF digits
SendImage: Send an image file
SendText: Send client a text message
SendURL: Send client a URL to display
Set: Set channel variable(s) or function value(s)
SetAccount: Sets account code
SetAMAflags: Set the channel AMA Flags for billing
SetCallerID: Set CallerID. Deprecated in favor of CALLERID.
SetCallerPres: Channel independent setting of caller presenation
SetCDRUserField: Set CDR User Field. See Billing. Deprecated in favor of CDR(userfield)
SetGlobalVar: Set variable to value. Deprecated in favor of GLOBAL.
SIPAddHeader: Add header to outbound SIP invite
SIPCallPickup: Pickup a ringing phone in the pickup group.
SIPGetHeader: Pick any header from a SIP invite message. Deprecated in favor of SIP_HEADER.
SIPdtmfMode: Change DTMF mode during SIP call
SMS: Send and receive SMS (short messaging service)
SoftHangup: Soft Hangup Application
SrxEchoCan: Disable/enable Echo Cancellation
SrxDeflect: Deflect an incoming call
SrxMWI: Set / reset MessageWaitingIndication (MWI) on a Sirrix group
Steal: Steal a Zap Channel after answered
StackPop: Remove a return address without returning (new in v1.2)
StopMonitor: Stop monitoring a channel
StopPlaytones: Stop playing a tone list
System: Execute a system command
Transfer: Transfer caller to remote extension
TestClient: Execute Interface Test Client
TestServer: Execute Interface Test Server
TrySystem: Execute a system command with always 0 returned
TXTCIDName: Lookup caller name from TXT record
UnpauseQueueMemeber: Resumes an agent
UserEvent: Send an arbitrary event to the manager interface
VMAuthenticate: Authenticate a user based on voicemail.conf
VoiceMail: Leave a voicemail message
VoiceMailMain: Enter voicemail system
Wait: Waits for some time
WaitExten: Waits for some time
WaitForRing: Wait for Ring Application
WaitMusicOnHold: Wait, playing Music On Hold
Zapateller: Block telemarketers with SIT
ZapBarge: Barge in (monitor) Zap channel
ZapSendKeypadFacility: Send digits out of band over a PRI
ZapRAS: Provide ISDN data service
ZapScan: Scan Zap channels to monitor calls

Posted by william



Posted: 29-July-2008 01:12:20 PM By: william

AbsoluteTimeout: Set absolute maximum time of call. Deprecated in favor of TIMEOUT(absolute)
AddQueueMember: Dynamically adds queue members
ADSIProg: Load Asterisk ADSI Scripts into phone
AgentCallbackLogin: Call agent callback login. Deprecated.
AgentLogin: Call agent login
AgentMonitorOutgoing: Monitor Outgoing Agent Calls (0.7.3)
AGI: Executes an AGI compliant application
AlarmReceiver: Emulate an Ademco Contact ID Alarm Receiver
ALSAMonitor: Monitor the ALSA console
Answer: Answer a channel if ringing
AppendCDRUserField: Append data to the CDR user field. Deprecated in favor of CDR(userfield)
Authenticate: Authenticate a user
BackGround: Play a file while awaiting extension
BackgroundDetect: Background a file with talk detect
Bridge: Connect two arbitrary callers (new in Asterisk v1.6)
Busy: Indicate busy condition and wait for hangup
CallingPres: Change the presentation for the callerid in a ZAP channel
ChangeMonitor: Change monitoring filename of a channel
ChanIsAvail: Check if channel is available
ChannelRedirect: Redirect an existing channel to the dialplan
ChanSpy: Universal channel barge-in
CheckGroup: checks if the total # of channels exceeds max
Congestion: Indicate congestion and wait for hangup
ControlPlayback: Play a sound file with fast forward, rewind and exit controls
DBdel: Delete a key from the database.
DBdeltree: Delete a family or keytree from the database.
DBQuery: Execute predefined queries against MySQL Servers, and get the result back into the dialplan.
DBRewrite: Execute perl compatible regular expression and substitution out of a MySQL Database.
DeadAGI: Executes AGI on a hungup channel
Dial: Place an call and connect to the current channel
Dictate: Records and plays back a dictation
DigitTimeout: Set maximum timeout between digits. Deprecated in favor of TIMEOUT(digit)
Directory: Provide directory of voicemail extensions
DISA: DISA (Direct Inward System Access)
DTMFToText: Enter alphanumeric strings with DTMF phone
DUNDiLookup: Look up a number with DUNDi
EAGI: Executes an AGI compliant application on local or remote machine (FastAGI)
Echo: Echo audio read back to the user
EnumLookup: Lookup number in ENUM
ExtenSpy: Listen/whisper to a specific extension (new in 1.4)
Festival: Say text with the Festival voice synthesizer
Flash: Flashes a Zap Trunk
Flite: Say text with the Festival Lite voice synthesizer (faster response than Festival)
ForkCDR: Fork The CDR into 2 seperate entities
GetCPEID: Get ADSI CPE ID
GetGroupCount: group count for specified group or channel is in
GetGroupMatchCount: Calculates group count for all groups that match pattern
Gosub: Jump to a subroutine and return
GosubIf: Conditional jump to a subroutine and return
Goto: Goto a particular priority, extension, or context
GotoIf: Conditional goto
GotoIfTime: Conditional goto on current time
Hangup: Unconditional hangup
HasNewVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
HasVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
ICES: Streaming calls to the Internet
ImportVar: Set variable to value
JabberStatus: Return presence status of client or transport as values 1-7
JabberSend: Send a message to a buddy
LookupBlacklist: Look up Caller*ID name/number from blacklist database. Deprecated in favor of DB.
LookupCIDName: Look up CallerID Name from local database. Deprecated in favor of DB.
Macro: Macro Implementation
MacroExclusive: Only one channel at a time may call this macro, all others have to wait (1.4)
MacroExit: Exit the macro as if it had fully completed (1.4)
MailboxExists: Checks if voicemail mailbox exists
MeetMe: Simple MeetMe conference bridge
MeetMeAdmin: MeetMe conference Administration
MeetMeCount: MeetMe participant count
Milliwatt: Generate a constant 1000Hz tone at 0dbm (mu-law)
MiniVM: Mini-Voicemail (new in v1.6)
MixMonitor: Record and mix call legs
Monitor: Record a telephone conversation to a sound file
MP3Player: Play an MP3 sound file or stream
MusicOnHold: Play Music On Hold indefinitely
MYSQL: Perform various mySQL database activities
NBScat: Play an NBS local stream
NoCDR: Make sure asterisk doesn't save CDR for a certain call
NoOp: No operation. For debugging, see Verbose or Log.
Page: Page multiple endpoints at once
ParkAndAnnounce: Park and Announce
ParkedCall: Answer a parked call
PauseQueueMemeber: Pauses an agent
Perl: res_perl is the mod_perl of Apache, only for Asterisk
Asterisk cmd Pickup: Directed call pickup (in Asterisk 1.2.x)
PickUP: Pickup a Zap Channel before answered
Playback: Play a file
Playtones: Play a tone list while executing other commands
PPPD: PPP daemon connector
PrivacyManager: Require phone number to be entered, if no CallerID sent
Progress: Play early audio to the caller before answering the line
Queue: Queue a call for a call queue
Read: Read a variable
RealTime: Populate variables with details from database using RealTime
Record: Record a telephone conversation to a sound file
RemoveQueueMember: Dynamically removes queue members
ResetCDR: Reset CDR data
ResponseTimeout: Set maximum timeout awaiting response. Deprecated in favor of TIMEOUT(response)
RetryDial: Place a call, retrying on failure allowing optional exit extension.
Return: Return from a Gosub or GosubIf (new in v1.2)
Ringing: Indicate ringing tone
Rpt: Support Amatuer Radio and Commercial Two Way Repeater Linking
SayAlpha: Say Alpha
SayDigits: Say Digits
SayNumber: Say Number
SayPhonetic: Say Phonetic
SayUnixTime: Say the date and/or time
SendDTMF: Sends arbitrary DTMF digits
SendImage: Send an image file
SendText: Send client a text message
SendURL: Send client a URL to display
Set: Set channel variable(s) or function value(s)
SetAccount: Sets account code
SetAMAflags: Set the channel AMA Flags for billing
SetCallerID: Set CallerID. Deprecated in favor of CALLERID.
SetCallerPres: Channel independent setting of caller presenation
SetCDRUserField: Set CDR User Field. See Billing. Deprecated in favor of CDR(userfield)
SetGlobalVar: Set variable to value. Deprecated in favor of GLOBAL.
SIPAddHeader: Add header to outbound SIP invite
SIPCallPickup: Pickup a ringing phone in the pickup group.
SIPGetHeader: Pick any header from a SIP invite message. Deprecated in favor of SIP_HEADER.
SIPdtmfMode: Change DTMF mode during SIP call
SMS: Send and receive SMS (short messaging service)
SoftHangup: Soft Hangup Application
SrxEchoCan: Disable/enable Echo Cancellation
SrxDeflect: Deflect an incoming call
SrxMWI: Set / reset MessageWaitingIndication (MWI) on a Sirrix group
Steal: Steal a Zap Channel after answered
StackPop: Remove a return address without returning (new in v1.2)
StopMonitor: Stop monitoring a channel
StopPlaytones: Stop playing a tone list
System: Execute a system command
Transfer: Transfer caller to remote extension
TestClient: Execute Interface Test Client
TestServer: Execute Interface Test Server
TrySystem: Execute a system command with always 0 returned
TXTCIDName: Lookup caller name from TXT record
UnpauseQueueMemeber: Resumes an agent
UserEvent: Send an arbitrary event to the manager interface
VMAuthenticate: Authenticate a user based on voicemail.conf
VoiceMail: Leave a voicemail message
VoiceMailMain: Enter voicemail system
Wait: Waits for some time
WaitExten: Waits for some time
WaitForRing: Wait for Ring Application
WaitMusicOnHold: Wait, playing Music On Hold
Zapateller: Block telemarketers with SIT
ZapBarge: Barge in (monitor) Zap channel
ZapSendKeypadFacility: Send digits out of band over a PRI
ZapRAS: Provide ISDN data service
ZapScan: Scan Zap channels to monitor calls

Posted: 24-August-2008 08:13:14 AM By: sagitraz

The extensions.conf file is one of the most used and most important configuration file in Asterisk PBX - it contains the dialplan. What is a dialplan? The dialplan , or we can say "the heart of the Asterisk System", defines how Asterisk PBX will handle incoming and outgoing calls, it also contains all extension numbers. The dialplan is divided in sections called contexts. Every context consists from more than one extensions. What is an extension? The extension is the telephone number, it can be numbers, letters or both. Every extension has a priority and an application. With the help of contexts we can organize our dialplan.

he "extensions.conf" file is made up of sections or contexts between brackets [ ]
There are always two special contexts; [ general ] and [ globals]

[general] context
The [general] manages a few general options:

- static: It indicates if a "save dialplan" command from the console is possible. By default "yes". It works altogether with "writeprotect"
- writeprotect: If writeprotect=no and static=yes "save dialplan" command from the console is possible. The default value is "no".
- autofallthrough: If it is activated and an extension is without things to do the call is finished with a BUSY, CONGESTION or HANGUP message If it is not activated it will be waiting for another extension. It is not convenient that an extension remains without things to do as we explain later.
- clearglobalvars: If it is activated Asterisk release the global variables when the extensions are recharged or when Asterisk is restarted.
- priorityjumping: with 'yes' value the application supports ' jumping' or jump to different priorities. Deprecated

[globals] context
In this context global variables are defined and can be used in the rest of contexts. For example

CONSOLE=Console/dsp ; when we use CONSOLE word we are calling to /Console/dsp

Variables usually are always in capital letters to differentiate them later.

Other contexts[]

We are going to show now how to create an specific context and to assign it a dialplan. All lines of a certain context have the same format:

exten => extension , priority, Command(parameters)

Extensión is the caller number
Priority is the order that commands are run. First the one with priority 1, then with 2, ...
Command is the thing to do.

We are going to learn the commands with some examples.

Example 1: Hangup
exten => 333,1,Hangup ; when someone calls the number 333 the priority 1 is executed and the system makes a hangup

Example 2 : Call to 3000 SIP user and if it is not available call the voicemail.
exten => 3000,1,Dial(SIP/3000,30,Ttm) ; call to the 3000 SIP user that must be defined in sip.conf with that context
exten => 3000,2,Hangup ; hangup when the call finishs
exten => 3000,102,Voicemail(3000) ; 102 Priority is when the user is not connected and the voicemail number 3000 starts.
exten => 3000,103,Hangup ; hangup when the message is left

To call to 3000 extension we use Dial(destination,timeout time,options) command
The destination is the user 3000 of the file sip.conf, we have a timeout of 30 seconds. The user 3000 should exist in sip.conf
The options are options of the dial command:
"T" allows the user to transfer the call pressing #
"t" allows the user to transfer the call pressing #
"m" puts music on hold while we are waiting the other user to respond. You can try without it

If user 3000 is not connected the systems goes to the actual priority + 101 if it exists (in this case 102) and the voicemail number 3000 starts.

It is very important that all the branches finish with a hangup command.

Example 3 : Echo and latency
exten => 600,1,Playback(demo-echotest) ; Sound of echotest
exten => 600,2,Echo ; echo test is run
exten => 600,3,Playback(demo-echodone) ; sound what we said
exten => 600,4,Hangup ; hangup

We call number 600 and the things we said are going to be repeated. We can test the latency of the system

Example 4 : Extension "start"
exten => s,1,Wait,1 ; Wait a second
exten => s,2,Answer ; Answer. Asterisk itself get the call
exten => s,3,DigitTimeout,5 ; Digit Timeout to 5 seconds
exten => s,4,ResponseTimeout,10 ; Response Timeout to 10 seconds
exten => s,5,BackGround(demo-congrats) ; A sound archive
exten => s,6,hangup ; hangup
exten => 1000,1,Goto(mycontext,s,1) ; When we call 1000 number it goes to s extension with priority 1 of "mycontext"

In this case we learn the s (start) extension. It is the one that takes the calls when we are in this context but do not know the extension. Also, it is possible to enter from another extension, for example in this case calling to 1000 extension. With Goto we can go to the context, extension and priority that we want.

Example 5 : Call to a Voip SIP provider

exten => _340.,1,Dial(SIP/${EXTEN:3}@sipprovider,90,Tt)
exten => _340.,2,hangup ; hangup

exten => _20.,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt)
exten => _20.,2,hangup ; hangup

In this case what we do is that when we call 340 followed by any number (340 is the prefix) we will call to a SIP number. For example in the first case if we press 340600600 number we are calling to the 600600 number of the sipprovider defined in sip.conf. (EXTEN:3 means that we deleted the three first numbers)

In the second case if we also press 2060600 we will be calling to the same one number "600600" of "sipprovider" (EXTEN:2)

In the previous cases the point . replaces any character but we can also use
X - number from 0 to 9
Z - number from 1 to 9
N - number from 2 to 9
[1,5-7] - number 1, 5, 6 or 7

exten => _20XX,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20 and two numbers more (no characters)
exten => _20ZZ.,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20, and two numbers from 1 to 9 and anything more
exten => _20[1-3]..,1,Dial(SIP/${EXTEN:2}@sipprovider,90,Tt) ; we must call 20, a number from 1 to 3 and anything more

Posted: 01-March-2009 07:12:55 AM By: crouse

AbsoluteTimeout: Set absolute maximum time of call. Deprecated in favor of TIMEOUT(absolute)
AddQueueMember: Dynamically adds queue members
ADSIProg: Load Asterisk ADSI Scripts into phone
AgentCallbackLogin: Call agent callback login. Deprecated.
AgentLogin: Call agent login
AgentMonitorOutgoing: Monitor Outgoing Agent Calls (0.7.3)
AGI: Executes an AGI compliant application
AlarmReceiver: Emulate an Ademco Contact ID Alarm Receiver
ALSAMonitor: Monitor the ALSA console
Answer: Answer a channel if ringing
AppendCDRUserField: Append data to the CDR user field. Deprecated in favor of CDR(userfield)
Authenticate: Authenticate a user
BackGround: Play a file while awaiting extension
BackgroundDetect: Background a file with talk detect
Bridge: Connect two arbitrary callers (new in Asterisk v1.6)
Busy: Indicate busy condition and wait for hangup
CallingPres: Change the presentation for the callerid in a ZAP channel
ChangeMonitor: Change monitoring filename of a channel
ChanIsAvail: Check if channel is available
ChannelRedirect: Redirect an existing channel to the dialplan
ChanSpy: Universal channel barge-in
CheckGroup: checks if the total # of channels exceeds max
Congestion: Indicate congestion and wait for hangup
ControlPlayback: Play a sound file with fast forward, rewind and exit controls
DBdel: Delete a key from the database.
DBdeltree: Delete a family or keytree from the database.
DBQuery: Execute predefined queries against MySQL Servers, and get the result back into the dialplan.
DBRewrite: Execute perl compatible regular expression and substitution out of a MySQL Database.
DeadAGI: Executes AGI on a hungup channel
Dial: Place an call and connect to the current channel
Dictate: Records and plays back a dictation
DigitTimeout: Set maximum timeout between digits. Deprecated in favor of TIMEOUT(digit)
Directory: Provide directory of voicemail extensions
DISA: DISA (Direct Inward System Access)
DTMFToText: Enter alphanumeric strings with DTMF phone
DUNDiLookup: Look up a number with DUNDi
EAGI: Executes an AGI compliant application on local or remote machine (FastAGI)
Echo: Echo audio read back to the user
EnumLookup: Lookup number in ENUM
ExtenSpy: Listen/whisper to a specific extension (new in 1.4)
Festival: Say text with the Festival voice synthesizer
Flash: Flashes a Zap Trunk
Flite: Say text with the Festival Lite voice synthesizer (faster response than Festival)
ForkCDR: Fork The CDR into 2 seperate entities
GetCPEID: Get ADSI CPE ID
GetGroupCount: group count for specified group or channel is in
GetGroupMatchCount: Calculates group count for all groups that match pattern
Gosub: Jump to a subroutine and return
GosubIf: Conditional jump to a subroutine and return
Goto: Goto a particular priority, extension, or context
GotoIf: Conditional goto
GotoIfTime: Conditional goto on current time
Hangup: Unconditional hangup
HasNewVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
HasVoicemail: Conditionally branches to priority + 101. Deprecated in favor of VMCOUNT.
ICES: Streaming calls to the Internet
ImportVar: Set variable to value
JabberStatus: Return presence status of client or transport as values 1-7
JabberSend: Send a message to a buddy
LookupBlacklist: Look up Caller*ID name/number from blacklist database. Deprecated in favor of DB.
LookupCIDName: Look up CallerID Name from local database. Deprecated in favor of DB.
Macro: Macro Implementation
MacroExclusive: Only one channel at a time may call this macro, all others have to wait (1.4)
MacroExit: Exit the macro as if it had fully completed (1.4)
MailboxExists: Checks if voicemail mailbox exists
MeetMe: Simple MeetMe conference bridge
MeetMeAdmin: MeetMe conference Administration
MeetMeCount: MeetMe participant count
Milliwatt: Generate a constant 1000Hz tone at 0dbm (mu-law)
MiniVM: Mini-Voicemail (new in v1.6)
MixMonitor: Record and mix call legs
Monitor: Record a telephone conversation to a sound file
MP3Player: Play an MP3 sound file or stream
MusicOnHold: Play Music On Hold indefinitely
MYSQL: Perform various mySQL database activities
NBScat: Play an NBS local stream
NoCDR: Make sure asterisk doesn't save CDR for a certain call
NoOp: No operation. For debugging, see Verbose or Log.
Page: Page multiple endpoints at once
ParkAndAnnounce: Park and Announce
ParkedCall: Answer a parked call
PauseQueueMemeber: Pauses an agent
Perl: res_perl is the mod_perl of Apache, only for Asterisk
Asterisk cmd Pickup: Directed call pickup (in Asterisk 1.2.x)
PickUP: Pickup a Zap Channel before answered
Playback: Play a file
Playtones: Play a tone list while executing other commands
PPPD: PPP daemon connector
PrivacyManager: Require phone number to be entered, if no CallerID sent
Progress: Play early audio to the caller before answering the line
Queue: Queue a call for a call queue
Read: Read a variable
RealTime: Populate variables with details from database using RealTime
Record: Record a telephone conversation to a sound file
RemoveQueueMember: Dynamically removes queue members
ResetCDR: Reset CDR data
ResponseTimeout: Set maximum timeout awaiting response. Deprecated in favor of TIMEOUT(response)
RetryDial: Place a call, retrying on failure allowing optional exit extension.
Return: Return from a Gosub or GosubIf (new in v1.2)
Ringing: Indicate ringing tone
Rpt: Support Amatuer Radio and Commercial Two Way Repeater Linking
SayAlpha: Say Alpha
SayDigits: Say Digits
SayNumber: Say Number
SayPhonetic: Say Phonetic
SayUnixTime: Say the date and/or time
SendDTMF: Sends arbitrary DTMF digits
SendImage: Send an image file
SendText: Send client a text message
SendURL: Send client a URL to display
Set: Set channel variable(s) or function value(s)
SetAccount: Sets account code
SetAMAflags: Set the channel AMA Flags for billing
SetCallerID: Set CallerID. Deprecated in favor of CALLERID.
SetCallerPres: Channel independent setting of caller presenation
SetCDRUserField: Set CDR User Field. See Billing. Deprecated in favor of CDR(userfield)
SetGlobalVar: Set variable to value. Deprecated in favor of GLOBAL.
SIPAddHeader: Add header to outbound SIP invite
SIPCallPickup: Pickup a ringing phone in the pickup group.
SIPGetHeader: Pick any header from a SIP invite message. Deprecated in favor of SIP_HEADER.
SIPdtmfMode: Change DTMF mode during SIP call
SMS: Send and receive SMS (short messaging service)
SoftHangup: Soft Hangup Application
SrxEchoCan: Disable/enable Echo Cancellation
SrxDeflect: Deflect an incoming call
SrxMWI: Set / reset MessageWaitingIndication (MWI) on a Sirrix group
Steal: Steal a Zap Channel after answered
StackPop: Remove a return address without returning (new in v1.2)
StopMonitor: Stop monitoring a channel
StopPlaytones: Stop playing a tone list
System: Execute a system command
Transfer: Transfer caller to remote extension
TestClient: Execute Interface Test Client
TestServer: Execute Interface Test Server
TrySystem: Execute a system command with always 0 returned
TXTCIDName: Lookup caller name from TXT record
UnpauseQueueMemeber: Resumes an agent
UserEvent: Send an arbitrary event to the manager interface
VMAuthenticate: Authenticate a user based on voicemail.conf
VoiceMail: Leave a voicemail message
VoiceMailMain: Enter voicemail system
Wait: Waits for some time
WaitExten: Waits for some time
WaitForRing: Wait for Ring Application
WaitMusicOnHold: Wait, playing Music On Hold
Zapateller: Block telemarketers with SIT
ZapBarge: Barge in (monitor) Zap channel
ZapSendKeypadFacility: Send digits out of band over a PRI
ZapRAS: Provide ISDN data service
ZapScan: Scan Zap channels to monitor calls