login | register
Wed 01 of Aug, 2007 [09:22 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.

Web www.voip-info.org
Shoutbox
  • Aykut, Wed 01 of Aug, 2007 [07:53 UTC]: Hi all, does anybody know about Thomson ST2030 SIP phone. I have upgraded it to latest version (1.56) but "Hold" and "Conf" features are not working after the upgrade ?? Do you know any solution or do you have Ver. 1.52 ?? Where can I find it?
  • Edward J Brown, Tue 31 of Jul, 2007 [23:33 UTC]: Has anybody experienced Choppy voice quality when using a Linksys SPA942 in an Asterisk Conference bridge? It works fine with my polycom and Cisco, but sucks with my Linksys.
  • www.astawerks.com, Fri 27 of Jul, 2007 [18:00 UTC]: does anyone use asterisk on top of clark connect? does it work good?
  • simon, Fri 27 of Jul, 2007 [14:16 UTC]: Hi All, Has anyone here managed to get the Cisco79x1 to successfully fail over to the backup proxy. I have 2 asterisk servers , handsets all register and function, except that backup proxy function doesn't work. Any working example would be very apprecia
  • Matthew Richmond, Thu 26 of Jul, 2007 [03:40 UTC]: using the page() application to page across our building...often the meetme conferences don't disconnect after the caller hangs up. Anyone else having this problem. (using Polycom phones)
  • Matthew Richmond, Wed 25 of Jul, 2007 [02:58 UTC]: thanks Nicholas Blasgen! I haven't worked with AGI before, but there's always a first! Thanks again!
  • Nicholas Blasgen, Tue 24 of Jul, 2007 [19:18 UTC]: Matthew Richmond, AGI will handle all that for you.
  • sam, Mon 23 of Jul, 2007 [16:39 UTC]: need help - certain voicemail extension will stop working and recording voicemail on asterisk - anyone know why and how to fix it? Thanks
  • john haji, Mon 23 of Jul, 2007 [14:55 UTC]: free calls to pakistan
  • bong, Sat 21 of Jul, 2007 [19:09 UTC]: hi good day to all can anyone help me how to configured the nortel sip to the signaling server and how to activate in mobile w/ sip compatible without mcs
Server Stats
  • Execution time: 0.28s
  • Memory usage: 2.29MB
  • Database queries: 35
  • GZIP: Disabled
  • Server load: 2.47

Asterisk functions

Asterisk functions are used in Asterisk's dialplan. Unlike dialplan applications, they cannot be used directly. Instead they return a value that could be used by the dialplan logic.

Functions are new in 1.2. Some functions may be read from, others may be written to. Please note that several of the builtin variables (including ENV and LEN) have been converted to functions for 1.2. Functions in the below list are marked in red if they are only available in version 1.4 and higher.

Function names by practice are all capitalzed letters. The names ARE CASE SENSITIVE!

Function List

  • AGENT: Gets information about an Agent
  • ARRAY: Allows setting multiple variables at once
  • BASE64_DECODE: Decode a base64 string
  • BASE64_ENCODE: Encode a string into base64
  • CALLERID: Get or set Caller*ID
  • CDR: Get or set a CDR variable
  • CHANNEL: Gets/sets various pieces of information about the channel.
  • CHECKSIPDOMAIN: Checks if domain is a local domain
  • CHECK_MD5: Checks an MD5 digest. Deprecated in 1.4, since it can be done with an expression in combination with MD5.
  • CURL: Retrieves a URL
  • CUT: String parsing, based upon a delimiter
  • DB: Get or set a value in the AstDB
  • DB_DELETE: Delete a value from the AstDB; replaces the DBDel application
  • DB_EXISTS: Check to see if a key exists in the Asterisk database
  • DUNDILOOKUP: Do a DUNDi lookup of a phone number.
  • ENUMLOOKUP: General or specific querying of NAPTR records or counts of NAPTR types for ENUM or ENUM-like DNS pointers
  • ENV: Get or set an environmental variable
  • EVAL: Evaluate stored variables.
  • EXISTS: Existence Test: Returns 1 if exists, 0 otherwise
  • FIELDQTY: Get the number of fields, based upon a delimiter
  • FILTER: Filter the string to include only the allowed characters
  • FUNC_ODBC: work with ODBC databases directly from the dialplan
  • GROUP: Can also return the name of the group set on a channel when used in a read environment
  • GROUP_COUNT: Counts the number of channels in the specified group
  • GROUP_LIST: Returns a space separated list of all of the groups set on a channel
  • GROUP_MATCH_COUNT: Counts the number of channels in the groups matching the specified pattern
  • IAXPEER: Gets IAX peer information
  • IF: Conditional: Returns the data following '?' if true else the data following ':'
  • IFTIME: Temporal Conditional: Returns the data following '?' if true else the data following ':'
  • ISNULL: NULL Test: Returns 1 if NULL or 0 otherwise
  • KEYPADHASH: Hash the letters in the string into the equivalent keypad numbers.
  • LANGUAGE: Get or set the channel's language
  • LEN: Get the length of an arbitrary string
  • MATH: Performs Mathematical Functions
  • MD5: Computes an MD5 digest
  • MUSICCLASS: Get or set the MusicOnHold class
  • QUEUEAGENTCOUNT: Gets the number of members currently listening on a queue. Deprecated in favor of QUEUE_MEMBER_COUNT.
  • QUEUE_MEMBER_COUNT: Count number of members answering a queue
  • QUEUE_MEMBER_LIST: Returns a list of interfaces on a queue
  • QUOTE: Quotes a given string, escaping embedded quotes as necessary
  • RAND: Choose a random number in a range
  • REALTIME: This function will read or write values from/to a RealTime repository.
  • REGEX: Regular Expression: Returns 1 if data matches regular expression.
  • SET: SET assigns a value to a channel variable
  • SHA1: Computes a SHA1 digest
  • SIPCHANINFO: Gets the specified SIP parameter from the current channel
  • SIPPEER: Gets SIP peer information
  • SIPADDHEADER: Typically used to set Alert-Info information, e.g. ring tone .wav files
  • SIP_HEADER: Gets or sets the specified SIP header
  • SORT: Sorts a list of keys and values into a list of keys
  • SQL_ESC: Escapes a value for inclusion in an SQL call (prevent injection attacks).
  • STAT: Does a check on the specified file
  • STRFTIME: Formats an epoch into an arbitrary datetime string
  • STRPTIME: Returns the epoch of the arbitrary date/time string structured as described in the format.
  • TIMEOUT: Gets or sets timeouts on the channel.
  • TXTCIDNAME: TXTCIDNAME looks up a caller name via DNS
  • URIDECODE: Decodes an URI-encoded string.
  • URIENCODE: Encodes a string to URI-safe encoding.
  • VMCOUNT: Counts the voicemail in a specified mailbox



Using functions in Asterisk dialplans

Example usage of the function CUT:

 exten => s,1,Set(foo=${CUT(bar,,2)})

The above example sets the variable foo to the function CUT whose first parameter is 'bar', second parameter is empty and third parameter is '2'.

A function is often used to determain which "part of a variable" to set. For instance, the use of the function CALLERID:

 exten => s,n,Set(CALLERID(name)=Foo Fighters) 
 exten => s,n,Set(CALLERID(number)=700) 

Functions Reference Through the CLI

The list of availble functions depends on the modules installed and loaded on the current system. To get the list of functions from the Asterisk CLI use the command show functions . This gives a list of all functions.

To get the syntax of a specific function, use the command show function FUNCNAME. This gives a longer description of the function. It is often handy to use tab completion that way to identify a function name.

Links:

Asterisk 1v2 Dial plan Functions. REMOVE, right?
Asterisk cmd Backticks
Asterisk - documentation of application commands

Created by Tilghman Lesher, Last modification by JustRumours on Mon 30 of Jul, 2007 [00:14 UTC]

Comments Filter

by Steve Murphy on Friday 13 of January, 2006 [16:47:51 UTC]

by Steve Murphy on Friday 13 of January, 2006 [16:47:17 UTC]

by Steve Murphy on Friday 13 of January, 2006 [16:46:39 UTC]



Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2007 Arte Marketing, Inc.

Powered by bitweaver