Special extensions
Asterisk makes use of some special extensions, which we will explain now:
Extension Description
a This extension is invoked when a user presses the star key "*" during a
voicemail greeting—usually used to allow access to the voicemail system
from the outside world
h This extension is invoked when a call is hung up
i This extension is invoked when the user has asked for an invalid extension
number in the context
o This extension is called the operator extension and is invoked when the user
pressess the zero "0" key from within the voicemail system
s This extension is the start extension, primarily used in situations where an
inbound call to a context has no information about the extension number
that was dialed (usually associated with Macros and Analog (FXO/FXS)
interfaces)
t This extension is invoked upon a user timeout
T This extension is invoked upon an AbsoluteTimeout timer expiration
failed This extension is invoked when an automatic dial-out feature has failed
(this will be explained later on in this book)
fax This extension is invoked when a Zap (Analog/Digital) channel has detected
a fax signal
talk This extension is invoked by the BackgroundDetect application
-----------------------------------------------------
Here are examples ofsome built-in channel variables:
• ${CALLERID(all)}: The current Caller ID name and number
• ${CALLERID(name)}: The current Caller ID name
• ${CALLERID(num)}: The current Caller ID number
• ${CHANNEL}: The current channel name
• ${CONTEXT}: The name of the current context
-----------------------------------------------------
Mathematical manipulation
• For increment:
exten => s,1,Set(SOMEVAR=${MATH(${SOMEVAR}+1)});
• For decrement:
exten => s,n,Set(SOMEVAR=${MATH(${SOMEVAR}-1)});
• For multiplication:
exten => s,n,Set(SOMEVAR=${MATH(2*${SOMEVAR})}) ;
• For division:
exten => s,n,Set(SOMEVAR=${MATH(${SOMEVAR}/2)}) ;
For backward compatibility with a previous version of Asterisk dialplan scripts, the
following syntax is also available:
• For increment:
exten => s,1,Set(SOMEVAR=$[${SOMEVAR}+1]) ;
• For decrement:
exten => s,n,Set(SOMEVAR=$[${SOMEVAR}-1]) ;
• For multiplication:
exten => s,n,Set(SOMEVAR=$[2*${SOMEVAR}]) ;
• For division:
exten => s,n,Set(SOMEVAR=$[${SOMEVAR}/2]) ;
-----------------------------------------------------
String manipulation
->Substrings
syntax: ${variable:offset[:length]}. The
following are some substring examples:
exten => s,1,Set(SOMEVAR=${12127773456:1}) ; SOMEVAR = 2127773456
exten => s,n,Set(SOMEVAR=${12127773456:1:3}) ; SOMEVAR = 212
exten => s,n,Set(SOMEVAR=${12127773456:-3) ; SOMEVAR = 654
exten => s,n,Set(SOMEVAR=${12127773456:-4:3}) ; SOMEVAR = 345
->String concatenation
The following is an example of a concatenated string:
exten => s,1,Set(SOMEVAR=${VAR1}555${VAR2:3})
-----------------------------------------------------
Variables scoping
->Inheritance
In order to do so, we need to prefix the variable name with either a single underscore
(_) or a double underscore (__). A single underscore will make the variable available
to the next channel in line. A double underscore will make the variable available to
all the channels that are created from the original channel.
The following is an example:
;available to the next channel only
exten => s,1,Set(_NEXT_CHANNEL=12345)
;available to all the channels that will be created from this one
exten=> s,n,Set(__ALL_CHANNELS_AFTER_THIS_ONE=67890)
;this is a global variable, available across all channels
exten => s,n,Set(${GLOBALS(GLOBAL_VAR)}=12345)
-----------------------------------------------------
Applications and functions
->Application: Answer
-= Info about application 'Answer' =-
[Synopsis]
Answer a channel if ringing
[Description]
Answer([delay]): If the call has not been answered, this application
will answer it. Otherwise, it has no effect on the call. If a delay
is specified, Asterisk will wait this number of milliseconds before
returning to the dialplan after answering the call.
->Application: Dial
-= Info about application 'Dial' =-
[Synopsis]
Place a call and connect to the current channel
[Description]
Dial(Technology/resource[&Tech2/resource2...][|timeout][|options]
[|URL]):
This application will place calls to one or more specified channels.
As soon as one of the requested channels answers, the originating
channel will be answered, if it has not already been answered. These
two channels will then be active in a bridged call. All other channels
that were requested will then be hung up.
Unless there is a timeout specified, the Dial application will wait
indefinitely until one of the called channels answers, the user hangs
up, or if all of the called channels are busy or unavailable. Dialplan
executing will continue if no requested channels can be called, or if
the timeout expires.
This application sets the following channel variables upon
completion:
DIALEDTIME - This is the time from dialing a channel until
when it is disconnected.
ANSWEREDTIME - This is the amount of time for actual call.
DIALSTATUS - This is the status of the call:
CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER
|CANCEL | DONTCALL | TORTURE | INVALIDARGS
For the Privacy and Screening Modes, the DIALSTATUS variable will
be set to DONTCALL if the called party chooses to send the calling
party to the 'Go Away' script. The DIALSTATUS variable will be set to
TORTURE if the called party wants to send the caller to the 'torture'
script.
This application will report normal termination if the originating
channel hangs up, or if the call is bridged and either of the parties
in the bridge ends the call.
The optional URL will be sent to the called party if the channel
supports it.
If the OUTBOUND_GROUP variable is set, all peer channels created by
this application will be put into that group (as in Set(GROUP()=...).
If the OUTBOUND_GROUP_ONCE variable is set, all peer channels
created by this application will be put into that group (as in
Set(GROUP()=...). Unlike OUTBOUND_GROUP, however, the variable will be
unset after use.
Options:
A(x) - Play an announcement to the called party, using 'x' as the
file.
C - Reset the CDR for this call.
d - Allow the calling user to dial a 1 digit extension while
waiting for a call to be answered. Exit to that extension
if it exists in the current context, or the context defined
in the EXITCONTEXT variable, if it exists.
D([called][:calling]) - Send the specified DTMF strings *after*
the called party has answered, but before the call gets
bridged. The 'called' DTMF string is sent to the called
party, and the'calling' DTMF string is sent to the calling
party. Both parameters can be used alone.
f - Force the callerid of the *calling* channel to be set as
the extension associated with the channel using a dialplan
'hint'.For example, some PSTNs do not allow CallerID to be
set to anything other than the number assigned to the
caller.
g - Proceed with dialplan execution at the current extension if
the destination channel hangs up.
G(context^exten^pri) - If the call is answered, transfer the
calling party to the specified priority and the called
party to the specified priority+1.
Optionally, an extension, or extension and context may be
specified. Otherwise, the current extension is used. You
cannot use any additional action post answer options in
conjunction with this option.
h - Allow the called party to hang up by sending the '*' DTMF
digit.
H - Allow the calling party to hang up by hitting the '*' DTMF
digit.
i - Asterisk will ignore any forwarding requests it may
receive on this dial attempt.
j - Jump to priority n+101 if all of the requested channels
were busy.
k - Allow the called party to enable parking of the call by
sending the DTMF sequence defined for call parking in
features.conf.
K - Allow the calling party to enable parking of the call by
sending the DTMF sequence defined for call parking in
features.conf.
L(x[:y][:z]) - Limit the call to 'x' ms. Play a warning when 'y'
ms are left. Repeat the warning every 'z' ms. The following
special variables can be used with this option:
* LIMIT_PLAYAUDIO_CALLER yes|no (default yes)
Play sounds to the caller.
* LIMIT_PLAYAUDIO_CALLEE yes|no
Play sounds to the callee.
* LIMIT_TIMEOUT_FILE File to play when time is up.
* LIMIT_CONNECT_FILE File to play when call begins.
* LIMIT_WARNING_FILE File to play as warning if 'y'
is defined. The default is to say the time remaining.
m([class]) - Provide hold music to the calling party until a
requested channel answers. A specific MusicOnHold class
can be specified.
M(x[^arg]) - Execute the Macro for the *called* channel before
connecting to the calling channel. Arguments can be
specified to the Macro using '^' as a delimeter. The
Macro can set the variable MACRO_RESULT to specify the
following actions after the Macro is finished executing.
* ABORT Hangup both legs of the call.
* CONGESTION Behave as if line congestion was
encountered.
* BUSY Behave as if a busy signal was encountered.
This will also have the application jump to
priority n+101 if the 'j' option is set.
* CONTINUE Hangup the called party and allow
the calling party to continue dialplan execution at the
next priority.
* GOTO:<context>^<exten>^<priority> - Transfer the call to the specified priority.
Optionally, an extension,or extension and priority can be specified.
You cannot use any additional action post answer options in
conjunction with this option. Also, pbx services are not
run on the peer (called) channel, so you will not be able
to set timeouts via the TIMEOUT() function in this macro.
n - This option is a modifier for the screen/privacy mode. It
specifies that no introductions are to be saved in the
priv-callerintros directory.
N - This option is a modifier for the screen/privacy mode. It
specifies that if callerID is present, do not screen the
call.
o - Specify that the CallerID that was present on the *calling*
channel be set as the CallerID on the *called* channel.
This was the behavior of Asterisk 1.0 and earlier.
O([x]) - "Operator Services" mode (Zaptel channel to Zaptel
channel only, if specified on non-Zaptel interface, it
will be ignored). When the destination answers (presumably
an operator services station), the originator no longer has
control of their line.
They may hang up, but the switch will not release their
line until the destination party hangs up (the operator).
Specified without an arg, or with 1 as an arg, the
originator hanging up will cause the phone to ring back
immediately. With a 2 specified, when the "operator"
flashes the trunk, it will ring their phone back.
p - This option enables screening mode. This is basically
Privacy mode without memory.
P([x]) - Enable privacy mode. Use 'x' as the family/key in the
database if it is provided. The current extension is used
if a database family/key is not specified.
r - Indicate ringing to the calling party. Pass no audio to the
calling party until the called channel has answered.
S(x) - Hang up the call after 'x' seconds *after* the called party
has answered the call.
t - Allow the called party to transfer the calling party by
sending the DTMF sequence defined in features.conf.
T - Allow the calling party to transfer the called party by
sending the DTMF sequence defined in features.conf.
w - Allow the called party to enable recording of the call by
sending the DTMF sequence defined for one-touch recording
in features.conf.
W - Allow the calling party to enable recording of the call by
sending the DTMF sequence defined for one-touch recording
in features.conf.
->Application: Playback
-= Info about application 'Playback' =-
[Synopsis]
Play a file
[Description]
Playback(filename[&filename2...][|option]): Plays back given
filenames (do not put extension). Options may also be included
following a pipe symbol. The 'skip' option causes the playback of the
message to be skipped if the channel is not in the 'up' state (i.e. it
hasn't been answered yet). If 'skip' is specified, the application
will return immediately should the channel not be
off hook. Otherwise, unless 'noanswer' is specified, the channel
will be answered before the sound is played. Not all channels
support playing messages while still on hook. If 'j' is specified,
the application will jump to priority n+101 if present when a file
specified to be played does not exist.
This application sets the following channel variable upon completion:
PLAYBACKSTATUS The status of the playback attempt as a text
string, one of SUCCESS | FAILED
->Application: Background
-= Info about application 'BackGround' =-
[Synopsis]
Play an audio file while waiting for digits of an extension to go to.
[Description]
Background(filename1[&filename2...][|options[|langoverride]
[|context]]): This application will play the given list of files (do
not put extension) while waiting for an extension to be dialed by the
calling channel. To continue waiting for digits after this application
has finished playing files, the WaitExten application should be
used. The 'langoverride' option explicitly specifies which language
to attempt to use for the requested sound files. If a 'context' is
specified, this is the dialplan context that this application will use
when exiting to a dialed extension. If one of the requested sound
files does not exist, call processing will be terminated.
Options:
s - Causes the playback of the message to be skipped
if the channel is not in the 'up' state (i.e. it
hasn't been answered yet). If this happens, the
application will return immediately.
n - Don't answer the channel before playing the files.
m - Only break if a digit hit matches a one digit
extension in the destination context.
->Application: WaitExten
-= Info about application 'WaitExten' =-
[Synopsis]
Waits for an extension to be entered
[Description]
WaitExten([seconds][|options]): This application waits for the user
to enter a new extension for a specified number of seconds.
Note that the seconds can be passed with fractions of a second. For
example,'1.5' will ask the application to wait for 1.5 seconds.
Options:
m[(x)] - Provide music on hold to the caller while waiting for an
extension. Optionally, specify the class for music on
hold within parenthesis.
->Application: Hangup
-= Info about application 'Hangup' =-
[Synopsis]
Hang up the calling channel
[Description]
Hangup([causecode]): This application will hang up the calling
channel. If a causecode is given the channel's hangup cause will be
set to the given value.
->Application: SoftHangup
-= Info about application 'SoftHangup' =-
[Synopsis]
Soft Hangup Application
[Description]
SoftHangup(Technology/resource|options)
Hangs up the requested channel. If there are no channels to hangup,
the application will report it.
- 'options' may contain the following letter:
'a' : hang up all channels on a specified device instead of a
single resource
->Application: EndWhile
-= Info about application 'EndWhile' =-
[Synopsis]
End a while loop
[Description]
Usage: EndWhile()
Return to the previous called While
------------------------------------------------------
[AutomaticAttendantDemo]
exten => _X.,1,Answer ; Answer inbound calls with 2 or
; more digits extensions
exten => _X.,n,Wait(2) ; Perform a simple 2 seconds delay
exten => _X.,n,Playback(welcome)
exten => _X.,n,Set(Loop=0)
exten => _X.,n,While($[${Loop} < 3])
exten => _X.,n,Background(menu)
exten => _X.,n,WaitExten(5) ; Wait 5 seconds for user to enter input
exten => _X.,n,Set(Loop=$[${Loop}+1])
exten => _X.,n(LoopEnd),EndWhile()
exten => _X.,n,Hangup() ; No input from user, so hangup
exten => 1,1,Playback(msg1)
exten => 1,n,Dial(SIP/300,60,rg)
exten => 1,n,Hangup()
exten => 2,1,Playback(msg2)
exten => 2,n,Dial(SIP/301,60,rg)
exten => 2,n,Hangup()
exten => 3,1,Playback(msg3)
exten => 3,n,Dial(SIP/302,60,rg)
exten => 3,n,Hangup()
exten => 9,n,Hangup()
exten => i,1,Set(Loop=$[${Loop}+1])
exten => i,n,Goto(LoopEnd)
exten => t,1,Set(Loop=$[${Loop}+1])
exten => t,n,Goto(LoopEnd)
-----------------------------------------------------
->"Read" application
-= Info about application 'Read' =-
[Synopsis]
Read a variable
[Description]
Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])
Reads a #-terminated string of digits a certain number of times from
the user in to the given variable.
filename -- file to play before reading digits or tone with
option i
maxdigits -- maximum acceptable number of digits. Stops reading
after maxdigits have been entered (without requiring
the user to press the '#' key).
Defaults to 0 - no limit - wait for the user press
the '#' key.
Any value below 0 means the same. Max accepted value
is 255.
option -- options are 's' , 'i', 'n'
's' to return immediately if the line is not up,
'i' to play filename as an indication tone from your
indications.conf
'n' to read digits even if the line is not up.
attempts -- if greater than 1, that many attempts will be made in
the event no data is entered.
timeout -- An integer number of seconds to wait for a digit
response. If greater than 0, that value will override
the default timeout.
->Goto and GotoIf
Let's now evaluate the Goto and GotoIf applications:
-= Info about application 'Goto' =-
[Synopsis]
Jump to a particular priority, extension, or context
[Description]
Goto([[context|]extension|]priority): This application will set
the current context, extension, and priority in the channel structure.
After it completes, the pbx engine will continue dialplan execution
at the specified location.
If no specific extension, or extension and context, are specified,
then this application will just set the specified priority of the
current extension.
At least a priority is required as an argument, or the goto will
return a -1, and the channel and call will be terminated.
If the location that is put into the channel information is bogus,
and asterisk cannot find that location in the dialplan, then the
execution engine will try to find and execute the code in the 'i'
(invalid) extension in the current context. If that does not exist, it
will try to execute the 'h' extension. If either or neither the 'h'
or 'i' extensions have been defined, the channel is hung up, and the
execution of instructions on the channel is terminated.
What this means is that, for example, you specify a context that
does not exist, then it will not be possible to find the 'h' or 'i'
extensions, and the call will terminate!
-= Info about application 'GotoIf' =-
[Synopsis]
Conditional goto
[Description]
GotoIf(condition?[labeliftrue]:[labeliffalse]): This application
will set the current context, extension, and priority in the channel
structure based on the evaluation of the given condition. After this
application completes, the pbx engine will continue dialplan execution
at the specified location in the dialplan.
The channel will continue at 'labeliftrue' if the condition is true,
or 'labeliffalse' if the condition is false. The labels are specified
with the same syntax as used within the Goto application. If the
label chosen by the condition is omitted, no jump is performed, and
the execution passes to the next instruction.
If the target location is bogus, and does not exist, the execution
engine will try to find and execute the code in the 'i' (invalid)
extension in the current context. If that does not exist, it will try
to execute the 'h' extension. If either or neither the 'h' or 'i'
extensions have been defined, the channel is hung up, and the execution
of instructions on the channel is terminated.
Remember that this command can set the current context, and if the
context specified does not exist, then it will not be able to find any
'h' or 'i' extensions there, and the channel and call will both be
terminated!
-----------------------------------------------------
This evaluation will return a constant false value,
$[${CALLERID(name)} ="Simon"] as its syntax is incorrect. In order to indicate to
Asterisk that we want to evaluate strings, we must
use the quotes indication with the variable name
$["${CALLERID(name)}" ="Simon"] This is the correct form of the previous evaluation
-----------------------------------------------------
Logical operators
• expr1 | expr2 (Logical OR)
If expr1 evaluates to a non-empty string or a non-zero value, "true" value is
returned. Otherwise, the evaluation of expr2 is returned.
• expr1 & expr2 (Logical AND)
If both the expressions evaluate to non-empty strings or non-zero values,
then value "1" (true) is returned, else "0" (false) is returned.
• !expr (Logical Unary Complement)
There should'nt be a space between the '!' and the expression, else an error
will occur.
-----------------------------------------------------
Comparison operators
Now we will see the comparison operators.
• expr1 = expr2
• expr1 != expr2
• expr1 < expr2
• expr1 > expr2
• expr1 <= expr2
• expr1 >= expr2
-----------------------------------------------------
Arithmetic operators
The following are arithmetic operators.
• expr1 + expr2
• expr1 - expr2
• - expr (unary negation operator)
Return the results of addition or subtraction of integer-valued arguments.
• expr1 * expr2
• expr1 / expr2
• expr1 % expr2
Return the results of multiplication, integer division, or the remainder of the
integer-valued arguments.
-----------------------------------------------------
Regular expressions
Asterisk allows the use of regular expressions within the dialplan. While the regular
expressions are not an integral part of this book, we include an example here that
may assist you in writing regular expressions of your own.
exten => stripcidtext,n,Set(regx="([0-9]+)")
; Note the quotes -- and note that parentheses are REQUIRED if you
; want to return the matched string
exten => stripcidtext,n,Set(cid2=$["${cid}" : ${regx}])
; Returns numeric beginning to string
-----------------------------------------------------
Operator precedence
Just as any other programming language, operators follow a certain order of
precedence. The following are the precedence rules for Asterisk's operators:
1. Parentheses—( )
2. Unary operators— !, -
3. Regular expression comparison—:, =~
4. Multiplicative arithmetic operators— *, /, %
5. Additive arithmetic operators— +, -
6. Comparison operators— =, !=, <, >, <=, >=
7. Logical operators— |, &
8. Conditional operator— ? :
-----------------------------------------------------
Gosub and GosubIf
-= Info about application 'Gosub' =-
[Synopsis]
Jump to label, saving return address
[Description]
Gosub([[context|]exten|]priority)
Jumps to the label specified, saving the return address.
-= Info about application 'GosubIf' =-
[Synopsis]
Conditionally jump to label, saving return address
[Description]
GosubIf(condition?labeliftrue[:labeliffalse])
If the condition is true, then jump to labeliftrue. If false,
jumps to labeliffalse, if specified. In either case, a jump saves the
return point in the dialplan, to be returned to with a Return.
As you can see, the main difference between the two directives is that GosubIf
enables us to branch into our subroutine using an evaluation. Unlike the Goto
directive, the Gosub directive has the ability to save the location that we branched
from, and return to the next step in sequence. This enables new functionality,
especially in modularizing our dialplan code.
-----------------------------------------------------
Exec, ExecIf, and TryExec
Let's now evaluate the Exec, ExecIf, and TryExec applications now:
-= Info about application 'Exec' =-
[Synopsis]
Executes dialplan application
[Description]
Usage: Exec(appname(arguments))
Allows an arbitrary application to be invoked even when not
hardcoded into the dialplan. If the underlying application
terminates the dialplan, or if the application cannot be found,
Exec will terminate the dialplan.
To invoke external applications, see the application System.
If you would like to catch any error instead, see TryExec.
-= Info about application 'ExecIf' =-
[Synopsis]
Executes dialplan application, conditionally
[Description]
Usage: ExecIF (<expr>|<app>|<data>)
If <expr> is true, execute and return the result of <app>(<data>).
If <expr> is true, but <app> is not found, then the application
will return a non-zero value.
-= Info about application 'TryExec' =-
[Synopsis]
Executes dialplan application, always returning
[Description]
Usage: TryExec(appname(arguments))
Allows an arbitrary application to be invoked even when not
hardcoded into the dialplan. To invoke external applications
see the application System. Always returns to the dialplan.
The channel variable TRYSTATUS will be set to:
SUCCESS if the application returned zero
FAILED if the application returned non-zero
NOAPP if the application was not found or was not specified
-----------------------------------------------------
-= Info about application 'Busy' =-
[Synopsis]
Indicate the Busy condition
[Description]
Busy([timeout]): This application will indicate the busy condition
to the calling channel. If the optional timeout is specified, the
calling channel will be hung up after the specified number of seconds.
Otherwise, this application will wait until the calling channel
hangs up.
-= Info about application 'Congestion' =-
[Synopsis]
Indicate the Congestion condition
[Description]
Congestion([timeout]): This application will indicate the congestion
condition to the calling channel. If the optional timeout is
specified, the calling channel will be hung up after the specified
number of seconds.
Otherwise, this application will wait until the calling channel
hangs up.
-= Info about application 'ControlPlayback' =-
[Synopsis]
Play a file with fast forward and rewind
[Description]
ControlPlayback(file[|skipms[|ff[|rew[|stop[|pause[|restart|
options]]]]]]]):
This application will play back the given filename. By default,
the '*' key
can be used to rewind, and the '#' key can be used to fast-forward.
Parameters:
skipms - This is number of milliseconds to skip when rewinding or
fast-forwarding.
ff - Fast-forward when this DTMF digit is received.
rew - Rewind when this DTMF digit is received.
stop - Stop playback when this DTMF digit is received.
pause - Pause playback when this DTMF digit is received.
restart - Restart playback when this DTMF digit is received.
Options:
j - Jump to priority n+101 if the requested file is not found.
This application sets the following channel variable upon completion:
CPLAYBACKSTATUS - This variable contains the status of the attempt
as a text string, one of: SUCCESS | USERSTOPPED
| ERROR
-= Info about application 'SayAlpha' =-
[Synopsis]
Say Alpha
[Description]
SayAlpha(string): This application will play the sounds that
correspond to the letters of the given string.
-= Info about application 'SayDigits' =-
[Synopsis]
Say Digits
[Description]
SayDigits(digits): This application will play the sounds that
correspond to the digits of the given number. This will use the
language that is currently set for the channel. See the LANGUAGE
function for more information on setting the language for the channel.
-= Info about application 'SayNumber' =-
[Synopsis]
Say Number
[Description]
SayNumber(digits[,gender]): This application will play the sounds
that correspond to the given number. Optionally, a gender may be
specified.
This will use the language that is currently set for the channel. See
the LANGUAGE function for more information on setting the language for
the channel.
-= Info about application 'Monitor' =-
[Synopsis]
Monitor a channel
[Description]
Monitor([file_format[:urlbase]|[fname_base]|[options]]):
Used to start monitoring a channel. The channel's input and output
voice packets are logged to files until the channel hangs up or
monitoring is stopped by the StopMonitor application.
file_format optional, if not set, defaults to "wav"
fname_base if set, changes the filename used to the one
specified.
options:
m - when the recording ends mix the two leg files into one and
delete the two leg files. If the variable MONITOR_EXEC is
set, the application referenced in it will be executed
instead of soxmix and the raw leg files will NOT be deleted
automatically.
soxmix or MONITOR_EXEC is handed 3 arguments, the two leg
files and a target mixed file name which is the same as the
leg file names only without the in/out designator.
If MONITOR_EXEC_ARGS is set, the contents will be passed on
as additional arguements to MONITOR_EXEC
Both MONITOR_EXEC and the Mix flag can be set from the
administrator interface
b - Don't begin recording unless a call is bridged to
another channel
Returns -1 if monitor files can't be opened or if the channel is
already monitored, otherwise 0.
-= Info about application 'StopMonitor' =-
[Synopsis]
Stop monitoring a channel
[Description]
StopMonitor
Stops monitoring a channel. Has no effect if the channel is not
monitored
-= Info about application 'MixMonitor' =-
[Synopsis]
Record a call and mix the audio during the recording
[Description]
MixMonitor(<file>.<ext>[|<options>[|<command>]])
Records the audio on the current channel to the specified file.
If the filename is an absolute path, uses that path, otherwise
creates the file in the configured monitoring directory from
asterisk.conf.
Valid options:
a - Append to the file instead of overwriting it.
b - Only save audio to the file while the channel is bridged.
Note: Does not include conferences or sounds played to
each bridged party.
v(<x>) - Adjust the heard volume by a factor of <x> (range -4 to 4)
V(<x>) - Adjust the spoken volume by a factor of <x> (range -4 to 4)
W(<x>) - Adjust the both heard and spoken volumes by a factor of <x>
(range -4 to 4)
<command> will be executed when the recording is over
Any strings matching ^{X} will be unescaped to ${X}.
All variables will be evaluated at the time MixMonitor is called.
The variable MIXMONITOR_FILENAME will contain the filename used to
record.
-= Info about application 'StopMixMonitor' =-
[Synopsis]
Stop recording a call through MixMonitor
[Description]
StopMixMonitor()
Stops the audio recording that was started with a call to MixMonitor()
on the current channel.
-= Info about application 'MusicOnHold' =-
[Synopsis]
Play Music On Hold indefinitely
[Description]
MusicOnHold(class): Plays hold music specified by class. If omitted,
the default music source for the channel will be used. Set the default
class with the SetMusicOnHold() application.
Returns -1 on hangup.
Never returns otherwise.
先写到这里吧...太多了...