login | register
Sat 17 of May, 2008 [13:28 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Juan Ortega, Thu 15 of May, 2008 [10:33 UTC]: Hi everybody, I'm Juan, an ITCom student, and I need to know what basic elements I need to create a VoIP network. Can anybody helpme, please?,Thank you very much
  • gineta, Wed 14 of May, 2008 [03:58 UTC]: any here not fine the configuration of firewall juniper -screem for VOIP asterisk????
  • Anoop Prabhakaran, Tue 13 of May, 2008 [12:16 UTC]: I am developing Asterisk IVR, Whenever i make a internation call to the IVR system, the DTMF is not getting detected properly, this happens only for the first time, second call onwards system works fine. why this is happening
  • joe, Mon 12 of May, 2008 [04:27 UTC]: Is there an opensource browser based softphone, or a system like Busta where everything is not manages through their website?
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
Server Stats
  • Execution time: 0.95s
  • Memory usage: 2.32MB
  • Database queries: 39
  • GZIP: Disabled
  • Server load: 0.68

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.

Functions in the below list are marked in blue if they are only available in version 1.6 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
  • DEVICE_STATE(): New in 1.6 allows retrieving any device state in the dialplan, as well as creating custom device states that are controllable from the dialplan
  • 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
  • DIALPLAN_EXISTS: New in 1.6 Check for the existence of a dialplan target
  • 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
  • EXTENSION_STATE: New in 1.6 Allows retrieving the state of any extension
  • 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
  • HINT: New in 1.6 Allows retrieving hint information
  • 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.
  • SYSINFO: New in 1.6 Allows retrieval of system information
  • TIMEOUT: Gets or sets timeouts on the channel.
  • TOUPPER: New in 1.6 Converts a string to uppercase
  • TOLOWER: New in 1.6 Converts a string to lowercase
  • 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 | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by Tilghman Lesher, Last modification by Chris Hall on Fri 11 of Apr, 2008 [06:29 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-2008 VOIP-Info.org LLC

Powered by bitweaver