CHANNEL()

Since 1.2.0 Functions Found this useful? Upvote it. ×

Gets/sets various pieces of information about the channel.

Last reviewed 2026-04-14

CHANNEL(item)
Dialplan Builder -- build your CHANNEL() command
Standard items (provided by all channel technologies) are:
Full arguments reference
  • item required - Standard items (provided by all channel technologies) are:
    • amaflags - R/W the Automatic Message Accounting (AMA) flags on the channel. When read from a channel, the integer value will always be returned. When written to a channel, both the string format or integer value is accepted.
      • 1 - OMIT
      • 2 - BILLING
      • 3 - DOCUMENTATION
    • accountcode - R/W the channel's account code.
    • adsicpe - R/W The channel's support for ADSI (Analog Display Services Interface) CPE.
      • available
      • offhookonly
      • unavailable
      • unknown
    • audioreadformat - R/O format currently being read.
    • audionativeformat - R/O format used natively for audio.
    • audiowriteformat - R/O format currently being written.
    • dtmf_features - R/W The channel's DTMF bridge features. May include one or more of 'T' 'K' 'H' 'W' and 'X' in a similar manner to options in the Dial application. When setting it, the features string must be all upper case.
    • callgroup - R/W numeric call pickup groups that this channel is a member.
    • pickupgroup - R/W numeric call pickup groups this channel can pickup.
    • namedcallgroup - R/W named call pickup groups that this channel is a member.
    • namedpickupgroup - R/W named call pickup groups this channel can pickup.
    • channeltype - R/O technology used for channel.
    • checkhangup - R/O Whether the channel is hanging up (1/0)
    • digitdetect - R/W Enable or disable DTMF detection on channel drivers that support it.
    • faxdetect - R/W Enable or disable fax detection on channel drivers that support it.
    • after_bridge_goto - R/W the parseable goto string indicating where the channel is expected to return to in the PBX after exiting the next bridge it joins on the condition that it doesn't hang up. The parseable goto string uses the same syntax as the Goto application.
    • hangup_handler_pop - W/O Replace the most recently added hangup handler with a new hangup handler on the channel if supplied. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • hangup_handler_push - W/O Push a hangup handler onto the channel hangup handler stack. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • hangup_handler_wipe - W/O Wipe the entire hangup handler stack and replace with a new hangup handler on the channel if supplied. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • onhold - R/O Whether or not the channel is onhold. (1/0)
    • language - R/W language for sounds played.
    • musicclass - R/W class (from musiconhold.conf) for hold music.
    • name - The name of the channel
    • parkinglot - R/W parkinglot for parking.
    • relaxdtmf - W/O Enable or disable relaxed DTMF detection for channel drivers that support it, overriding any setting previously defaulted by the channel driver.
    • rxgain - R/W set rxgain level on channel drivers that support it.
    • secure_bridge_signaling - Whether or not channels bridged to this channel require secure signaling (1/0)
    • secure_bridge_media - Whether or not channels bridged to this channel require secure media (1/0)
    • state - R/O state of the channel
    • tdd - R/W Enable or disable TDD mode on channel drivers that support it.
    • tonezone - R/W zone for indications played
    • transfercapability - R/W ISDN Transfer Capability, one of:
      • SPEECH
      • DIGITAL
      • RESTRICTED_DIGITAL
      • 3K1AUDIO
      • DIGITAL_W_TONES
      • VIDEO
    • txgain - R/W set txgain level on channel drivers that support it.
    • videonativeformat - R/O format used natively for video
    • hangupsource - R/W returns the channel responsible for hangup.
    • appname - R/O returns the internal application name.
    • appdata - R/O returns the application data if available.
    • exten - R/O returns the extension for an outbound channel.
    • context - R/O returns the context for an outbound channel.
    • lastexten - R/O returns the last unique extension for an outbound channel.
    • lastcontext - R/O returns the last unique context for an outbound channel.
    • channame - R/O returns the channel name for an outbound channel.
    • uniqueid - R/O returns the channel uniqueid.
    • linkedid - R/O returns the linkedid if available, otherwise returns the uniqueid.
    • tenantid - R/W The channel tenantid.
    • max_forwards - R/W The maximum number of forwards allowed.
    • callid - R/O Call identifier log tag associated with the channel e.g., [C-00000000].
Description

Gets/sets various pieces of information about the channel, additional item may be available from the channel driver; see its documentation for details. Any item requested that is not available on the current channel will return an empty string.

``` title="Standard CHANNEL item examples" ; Push a hangup handler subroutine existing at dialplan ; location default,s,1 onto the current channel same => n,Set(CHANNEL(hangup_handler_push)=default,s,1)

; Set the current tonezone to Germany (de) same => n,Set(CHANNEL(tonezone)=de)

; Set the allowed maximum number of forwarding attempts same => n,Set(CHANNEL(max_forwards)=10)

; If this channel is ejected from its next bridge, and if ; the channel is not hung up, begin executing dialplan at ; location default,after-bridge,1 same => n,Set(CHANNEL(after_bridge_goto)=default,after-bridge,1)

; Log the current state of the channel same => n,Log(NOTICE, This channel is: ${CHANNEL(state)}) ```

The following channel variables are available as special built-in dialplan channel variables. These variables cannot be set or modified and are read-only.

  • CALLINGPRES - Caller ID presentation for incoming calls (PRI channels)
  • CALLINGANI2 - Caller ANI2 (PRI channels)
  • CALLINGTON - Caller Type of Number (PRI channels)
  • CALLINGTNS - Transit Network Selector (PRI channels)
  • EXTEN - Current extension
  • CONTEXT - Current context
  • PRIORITY - Current priority
  • CHANNEL - Current channel name
  • UNIQUEID - Current call unique identifier
  • HANGUPCAUSE - Asterisk cause of hangup (inbound/outbound)
Arguments
  • item required - Standard items (provided by all channel technologies) are:
    • amaflags - R/W the Automatic Message Accounting (AMA) flags on the channel. When read from a channel, the integer value will always be returned. When written to a channel, both the string format or integer value is accepted.
      • 1 - OMIT
      • 2 - BILLING
      • 3 - DOCUMENTATION
    • accountcode - R/W the channel's account code.
    • adsicpe - R/W The channel's support for ADSI (Analog Display Services Interface) CPE.
      • available
      • offhookonly
      • unavailable
      • unknown
    • audioreadformat - R/O format currently being read.
    • audionativeformat - R/O format used natively for audio.
    • audiowriteformat - R/O format currently being written.
    • dtmf_features - R/W The channel's DTMF bridge features. May include one or more of 'T' 'K' 'H' 'W' and 'X' in a similar manner to options in the Dial application. When setting it, the features string must be all upper case.
    • callgroup - R/W numeric call pickup groups that this channel is a member.
    • pickupgroup - R/W numeric call pickup groups this channel can pickup.
    • namedcallgroup - R/W named call pickup groups that this channel is a member.
    • namedpickupgroup - R/W named call pickup groups this channel can pickup.
    • channeltype - R/O technology used for channel.
    • checkhangup - R/O Whether the channel is hanging up (1/0)
    • digitdetect - R/W Enable or disable DTMF detection on channel drivers that support it.
    • faxdetect - R/W Enable or disable fax detection on channel drivers that support it.
    • after_bridge_goto - R/W the parseable goto string indicating where the channel is expected to return to in the PBX after exiting the next bridge it joins on the condition that it doesn't hang up. The parseable goto string uses the same syntax as the Goto application.
    • hangup_handler_pop - W/O Replace the most recently added hangup handler with a new hangup handler on the channel if supplied. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • hangup_handler_push - W/O Push a hangup handler onto the channel hangup handler stack. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • hangup_handler_wipe - W/O Wipe the entire hangup handler stack and replace with a new hangup handler on the channel if supplied. The assigned string is passed to the Gosub application when the channel is hung up. Any optionally omitted context and exten are supplied by the channel pushing the handler before it is pushed.
    • onhold - R/O Whether or not the channel is onhold. (1/0)
    • language - R/W language for sounds played.
    • musicclass - R/W class (from musiconhold.conf) for hold music.
    • name - The name of the channel
    • parkinglot - R/W parkinglot for parking.
    • relaxdtmf - W/O Enable or disable relaxed DTMF detection for channel drivers that support it, overriding any setting previously defaulted by the channel driver.
    • rxgain - R/W set rxgain level on channel drivers that support it.
    • secure_bridge_signaling - Whether or not channels bridged to this channel require secure signaling (1/0)
    • secure_bridge_media - Whether or not channels bridged to this channel require secure media (1/0)
    • state - R/O state of the channel
    • tdd - R/W Enable or disable TDD mode on channel drivers that support it.
    • tonezone - R/W zone for indications played
    • transfercapability - R/W ISDN Transfer Capability, one of:
      • SPEECH
      • DIGITAL
      • RESTRICTED_DIGITAL
      • 3K1AUDIO
      • DIGITAL_W_TONES
      • VIDEO
    • txgain - R/W set txgain level on channel drivers that support it.
    • videonativeformat - R/O format used natively for video
    • hangupsource - R/W returns the channel responsible for hangup.
    • appname - R/O returns the internal application name.
    • appdata - R/O returns the application data if available.
    • exten - R/O returns the extension for an outbound channel.
    • context - R/O returns the context for an outbound channel.
    • lastexten - R/O returns the last unique extension for an outbound channel.
    • lastcontext - R/O returns the last unique context for an outbound channel.
    • channame - R/O returns the channel name for an outbound channel.
    • uniqueid - R/O returns the channel uniqueid.
    • linkedid - R/O returns the linkedid if available, otherwise returns the uniqueid.
    • tenantid - R/W The channel tenantid.
    • max_forwards - R/W The maximum number of forwards allowed.
    • callid - R/O Call identifier log tag associated with the channel e.g., [C-00000000].

User Notes

No notes yet. Be the first to contribute a tip or example.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.
Functions
CDR() ABS() AES_DECRYPT() AES_ENCRYPT() AGC() AGENT() AMI_CLIENT() ARRAY() AST_CONFIG() AST_SORCERY() BASE64_DECODE() BASE64_ENCODE() BASENAME() BLACKLIST() CALENDAR_BUSY() CALENDAR_EVENT() CALENDAR_QUERY() CALENDAR_QUERY_RESULT() CALENDAR_WRITE() CALLCOMPLETION() CALLERID() CALLERPRES() CDR_PROP() CHANNEL() CHANNELS() CHANNEL_EXISTS() CHECKSIPDOMAIN() CONFBRIDGE() CONFBRIDGE_CHANNELS() CONFBRIDGE_INFO() CONNECTEDLINE() CSV_QUOTE() CURL() CURLOPT() CUT() DAHDI_CHANNEL() DB() DB_DELETE() DB_EXISTS() DB_KEYCOUNT() DB_KEYS() DEC() DELETE() DENOISE() DEVICE_STATE() DIALGROUP() DIALPLAN_EXISTS() DIGIT_SUM() DIRNAME() DUNDILOOKUP() DUNDIQUERY() DUNDIRESULT() ENUMLOOKUP() ENUMQUERY() ENUMRESULT() ENV() EVAL() EVAL_EXTEN() EVAL_SUB() EXCEPTION() EXISTS() EXPORT() EXTENSION_STATE() FAXOPT() FEATURE() FEATUREMAP() FIELDNUM() FIELDQTY() FILE() FILE_COUNT_LINE() FILE_FORMAT() FILTER() FRAME_DROP() FRAME_TRACE() GEOLOC_PROFILE() GLOBAL() GLOBAL_DELETE() GLOBAL_EXISTS() GROUP() GROUP_COUNT() GROUP_LIST() GROUP_MATCH_COUNT() HANGUPCAUSE() HANGUPCAUSE_KEYS() HASH() HASHKEYS() HINT() HOLD_INTERCEPT() IAXPEER() IAXVAR() ICONV() IF() IFMODULE() IFTIME() IMPORT() INC() ISNULL() JABBER_RECEIVE() JABBER_STATUS() JITTERBUFFER() JSON_DECODE() KEYPADHASH() LEN() LISTFILTER() LOCAL() LOCAL_PEEK() LOCK() LOG_GROUP() LTRIM() MAILBOX_EXISTS() MASTER_CHANNEL() MATH() MAX() MD5() MEETME_INFO() MESSAGE() MESSAGE_DATA() MIN() MINIVMACCOUNT() MINIVMCOUNTER() MIXMONITOR() MUTEAUDIO() ODBC() ODBC_FETCH() PARK_GET_CHANNEL() PASSTHRU() PERIODIC_HOOK() PITCH_SHIFT() PJSIP_AOR() PJSIP_CONTACT() PJSIP_DIAL_CONTACTS() PJSIP_DTMF_MODE() PJSIP_ENDPOINT() PJSIP_HEADER() PJSIP_HEADERS() PJSIP_HEADER_PARAM() PJSIP_INHERITABLE_HEADER() PJSIP_MEDIA_OFFER() PJSIP_MOH_PASSTHROUGH() PJSIP_PARSE_URI() PJSIP_PARSE_URI_FROM() PJSIP_RESPONSE_HEADER() PJSIP_RESPONSE_HEADERS() PJSIP_SEND_SESSION_REFRESH() PJSIP_TRANSFER_HANDLING() POLARITY() POP() PP_EACH_EXTENSION() PP_EACH_USER() PRESENCE_STATE() PUSH() QUEUE_EXISTS() QUEUE_GET_CHANNEL() QUEUE_MEMBER() QUEUE_MEMBER_COUNT() QUEUE_MEMBER_LIST() QUEUE_MEMBER_PENALTY() QUEUE_VARIABLES() QUEUE_WAITING_COUNT() QUOTE() RAND() REALTIME() REALTIME_DESTROY() REALTIME_FIELD() REALTIME_HASH() REALTIME_STORE() RECORDING_INFO() REDIRECTING() REGEX() REPLACE() RTRIM() SAYFILES() SCRAMBLE() SET() SHA1() SHARED() SHELL() SHIFT() SIPPEER() SIP_HEADER() SIP_HEADERS() SMDI_MSG() SMDI_MSG_RETRIEVE() SORT() SPEECH() SPEECH_ENGINE() SPEECH_GRAMMAR() SPEECH_RESULTS_TYPE() SPEECH_SCORE() SPEECH_TEXT() SPRINTF() SQL_ESC() SQL_ESC_BACKSLASHES() SRVQUERY() SRVRESULT() STACK_PEEK() STAT() STIR_SHAKEN() STIR_SHAKEN_ATTESTATION() STRBETWEEN() STRFTIME() STRPTIME() STRREPLACE() SYSINFO() TALK_DETECT() TESTTIME() TIMEOUT() TOLOWER() TONE_DETECT() TOUPPER() TRIM() TRYLOCK() TXTCIDNAME() UNLOCK() UNSHIFT() URIDECODE() URIENCODE() UUID() VALID_EXTEN() VARIABLE_EXISTS() VERSION() VMCOUNT() VM_INFO() VOLUME()
Functions
CDR() ABS() AES_DECRYPT() AES_ENCRYPT() AGC() AGENT() AMI_CLIENT() ARRAY() AST_CONFIG() AST_SORCERY() BASE64_DECODE() BASE64_ENCODE() BASENAME() BLACKLIST() CALENDAR_BUSY() CALENDAR_EVENT() CALENDAR_QUERY() CALENDAR_QUERY_RESULT() CALENDAR_WRITE() CALLCOMPLETION() CALLERID() CALLERPRES() CDR_PROP() CHANNEL() CHANNELS() CHANNEL_EXISTS() CHECKSIPDOMAIN() CONFBRIDGE() CONFBRIDGE_CHANNELS() CONFBRIDGE_INFO() CONNECTEDLINE() CSV_QUOTE() CURL() CURLOPT() CUT() DAHDI_CHANNEL() DB() DB_DELETE() DB_EXISTS() DB_KEYCOUNT() DB_KEYS() DEC() DELETE() DENOISE() DEVICE_STATE() DIALGROUP() DIALPLAN_EXISTS() DIGIT_SUM() DIRNAME() DUNDILOOKUP() DUNDIQUERY() DUNDIRESULT() ENUMLOOKUP() ENUMQUERY() ENUMRESULT() ENV() EVAL() EVAL_EXTEN() EVAL_SUB() EXCEPTION() EXISTS() EXPORT() EXTENSION_STATE() FAXOPT() FEATURE() FEATUREMAP() FIELDNUM() FIELDQTY() FILE() FILE_COUNT_LINE() FILE_FORMAT() FILTER() FRAME_DROP() FRAME_TRACE() GEOLOC_PROFILE() GLOBAL() GLOBAL_DELETE() GLOBAL_EXISTS() GROUP() GROUP_COUNT() GROUP_LIST() GROUP_MATCH_COUNT() HANGUPCAUSE() HANGUPCAUSE_KEYS() HASH() HASHKEYS() HINT() HOLD_INTERCEPT() IAXPEER() IAXVAR() ICONV() IF() IFMODULE() IFTIME() IMPORT() INC() ISNULL() JABBER_RECEIVE() JABBER_STATUS() JITTERBUFFER() JSON_DECODE() KEYPADHASH() LEN() LISTFILTER() LOCAL() LOCAL_PEEK() LOCK() LOG_GROUP() LTRIM() MAILBOX_EXISTS() MASTER_CHANNEL() MATH() MAX() MD5() MEETME_INFO() MESSAGE() MESSAGE_DATA() MIN() MINIVMACCOUNT() MINIVMCOUNTER() MIXMONITOR() MUTEAUDIO() ODBC() ODBC_FETCH() PARK_GET_CHANNEL() PASSTHRU() PERIODIC_HOOK() PITCH_SHIFT() PJSIP_AOR() PJSIP_CONTACT() PJSIP_DIAL_CONTACTS() PJSIP_DTMF_MODE() PJSIP_ENDPOINT() PJSIP_HEADER() PJSIP_HEADERS() PJSIP_HEADER_PARAM() PJSIP_INHERITABLE_HEADER() PJSIP_MEDIA_OFFER() PJSIP_MOH_PASSTHROUGH() PJSIP_PARSE_URI() PJSIP_PARSE_URI_FROM() PJSIP_RESPONSE_HEADER() PJSIP_RESPONSE_HEADERS() PJSIP_SEND_SESSION_REFRESH() PJSIP_TRANSFER_HANDLING() POLARITY() POP() PP_EACH_EXTENSION() PP_EACH_USER() PRESENCE_STATE() PUSH() QUEUE_EXISTS() QUEUE_GET_CHANNEL() QUEUE_MEMBER() QUEUE_MEMBER_COUNT() QUEUE_MEMBER_LIST() QUEUE_MEMBER_PENALTY() QUEUE_VARIABLES() QUEUE_WAITING_COUNT() QUOTE() RAND() REALTIME() REALTIME_DESTROY() REALTIME_FIELD() REALTIME_HASH() REALTIME_STORE() RECORDING_INFO() REDIRECTING() REGEX() REPLACE() RTRIM() SAYFILES() SCRAMBLE() SET() SHA1() SHARED() SHELL() SHIFT() SIPPEER() SIP_HEADER() SIP_HEADERS() SMDI_MSG() SMDI_MSG_RETRIEVE() SORT() SPEECH() SPEECH_ENGINE() SPEECH_GRAMMAR() SPEECH_RESULTS_TYPE() SPEECH_SCORE() SPEECH_TEXT() SPRINTF() SQL_ESC() SQL_ESC_BACKSLASHES() SRVQUERY() SRVRESULT() STACK_PEEK() STAT() STIR_SHAKEN() STIR_SHAKEN_ATTESTATION() STRBETWEEN() STRFTIME() STRPTIME() STRREPLACE() SYSINFO() TALK_DETECT() TESTTIME() TIMEOUT() TOLOWER() TONE_DETECT() TOUPPER() TRIM() TRYLOCK() TXTCIDNAME() UNLOCK() UNSHIFT() URIDECODE() URIENCODE() UUID() VALID_EXTEN() VARIABLE_EXISTS() VERSION() VMCOUNT() VM_INFO() VOLUME()