3/12/2010

Asterisk Special Variables

Special Variables
Asterisk has some special variables that are automatically defined when a new channel (call) starts up. Later you will see an example of using the ${EXTEN} variable. These definitions come from the README.variables file.

${ACCOUNTCODE} Account code (if specified)
${CALLERID} Caller ID
${CALLERIDNAME} Caller ID Name only
${CALLERIDNUM} Caller ID Number only
${CALLINGPRES} PRI Caller ID presentation for incoming calls
${CHANNEL} Current channel name
${CONTEXT} Current context
${DATETIME} Current date time in the format: YYYY-MM-DD_HH:MM:SS
${DNID} Dialed Number Identifier
${ENUM} Result of application EnumLookup
${EPOCH} Current unix style epoch
${EXTEN} Current extension
${ENV(VAR)} Environmental variable VAR
${HANGUPCAUSE} Asterisk hangup cause
${INVALID_EXTEN} The invalid called extension (used in the "i" extension)
${LANGUAGE} Current language
${LEN(VAR)} String length of VAR (integer)
${MEETMESECS} Number of seconds a user participated in a MeetMe
${PRIORITY} Current priority
${RDNIS} Redirected Dial Number ID Service
${TIMESTAMP} Current date time in the format: YYYYMMDD-HHMMSS
${TXTCIDNAME} Result of application TXTCIDName
${UNIQUEID} Current call unique identifier

${SIPCALLID} SIP Call-ID: header verbatim (for logging or CDR matching)
${SIPDOMAIN} SIP destination domain of an inbound call (if appropriate)
${SIPUSERAGENT} SIP user agent

The dial() application sets the following variables:

${DIALEDPEERNAME} Dialed peer name
${DIALEDPEERNUMBER} Dialed peer number
${DIALEDTIME} Total time for the call in seconds (Network time).
${ANSWEREDTIME} Time from answer to end of call in seconds.
${DIALSTATUS} Status of the call, one of:
CHANUNAVAIL CONGESTION BUSY NOANSWER ANSWER CANCEL