Applications Reference

AbsoluteTimeout : Set absolute maximum time of call. AbsoluteTimeout(seconds)

Set the absolute maximum amount of time permitted for a call. A setting of 0 disables the timeout. Always returns 0.


exten=>5551234,1,SetAbsoluteTimeout(600) ;limit calls to ex-girlfriend to 600 seconds
exten=>5551234,2,Dial(Zap/1/5551234)
	

AddQueueMember : Dynamically adds queue members. AddQueueMember(queuename[|interface])

Dynamically adds interface to an existing queue. Returns -1 if there is an error.


exten=>123,1,AddQueueMember(techsupport|SIP/3000);add person at SIP/3000 to the techsupport queue
	

ADSIProg: Load Asterisk ADSI Scripts into phone. ADSIProg(script)

Programs an ADSI Phone with the given script. If none is specified, the default is used.

Returns 0 unless CPE is hung up.

AgentCallbackLogin: Call agent callback login. AgentCallbackLogin([AgentNo][|[options][exten]@context])

AgentCallbackLogin() logs an agent into an extension within a given context. The context i must be specified. All other parameters are optional, and will be prompted for.

When AgentCallbackLogin() is used, calls to the agent will be proxied by way of the Local channel, so that only one call from the queue can arrive at the agent's phone at a time.

Tip

The agent proxy channel is not aware of calls which did not go through the proxy, so it is possible to get an agent call while on another call which was not made through the proxy.

To log out an agent, you must have them AgentCallbackLogin() to a null extension by pressing # at the new extension prompt.

Always returns -1.

AgentLogin: Call agent login. AgentLogin([AgentNo][|options])

Asks the agent to login to the system. Always returns -1. While logged in, the agent can receive calls and will hear a 'beep' when a new call comes in. The agent can dump the call by pressing the star key.

The option string may contain zero or more of the following characters:

's' -- silent login - do not announce the login OK segment

AGI: Executes an AGI compliant application. [E]AGI(command[|args])

Executes an Asterisk Gateway Interface compliant program on a channel. AGI allows Asterisk to launch external programs written in any language to control a telephony channel, play audio, read DTMF digits, etc. by communicating with the AGI protocol on STDIN and STDOUT. Returns -1 on hangup or if application requested hangup, or 0 on non-hangup exit. Using 'EAGI' provides enhanced AGI, with audio available out of band on file descriptor 3.

Answer: Answer a channel if ringing. Answer()

If the channel is ringing, answer it, otherwise do nothing.

Returns 0 unless it tries to answer the channel and fails.

Authenticate: Authenticate a user. Authenticate(password[|options])

Requires a user to enter a given password in order to continue execution. If the password begins with the '/' character, it is interpreted as a file which contains a list of valid passwords (1 per line). an optional set of options may be provided by concatenating any of the following letters:

a - Set account code to the password that is entered

Returns 0 if the user enters a valid password within three tries, or -1 otherwise (or on hangup).

BackGround: Play a file while awaiting extension. Background(filename)

Plays a given file, while simultaneously waiting for the user to begin typing an extension. The timeouts do not count until the last BackGround application as ended.

Always returns 0.

Busy: Indicate busy condition and stop. Busy()

Requests that the channel indicate busy condition and then waits for the user to hang up.

Always returns -1.

CallingPres: Change the presentation for the Caller*ID. CallingPres(number)

Changes the presentation for the Caller*ID. Should be called before placing an outgoing call.

ChangeMonitor: Change monitoring filename of a channel. ChangeMonitor(filename_base)

Changes monitoring filename of a channel. Has no effect if the channel is not monitored The option string may contain the following:

filename_base -- if set, changes the filename used to the one specified.

ChanIsAvail: Check if channel is available. ChanIsAvail(Technology/resource[&Technology2/resource2...])

Checks is any of the requested channels are available. If none of the requested channels are available the new priority will be n+101 (unless such a priority does not exist, in which case ChanIsAvail will return -1). If any of the requested channels are available, the next priority will be n+1, the channel variable ${AVAILCHAN} will be set to the name of the available channel and the ChanIsAvail app will return 0.

Congestion: Indicate congestion and stop. Congestion()

Requests that the channel indicate congestion and then waits for the user to hang up.

Always returns -1.

Cut: Cut out part of a variable. Cut(newvar=varname,delimiter,fieldspec)

Cuts out part of a variable and assigns it to a new variable

newvar

new variable created from result string

varname

variable you want cut

delimiter

defaults to '-'

fieldspec

number of the field you want. Field numbers start at 1. The fieldspec may also be specified as a range (with -) or group of ranges and fields (with &)

Returns 0 or -1 on hangup or error.

DateTime: Say the date and time. DateTime()

Says the current date and time. Returns -1 on hangup or 0 otherwise.

DBdel: Delete a key from the database. DBdel(family/key)

Deletes a key from the Asterisk database. Always returns 0.

DBdeltree: Delete a family or key tree from the database. DBdeltree(family[/keytree])

Deletes a family or key tree from the Asterisk database. Always returns 0.

DBget: Retrieve a value from the database. DBget(varname=family/key)

Retrieves a value from the Asterisk database and stores it in the given variable. Always returns 0. If the requested key is not found, jumps to priority n+101 if available.

DBput: Store a value in the database. DBput(family/key=value)

Stores the given value in the Asterisk database. Always returns 0.

Dial: Place a call and connect to the current channel. Dial(Technology/resource[&Technology2/resource2...][|timeout][|options][|URL])

Requests one or more channels and places specified outgoing calls on them. As soon as a channel answers, the Dial app will answer the originating channel (if it needs to be answered) and will bridge a call with the channel which first answered. All other calls placed by the Dial app will be hung up. If a timeout is not specified, the Dial application will wait indefinitely until either one of the called channels answers, the user hangs up, or all channels return busy or error.

In general, the dialer will return 0 if it was unable to place the call, or the timeout expired. However, if all channels were busy, and there exists an extension with priority n+101 (where n is the priority of the dialer instance), then it will be the next executed extension (this allows you to setup different behavior on busy from no-answer).

This application returns -1 if the originating channel hangs up, or if the call is bridged and either of the parties in the bridge terminate the call. The option string may contain zero or more of the following characters:

t

allow the called user transfer the calling user

T

to allow the calling user to transfer the call.

r

indicate ringing to the calling party, pass no audio until answered.

m

provide hold music to the calling party until answered.

H

allow caller to hang up by hitting *.

C

reset call detail record for this call.

P[(x)]

privacy mode, using x as database if provided.

g

goes on in context if the destination channel hangs up

A(x)

play an announcement to the called party, using x as file

In addition to transferring the call, a call may be parked and then picked up by another user.

The optional URL will be sent to the called party if the channel supports it.

DigitTimeout: Set maximum timeout between digits. DigitTimeout(seconds)

Set the maximum amount of time permitted between digits when the user is typing in an extension. When this timeout expires, after the user has started to type in an extension, the extension will be considered complete, and will be interpreted. Note that if an extension typed in is valid, it will not have to timeout to be tested, so typically at the expiry of this timeout, the extension will be considered invalid (and thus control would be passed to the 'i' extension, or if it doesn't exist the call would be terminated).

Always returns 0.

Directory: Provide directory of voicemail extensions. Directory(context)

Presents the user with a directory of extensions from which they may select by name. The list of names and extensions is discovered from voicemail.conf. The context argument is required, and specifies the context in which to interpret the extensions.

Directory() also sets up the channel on exit to enter the extension the user selected.

Returns 0 unless the user hangs up.

DISA: Direct Inward System Access. DISA(passcode[|context[|caller-id]])

Allows someone from outside the telephone switch (PBX) to obtain an "internal" system dial tone and to place calls from it as if they were placing a call from within the switch. A user calls a number that connects to the DISA application and is given dial tone. The user enters their passcode, followed by the pound sign (#). If the passcode is correct, the user is then given system dial tone on which a call may be placed. Obviously, this type of access has SERIOUS security implications, and GREAT care must be taken not to compromise your security.

There is a possibility of accessing DISA without password. Simply exchange your password with 'no-password'.


exten => s,1,DISA(no-password|local)

but be aware of using this for your security compromising.

The arguments to this application (in extensions.conf) allow either specification of a single global password (that everyone uses), or individual passwords contained in a file. It also allow specification of the context on which the user will be dialing. If no context is specified, the DISA application defaults the context to "disa" presumably that a normal system will have a special context set up for DISA use with some or a lot of restrictions. The arguments are one of the following:

numeric-passcode
numeric-passcode|context
full-pathname-of-file-that-contains-passcodes

The file that contains the passcodes (if used) allows specification of either just a passcode (defaulting to the "disa" context, or passcode|context on each line of the file. The file may contain blank lines, or comments starting with "#" or ";". In addition, the above arguments may have |new-callerid-string appended to them, to specify a new (different) CallerID to be used for this call, for example:

numeric-passcode|context|"My Phone" <(234) 123-4567>

or

full-pathname-of-passcode-file|"My Phone" <(234) 123-4567>

Note that in the case of specifying the numeric-passcode, the context must be specified if the CallerID is specified also.

If login is successful, the application parses the dialed number in the specified (or default) context, and returns 0 with the new extension context filled-in and the priority set to 1, so that the PBX may re-apply the routing tables to it and complete the call normally.

EAGI: Enhanced Application Gateway Interface. See AGI.

Echo: Echo audio read back to the user. Echo()

Echo audio read from channel back to the channel.

Returns 0 if the user exits with the # key, or -1 if the user hangs up.

EnumLookup: Lookup number in ENUM. EnumLookup(exten)

Looks up an extension via ENUM and sets the variable 'ENUM'. For VoIP URIs this variable will look like 'TECHNOLOGY/URI' with the appropriate technology.

Returns -1 on hangup, or 0 on completion regardless of whether the lookup was successful.

Note

Currently, the enumservices SIP, H323, IAX, IAX2 and TEL are recognized. A good SIP, H323, IAX or IAX2 entry will result in normal priority handling, whereas a good TEL entry will increase the priority by 51 (if existing). If the lookup was not successful and there exists a priority n + 101, then that priority will be taken next.

Festival: Say text to the user. Festival(text[|intkeys])

Connect to Festival, send the argument, get back the waveform, play it to the user, allowing any given interrupt keys to immediately terminate and return the value, or 'any' to allow any number back (useful in dialplan)

Note

Remember, you must have the Festival server up and running before using this application.

Flash: Flashes a Zap Trunk. Flash()

Sends a flash on a Zap trunk. This is only a hack for people who want to perform transfers and such via AGI and is generally quite useless otherwise.

Returns 0 on success or -1 if this is not a Zap trunk

GetCPEID: Get ADSI CPE ID. GetCPEID()

Obtains and displays CPE ID and other information in order to properly setup zapata.conf for on-hook operations.

Returns -1 on hangup only.

Goto: Goto a particular priority, extension, or context. Goto([[context|]extension|]priority)

Set the priority to the specified value, optionally setting the extension and optionally the context as well. The extension BYEXTENSION is special in that it uses the current extension, thus permitting you to go to a different context, without specifying a specific extension.

Always returns 0, even if the given context, extension, or priority is invalid.

GotoIf: Conditional goto. GotoIf(Condition?label1:label2)

Go to label1 if condition is true, to label2 if condition is false. Either label1 or label2 may be omitted (in that case, we just don't take the particular branch) but not both.

GotoIfTime: Conditional goto on current time. GotoIfTime(<times>|<weekdays>|<mdays>|<months>?[[context|]extension|]priority)

If the current time matches the specified time, then branch to the specified extension. Each of the elements may be specified either as '*' (for always) or as a range. See the include syntax.

Hangup: Unconditional hangup. Hangup()

Unconditionally hangs up a given channel.

Always returns -1.

HasNewVoicemail: Check to see if a voicemail box contains new messages. HasNewVoicemail(vmbox[@context][|varname])

Branches to priority + 101, if there is new voicemail. Optionally sets varname to the number of new messages.

LookupBlacklist: Look up Caller*ID name/number from blacklist database. LookupBlacklist()

Looks up the Caller*ID number on the active channel in the Asterisk database (family 'blacklist'). If the number is found, and if there exists a priority n + 101, where 'n' is the priority of the current instance, then the channel will be setup to continue at that priority level. Otherwise, it returns 0. Does nothing if no Caller*ID was received on the channel.

LookupCIDName: Look up Caller*ID Name from local database. LookupCIDName()

Looks up the Caller*ID number on the active channel in the Asterisk database (family 'cidname') and sets the Caller*ID name. Does nothing if no Caller*ID was received on the channel. This is useful if you do not subscribe to Caller*ID name delivery, or if you want to change the names on some incoming calls.

Always returns 0.

Macro: Macro Implementation. Macro(macroname[[|arg1]|arg2...])

Executes a macro using the context 'macro-macroname', jumping to the 's' extension of that context and executing each step, then returning when the steps end. The calling extension, context, and priority are stored in ${MACRO_EXTEN}, ${MACRO_CONTEXT} and ${MACRO_PRIORITY} respectively. Arguments become ${ARG1}, ${ARG2}, etc. in the macro context.

Macro returns -1 if any step in the macro returns -1, and 0 otherwise. If you Goto out of the Macro context, the Macro will terminate and control will be return at the location of the Goto. Otherwise if ${MACRO_OFFSET} is set at termination, Macro will attempt to continue at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise.

MeetMe: Simple MeetMe conference bridge. MeetMe(confno[|options])

Enters the user into a specified MeetMe conference. If the conference number is omitted, the user will be prompted to enter one. This application always returns -1.

Warning

A ZAPTEL INTERFACE MUST BE INSTALLED FOR CONFERENCING FUNCTIONALITY! See the chapter on timing interfaces for more information.

The option string may contain zero or more of the following characters:

'a'

set admin mode

'm'

set monitor only mode

'p'

allow user to exit the conference by pressing '#'

's'

send user to admin/user menu if '*' is received

't'

set talk only mode

'd'

dynamically add conference

'v'

video mode

'q'

quiet mode (don't play enter/leave sounds)

'M'

enable music on hold when the conference has a single caller

'b'

run AGI script specified in ${MEETME_AGI_BACKGROUND} (Zap channels only) (does not work with non-Zap channels in the same conference)

MeetMeCount: MeetMe participant count. MeetMeCount(confno[|var])

Plays back the number of users in the specified MeetMe conference. If var is specified, playback will be skipped and the value will be returned in the variable.

Warning

A ZAPTEL INTERFACE MUST BE INSTALLED FOR CONFERENCING FUNCTIONALITY! See the chapter on timing interfaces for more information.

Returns 0 on success or -1 on a hangup.

Milliwatt: Generate a Constant 1000Hz tone. Milliwatt()

Generate a Constant 1000Hz tone at 0dBm (mu-law)

Monitor: Monitor a channel. Monitor([file_format|[filename_base]])

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.

Monitor takes the following arguments:

file_format

optional, if not set, defaults to "wav"

filename_base

if set, changes the filename used to the one specified

MP3Player: Play an MP3 file or stream. MP3Player(location)

Executes mpg123 to play the given location which typically would be a filename or a URL. User can exit by pressing any key.

Returns -1 on hangup or 0 otherwise.

MusicOnHold: Play Music On Hold indefinitely. MusicOnHold(class)

Plays hold music specified by class. If omitted, the default music source for the channel will be used.

Returns -1 on hangup. Never returns otherwise.

NoCDR: Make sure Asterisk doesn't save CDR for a certain call. NoCDR()

Calling this application makes sure there won't be any CDR written for the current call.

NoOp: No operation. NoOp()

No-operation; Does nothing.

Note

Actually, NoOp() has one very useful side-effect. It prints the argument to the Asterisk console. This can be very helpful when debugging.

ParkAndAnnounce: Park and Announce. ParkAndAnnounce(announce_template|timeout|dial|[return_context])

Park a call into the parking lot and announce the call over the console.

announce_template

colon separated list of files to announce, the word PARKED will be replaced by a say_digits of the ext the call is parked in

timeout

time in seconds before the call returns into the return context.

dial

the app_dial style resource to call to make the announcement. Console/dsp calls the console.

return_context

the goto style label to jump the call back into after timeout. Defaults to current priority + 1

ParkedCall: Answer a parked call. ParkedCall(exten)

Used to connect to a parked call. This Application is always registered internally and does not need to be explicitly added into the dialplan, although you should include the 'parkedcalls' context.

Playback: Play a file. Playback(filename[|option])

Plays back a given filename (do not include the file extension). Options may also be included following a pipe symbol. The only defined option at this time is 'skip', which 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 channel will be answered before the sound is played. Not all channels support playing messages while on hook.

Returns -1 if the channel was hung up, or if the file does not exist. Returns 0 otherwise.

Playtones: Play a tone list. Playtones()

Play a tone list, either registered (through indications.conf) or a direct list of tones and durations.

Prefix: Prepend leading digits. Prefix(digits)

Prepends the digit string specified by digits to the channel's associated extension. For example, the number 1212 when prefixed with '555' will become 5551212.

This app always returns 0, and the PBX will continue processing at the next priority for the new extension.

For example, if priority 3 of extension 1212 is Prefix 555, the next step executed will be priority 4 of 5551212. If you switch into an extension which has no first step, the PBX will treat it as though the user dialed an invalid extension.

PrivacyManager: Require phone number to be entered, if no CallerID sent. PrivacyManager()

If no Caller*ID is sent, PrivacyManager answers the channel and asks the caller to enter their 10 digit phone number. The caller is given 3 attempts. If after 3 attempts, they do not enter their 10 digit phone number, and if there exists a priority n + 101, where 'n' is the priority of the current instance, then the channel will be setup to continue at that priority level. Otherwise, it returns 0. Does nothing if Caller*ID was received on the channel.

Queue: Queue a call for a call queue. Queue(queuename[|options[|URL][|announceoverride]])

Queues an incoming call in a particular call queue as defined in queues.conf. The option string may contain zero or more of the following characters:

t

allow the called user transfer the calling user

T

to allow the calling user to transfer the call.

d

data-quality (modem) call (minimum delay).

H

allow caller to hang up by hitting *.

n

no retries on the timeout; will exit this application and go to the next step.

In addition to transferring the call, a call may be parked and then picked up by another user. The optional URL will be sent to the called party if the channel supports it.

This application returns -1 if the originating channel hangs up, or if the call is bridged and either of the parties in the bridge terminate the call. Returns 0 if the queue is full, nonexistent, or has no members.

Read: Read a variable. Read(variable[|filename])

Reads a # terminated string of digits from the user, optionally playing a given filename first.

Returns -1 on hangup or error and 0 otherwise.

Record: Record to a file. Record(filename:extension|silence)

Records from the current channel into the given filename. If the file exists it will be overwritten. The extension is the extension of the file type to be recorded (wav, GSM, etc). The silence argument is the number of seconds of silence to allow before returning.

Returns -1 when the user hangs up.

RemoveQueueMember: Dynamically removes queue members. RemoveQueueMember(queuename[|interface])

Dynamically removes interface to an existing queue

Returns -1 if there is an error.


	RemoveQueueMember(techsupport|SIP/3000)
	;remove SIP/3000 from techsupport queue
	

ResetCDR: Resets the Call Data Record. ResetCDR([options])

Causes the Call Data Record to be reset, optionally storing the current CDR before zeroing it out (if 'w' option is specified the record WILL be stored.

Always returns 0.

ResponseTimeout: Set maximum timeout awaiting response. ResponseTimeout(seconds)

Set the maximum amount of time permitted after falling through a series of priorities for a channel in which the user may begin typing an extension. If the user does not type an extension in this amount of time, control will pass to the 't' extension if it exists, and if not the call will be terminated.

Always returns 0.

Ringing: Indicate ringing tone. Ringing()

Request that the channel indicate ringing tone to the user.

Always returns 0.

SayDigits: Say Digits. SayDigits(digits)

Says the passed digits. With this, if you insert a string of digits, Asterisk will say the individual numbers.

Example: SayDigits(12345) will be said as "One Two Three Four Five".

SayNumber: Say Number. SayNumber(number)

Says the passed number. With this, if you insert a string of digits, Asterisk will say the number, and not the individual digits.

Example:

SayNumber(12345)
will be said as "Twelve-Thousand Three-Hundred Forty-Five".

SayUnixTime: Says a specified time in a custom format. SayUnixTime([unixtime][|[timezone][|format]])

unixtime

time, in seconds since Jan 1, 1970. May be negative. Defaults to now.

timezone

timezone, see /usr/share/zoneinfo for a list. Defaults to machine default.

format

a format the time is to be said in. See voicemail.conf. Defaults to "ABdY 'digits/at' IMp"

Returns 0 or -1 on hangup.

SendDTMF: Sends arbitrary DTMF digits. SendDTMF(digits)

Sends DTMF digits on a channel.

Returns 0 on success or -1 on a hangup.

SendImage: Send an image file. SendImage(filename)

Sends an image on a channel. If the channel does not support image transport, and there exists a step with priority n + 101, then execution will continue at that step. Otherwise, execution will continue at the next priority level.

SendImage() only returns 0 if the image was sent correctly or if the channel does not support image transport, and -1 otherwise.

SendURL: Send a URL. SendURL(URL[|option])

Requests client go to URL. If the client does not support HTML transport, and there exists a step with priority n + 101, then execution will continue at that step. Otherwise, execution will continue at the next priority level.

SendURL() only returns 0 if the URL was sent correctly or if the channel does not support HTML transport, and -1 otherwise. If the option 'wait' is specified, execution will wait for an acknowledgment that the URL has been loaded before continuing and will return -1 if the peer is unable to load the URL.

SetAccount: Sets account code. SetAccount([account])

Set the channel account code for billing purposes.

Always returns 0.

SetCallerID: Set Caller*ID. SetCallerID(callerid[|a])

Set Caller*ID on a call to a new value. Sets ANI as well if the a flag is used.

Always returns 0

SetCIDName: Set Caller*ID Name. SetCIDName(cname[|a])

Set Caller*ID Name on a call to a new value, while preserving the original Caller*ID number. This is useful for providing additional information to the called party. Sets ANI as well if a flag is used.

Always returns 0

SetCIDNum: Set Caller*ID Number. SetCIDNum(cnum[|a])

Set Caller*ID Number on a call to a new value, while preserving the original Caller*ID name. This is useful for providing additional information to the called party. Sets ANI as well if a flag is used.

Always returns 0

SetGlobalVar: Set variable to value. SetGlobalVar(#n=value)

Sets global variable n to value

SetLanguage: Sets user language. SetLanguage(language)

Set the channel language to language. This information is used for the generation of numbers, and to select a natural language file when available. For example, if language is set to 'fr' and the file demo-congrats is requested to be played, if the file fr/demo-congrats exists, then it will play that file, and if not will play the normal demo-congrats.

Always returns 0.

SetMusicOnHold: Set default Music On Hold class. SetMusicOnHold(class)

Sets the default class for music on hold for a given channel. When music on hold is activated, this class will be used to select which music is played.

SetVar: Set variable to value. SetVar(#n=value)

Sets variable n to value

SIPDtmfMode: Change the DTMF mode for a SIP call. SIPDtmfMode(option)

Changes the DTMF mode for a SIP call

The option argument can be one of 'inband', 'info', or 'rfc2883'.

SoftHangup: Soft Hangup Application. SoftHangup(Technology/resource)

Hangs up the requested channel. Always returns 0

StopMonitor: Stop monitoring a channel. StopMonitor()

Stops monitoring the current channel. Has no effect if the channel is not monitored

StopPlaytones: Stop playing a tone list. StopPlaytones()

Stop playing a tone list

StripLSD: Strip Least Significant Digits. StripLSD(count)

Strips the trailing count digits from the channel's associated extension. For example, the number 5551212 when stripped with a count of 4 would be changed to 555. This app always returns 0, and the PBX will continue processing at the next priority for the new extension.

So, for example, if priority 3 of 5551212 is StripLSD 4, the next step executed will be priority 4 of 555. If you switch into an extension which has no first step, the PBX will treat it as though the user dialed an invalid extension.

StripMSD: Strip leading digits. StripMSD(count)

Strips the leading count digits from the channel's associated extension. For example, the number 5551212 when stripped with a count of 3 would be changed to 1212. This app always returns 0, and the PBX will continue processing at the next priority for the new extension.

So, for example, if priority 3 of 5551212 is StripMSD 3, the next step executed will be priority 4 of 1212. If you switch into an extension which has no first step, the PBX will treat it as though the user dialed an invalid extension.

SubString: Save substring digits in a given variable. SubString(variable=string_of_digits|count1|count2)

Assigns the substring of string_of_digits to a given variable. Parameter count1 may be positive or negative. If it's positive then we skip the first count1 digits from the left. If it's negative, we move count1 digits counting from the end of the string to the left. Parameter count2 implies how many digits we are taking from the point that count1 placed us. If count2 is negative, then that many digits are omitted from the end.

For example:


	exten => _NXXXXXX,1,SubString,test=2564286161|0|3
	assigns the area code (3 first digits) to variable test.
	exten => _NXXXXXX,1,SubString,test=2564286161|-7|7
	assigns the last 7 digits to variable test.
	exten => _NXXXXXX,1,SubString,test=2564286161|0|-4
	assigns all but the last 4 digits to variable test.
	

If there are no parameters it'll return with -1. If there wrong parameters it go on and return with 0

Suffix: Append trailing digits. Suffix(digits)

Appends the digit string specified by digits to the channel's associated extension. For example, the number 555 when suffixed with '1212' will become 5551212. This app always returns 0, and the PBX will continue processing at the next priority for the new extension.

So, for example, if priority 3 of 555 is Suffix 1212, the next step executed will be priority 4 of 5551212. If you switch into an extension which has no first step, the PBX will treat it as though the user dialed an invalid extension.

System: Execute a system command. System(command)

Executes a command by using system().

Returns -1 on failure to execute the specified command. If the command itself executes but is in error, and if there exists a priority n + 101, where 'n' is the priority of the current instance, then the channel will be setup to continue at that priority level. Otherwise, System returns 0.

Transfer: Transfer caller to remote extension. Transfer(exten)

Requests the remote caller be transferred to the given exten.

Returns -1 on hangup, or 0 on completion regardless of whether the transfer was successful. If the transfer was not supported or successful and there exists a priority n + 101, then that priority will be taken next.

VoiceMail: Leave a voicemail message. Deprecated: See Voicemail2

VoiceMail2: Leave a voicemail message. VoiceMail2([s|u|b]extension[@context])

Leaves voicemail for a given extension (must be configured in voicemail.conf). If the extension is preceded by an s then instructions for leaving the message will be skipped. If the extension is preceded by u then the "unavailable" message will be played (/var/lib/asterisk/sounds/vm/context/exten/unavail) if it exists. If the extension is preceded by a b then the the busy message will be played (that is, busy instead of unavailable). If the requested mailbox does not exist, and there exists a priority n + 101, then that priority will be taken next.

Returns -1 on error or mailbox not found, or if the user hangs up. Otherwise, it returns 0.

VoiceMailMain: Enter voicemail system. Deprecated: See VoiceMailMain2

VoiceMailMain2: Enter voicemail system. VoiceMailMain2([[s]mailbox][@context])

Enters the main voicemail system for the checking of voicemail. The mailbox can be passed as the option, which will stop the voicemail system from prompting the user for the mailbox. If the mailbox is preceded by s then the password check will be skipped. If a context is specified, logins are considered in that context only.

Returns -1 if the user hangs up or 0 otherwise.

Wait: Waits for some time. Wait(seconds)

Waits for a specified number of seconds, then returns 0.

WaitForRing: Wait for Ring Application. WaitForRing(timeout)

Returns 0 after waiting at least timeout seconds, and only after the next ring has completed. Returns 0 on success or -1 on hangup

WaitMusicOnHold: Wait, playing Music On Hold. WaitMusicOnHold(delay)

Plays hold music a number of seconds specified by delay.

Returns 0 when done, or -1 on hangup. If no hold music is available, the delay will still occur with no sound.

Zapateller: Block telemarketers with SIT. Zapateller(options)

Generates special information tone to block telemarketers from calling you.

The options argument is a pipe-delimited list of options. The following options are available:

answer

causes the line to be answered before playing the tone

nocallerid

causes Zapateller to only play the tone if there is no CallerID information available.

Returns 0 normally or -1 on hangup.

ZapBarge: Barge in (monitor) Zap channel. ZapBarge([channel])

Barges in on a specified zap channel or prompts if one is not specified.

Returns -1 when caller user hangs up and is independent of the state of the channel being monitored.

ZapRAS: Executes Zaptel ISDN RAS application. ZapRAS(args)

Executes a RAS server using pppd on the given channel. The channel must be a clear channel (i.e. PRI source) and a Zaptel channel to be able to use this function (No modem emulation is included). Your pppd must be patched to be zaptel aware. Arguments should be separated by | characters.

Always returns -1.