免费咨询:010 86399905

Asterisk教程 daqid

  • Asterisk教程
  • Linux教程

    联系我们 Contact Us

    免费热线: 010 86399905
    北京大旗德讯科技有限公司 客服热线:010 86399905
    销售咨询:18601278976
    客服热线:13020040188
    售前服务QQ:1598520634
    技术服务QQ:250128146
    了解详情,请致电: 客服热线:
    010 86399905
    在线登记相关信息:
    在线提交

    asterisk系统变量使用方式

     http://www.voip-info.org/wiki/view/Asterisk+Detailed+Variable+List
    在编写asterisk拨号规则时,需要使用到各种系统变量和程序变量。这个教程将讲述这些变量的使用方式。
     
    原文见asterisk官方文档。
    Asterisk standard channel variables 

    There are a number of variables that are defined or read 
    by Asterisk. Here is a list of them. More information is 
    available in each application's help text. All these variables 
    are in UPPER CASE only. 

    to diaplay all channel variable use this command 

    DumpChan(<min_verbose_level>

    Variables marked with a * are builtin functions and can't be set, 
    only read in the dialplan. Writes to such variables are silently 
    ignored. 

    ${ACCOUNTCODE} * Account code (if specified) (Deprecated; use ${CDR(accountcode)}) 
    ${BLINDTRANSFER} The name of the channel on the other side of a blind transfer 
    ${BRIDGEPEER} Bridged peer 
    ${CALLERANI} * Caller ANI (PRI channels) (Deprecated; use ${CALLERID(ani)}) 
    ${CALLERID} * Caller ID (Deprecated; use ${CALLERID(all)}) 
    ${CALLERIDNAME} * Caller ID Name only (Deprecated; use ${CALLERID(name)}) 
    ${CALLERIDNUM} * Caller ID Number only (Deprecated; use ${CALLERID(num)}) 
    ${CALLINGANI2} * Caller ANI2 (PRI channels) 
    ${CALLINGPRES} * Caller ID presentation for incoming calls (PRI channels) 
    ${CALLINGTNS} * Transit Network Selector (PRI channels) 
    ${CALLINGTON} * Caller Type of Number (PRI channels) 
    ${CHANNEL} * Current channel name  //主号通道号。
    ${CONTEXT} * Current context 
    ${DATETIME} * Current date time in the format: DDMMYYYY-HH:MM:SS (Deprecated; use ${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}) 
    ${DB_RESULT} Result value of DB_EXISTS() dial plan function 
    ${DNID} * Dialed Number Identifier (Deprecated; use ${CALLERID(dnid)}) 
    ${EPOCH} * Current unix style epoch 
    ${EXTEN} * Current extension   //当前分机号或拨号。
    ${ENV(VAR)} Environmental variable VAR 
    ${GOTO_ON_BLINDXFR} Transfer to the specified context/extension/priority 
    after a blind transfer (use ^ characters in place of 
    | to separate context/extension/priority when setting 
    this variable from the dialplan) 
    ${HANGUPCAUSE} * Asterisk cause of hangup (inbound/outbound) 
    ${HINT} * Channel hints for this extension 
    ${HINTNAME} * Suggested Caller*ID name for this extension 
    ${INVALID_EXTEN} The invalid called extension (used in the "i" extension) 
    ${LANGUAGE} * Current language (Deprecated; use ${LANGUAGE()}) 
    ${LEN(VAR)} * String length of VAR (integer) 
    ${PRIORITY} * Current priority in the dialplan 
    ${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed 
    ${RDNIS} * Redirected Dial Number ID Service (Deprecated; use ${CALLERID(rdnis)}) 
    ${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS (Deprecated; use ${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}) 
    ${TRANSFER_CONTEXT} Context for transferred calls 
    ${FORWARD_CONTEXT} Context for forwarded calls 
    ${UNIQUEID} * Current call unique identifier 
    ${SYSTEMNAME} * value of the systemname option of asterisk.conf 

    Application return values 

    In Asterisk 1.2, many applications return the result in a variable 
    instead of, as in Asterisk 1.0, changing the dial plan priority (+101). 
    For the various status values, see each application's help text. 

    ${AGISTATUS} * agi() 
    ${AQMSTATUS} * addqueuemember() 
    ${AVAILSTATUS} * chanisavail() 
    ${CHECKGROUPSTATUS} * checkgroup() 
    ${CHECKMD5STATUS} * checkmd5() 
    ${CPLAYBACKSTATUS} * controlplayback() 
    ${DIALSTATUS} * dial() - see also ${HANGUPCAUSE} 
    ${DBGETSTATUS} * dbget() 
    ${ENUMSTATUS} * enumlookup() 
    ${HASVMSTATUS} * hasnewvoicemail() 
    ${LOOKUPBLSTATUS} * lookupblacklist() 
    ${OSPAUTHSTATUS} * ospauth() 
    ${OSPLOOKUPSTATUS} * osplookup() 
    ${OSPNEXTSTATUS} * ospnext() 
    ${OSPFINISHSTATUS} * ospfinish() 
    ${PARKEDAT} * parkandannounce() 
    ${PLAYBACKSTATUS} * playback() 
    ${PQMSTATUS} * pausequeuemember() 
    ${PRIVACYMGRSTATUS} * privacymanager() 
    ${QUEUESTATUS} * queue() 
    ${RQMSTATUS} * removequeuemember() 
    ${SENDIMAGESTATUS} * sendimage() 
    ${SENDTEXTSTATUS} * sendtext() 
    ${SENDURLSTATUS} * sendurl() 
    ${SYSTEMSTATUS} * system() 
    ${TRANSFERSTATUS} * transfer() 
    ${TXTCIDNAMESTATUS} * txtcidname() 
    ${UPQMSTATUS} * unpausequeuemember() 
    ${VMSTATUS} * voicmail() 
    ${VMBOXEXISTSSTATUS} * vmboxexists() 
    ${WAITSTATUS} * waitforsilence() 


    Various application variables 

    ${CURL} * Resulting page content for curl() 
    ${ENUM} * Result of application EnumLookup 
    ${EXITCONTEXT} Context to exit to in IVR menu (app background()) 
    or in the RetryDial() application 
    ${MONITOR} * Set to "TRUE" if the channel is/has been monitored (app monitor()) 
    ${MONITOR_EXEC} Application to execute after monitoring a call 
    ${MONITOR_EXEC_ARGS} Arguments to application 
    ${MONITOR_FILENAME} File for monitoring (recording) calls in queue 
    ${QUEUE_PRIO} Queue priority 
    ${QUEUE_MAX_PENALTY} Maximum member penalty allowed to answer caller 
    ${QUEUESTATUS} Status of the call, one of: 
    (TIMEOUT | FULL | JOINEMPTY | LEAVEEMPTY | JOINUNAVAIL | LEAVEUNAVAIL) 
    ${RECORDED_FILE} * Recorded file in record() 
    ${TALK_DETECTED} * Result from talkdetect() 
    ${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record) 
    ${TOUCH_MONITOR_FORMAT} The audio format to use with Touch Monitor (auto record) 
    ${TOUCH_MONITOR_OUTPUT} * Recorded file from Touch Monitor (auto record) 
    ${TXTCIDNAME} * Result of application TXTCIDName 
    ${VPB_GETDTMF} chan_vpb 

    The MeetMe Conference Bridge uses the following variables: 

    ${MEETME_RECORDINGFILE} Name of file for recording a conference with 
    the "r" option 
    ${MEETME_RECORDINGFORMAT} Format of file to be recorded 
    ${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting 
    ${MEETME_AGI_BACKGROUND} AGI script for Meetme (zap only) 
    ${MEETMESECS} * Number of seconds a user participated in a MeetMe conference 

    The VoiceMail() application uses the following variables: 

    ${VM_CATEGORY} * Sets voicemail category 
    ${VM_NAME} * Full name in voicemail 
    ${VM_MAILBOX} * Mailbox Number 
    ${VM_DUR} * Voicemail duration 
    ${VM_MSGNUM} * Number of voicemail message in mailbox 
    ${VM_CALLERID} * Voicemail Caller ID (Person leaving vm) 
    ${VM_CIDNAME} * Voicemail Caller ID Name 
    ${VM_CIDNUM} * Voicemail Caller ID Number 
    ${VM_DATE} * Voicemail Date 
    ${VM_MESSAGEFILE} * Path to message left by caller 

    The VMAuthenticate() application uses the following variables: 

    ${AUTH_MAILBOX} * Authenticated mailbox 
    ${AUTH_CONTEXT} * Authenticated mailbox context 

    DUNDiLookup() uses the following variables 

    ${DUNDTECH} * The Technology of the result from a call to DUNDiLookup() 
    ${DUNDDEST} * The Destination of the result from a call to DUNDiLookup() 

    The Zaptel channel sets the following variables: 

    ${ANI2} * The ANI2 Code provided by the network on the incoming call. (ie, Code 29 identifies call as a Prison/Inmate Call) See also: NANPA ANI II Digits Assignments 
    ${CALLTYPE} * Type of call (Speech, Digital, etc) 
    ${CALLEDTON} * Dialplan for called number on PRI/BRI calls (17=international, 33=national, 65=local, 73=private, 0=unknown). Note: this is a misnomer, TON != dialplan. 
    ${CALLINGSUBADDR} * Called PRI Subaddress 
    ${FAXEXTEN} * The extension called before being redirected to "fax" 
    ${PRIREDIRECTREASON} * Reason for redirect, if a call was directed 
    ${SMDI_VM_TYPE} * When an call is received with an SMDI message, the 'type' 
    of message 'b' or 'u' 

    The SIP channel uses the following variables: 

    ${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 
    ${SIPURI} * SIP uri 
    ${SIP_CODEC} Set the SIP codec for a call 
    ${SIP_URI_OPTIONS} * additional options to add to the URI for an outgoing call 
    ${RTPAUDIOQOS} RTCP QoS report for the audio of this call 
    ${RTPVIDEOQOS} RTCP QoS report for the video of this call 

    The Agent channel uses the following variables: 

    ${AGENTMAXLOGINTRIES} Set the maximum number of failed logins 
    ${AGENTUPDATECDR} Whether to update the CDR record with Agent channel data 
    ${AGENTGOODBYE} Sound file to use for "Good Bye" when agent logs out 
    ${AGENTACKCALL} Whether the agent should acknowledge the incoming call 
    ${AGENTAUTOLOGOFF} Auto logging off for an agent 
    ${AGENTWRAPUPTIME} Setting the time for wrapup between incoming calls 
    ${AGENTNUMBER} * Agent number (username) set at login 
    ${AGENTSTATUS} * Status of login ( fail | on | off ) 
    ${AGENTEXTEN} * Extension for logged in agent 

    The Dial() application uses the following variables: 

    ${DIALEDPEERNAME} * Dialed peer name 
    ${DIALEDPEERNUMBER} * Dialed peer number 
    ${DIALEDTIME} * Time for the call (seconds) 
    ${ANSWEREDTIME} * Time from dial to answer (seconds) 
    ${DIALSTATUS} * Status of the call, one of: 
                    (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER  
    | ANSWER | CANCEL | DONTCALL | TORTURE) 
    ${DYNAMIC_FEATURES} * The list of features (from the applicationmap section of 
    features.conf) to activate during the call, with feature 
    names separated by '#' characters 
    ${LIMIT_PLAYAUDIO_CALLER} Soundfile for call limits 
    ${LIMIT_PLAYAUDIO_CALLEE} Soundfile for call limits 
    ${LIMIT_WARNING_FILE} Soundfile for call limits 
    ${LIMIT_TIMEOUT_FILE} Soundfile for call limits 
    ${LIMIT_CONNECT_FILE} Soundfile for call limits 
    ${OUTBOUND_GROUP} Default groups for peer channels (as in SetGroup) 
    • See "show application dial" for more information

    The chanisavail() application sets the following variables: 

    ${AVAILCHAN} * the name of the available channel if one was found 
    ${AVAILORIGCHAN} * the canonical channel name that was used to create the channel 
    ${AVAILSTATUS} * Status of requested channel 

    When using macros in the dialplan, these variables are available 

    ${MACRO_EXTEN} * The calling extensions 
    ${MACRO_CONTEXT} * The calling context 
    ${MACRO_PRIORITY} * The calling priority 
    ${MACRO_OFFSET} Offset to add to priority at return from macro 

    The ChanSpy() application uses the following variables: 

    ${SPYGROUP} * A ':' (colon) separated list of group names. 
    (To be set on spied on channel and matched against the g(grp) option) 

    If you compile with OSP support, these variables are used: 

    ${OSPINHANDLE} OSP handle of in_bound call 
    ${OSPINTIMELIMIT} Duration limit for in_bound call 
    ${OSPOUTHANDLE} OSP handle of out_bound call 
    ${OSPTECH} OSP technology 
    ${OSPDEST} OSP destination 
    ${OSPCALLING} OSP calling number 
    ${OSPOUTTOKEN} OSP token to use for out_bound call 
    ${OSPOUTTIMELIMIT} Duration limit for out_bound call 
    ${OSPRESULTS} Number of remained destinations 

    Call File extension variables: 

    ${REASON} The reason why an auto-dialout call failed 




    CDR Variables 


    If the channel has a cdr, that cdr record has it's own set of variables which 
    can be accessed just like channel variables. The following builtin variables 
    are available and, unless specified, read-only. 

    ${CDR(clid)} Caller ID 
    ${CDR(src)} Source 
    ${CDR(dst)} Destination 
    ${CDR(dcontext)} Destination context 
    ${CDR(channel)} Channel name 
    ${CDR(dstchannel)} Destination channel 
    ${CDR(lastapp)} Last app executed 
    ${CDR(lastdata)} Last app's arguments 
    ${CDR(start)} Time the call started. 
    ${CDR(answer)} Time the call was answered. 
    ${CDR(end)} Time the call ended. 
    ${CDR(duration)} Duration of the call. 
    ${CDR(billsec)} Duration of the call once it was answered. 
    ${CDR(disposition)} ANSWERED, NO ANSWER, BUSY 
    ${CDR(amaflags)} DOCUMENTATION, BILL, IGNORE etc 
    ${CDR(accountcode)} The channel's account code (read-write). 
    ${CDR(uniqueid)} The channel's unique id. 
    ${CDR(userfield)} The channels uses specified field (read-write). 


    In addition, you can set your own extra variables with a traditional 
    Set(CDR(var)=val) to anything you want. 

    NOTE Some CDR values (eg: duration & billsec) can't be accessed until the call has terminated. As of 91617, those values will be calculated on-demand if requested. Until that makes it into a stable release, you can set endbeforehexten=yes in cdr.conf, and then use the "hangup" context to wrap up your call. 

    Certain functional variables may be accessed with ${foo(<args>)}. A list 
    of these functional variables may be found by typing "show functions" 

    at the Asterisk CLI. 

    教程 asterisk
    发布日期:2013-03-01 21:21 (责任编辑:xulei)