`
sun4love
  • 浏览: 226348 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Asterisk Extension中的Application命令详解四

    博客分类:
  • VOIP
阅读更多

Hangup( )        Unconditionally hangs up the current channel
                                                       无条件的挂起当前通道

Hangup( )
Unconditionally hangs up the current channel. 无条件的挂起当前通道
Always returns -1. 返回值:-1

exten => 123,1,Answer( )
exten => 123,2,Playback(im-sorry)
exten => 123,3,Hangup( )
See Also  请参阅:

Answer( )  

HasNewVoicemail( )        Conditionally  branches if there is new voicemail in the indicated voicemail box
                                               如果在语音邮件箱中有新的语音邮件的话则有条件的进行转移

HasNewVoicemail(vmbox[@context][:folder][,varname])

Similar  to  HasVoicemail( ).  This  application  branches  to  priority  n+101  (where  n  is  the current  priority)  if  there  is  new  (unheard)  voicemail  in  the  voicemail  box  indicated  by vmbox.  The  context  argument  corresponds  to  the  voicemail  context,  and  folder  corresponds  to  a  voicemail  folder.  If  the  voicemail  folder  is  not  specified,  it  defaults  to  the INBOX folder. If the varname argument is present, HasNewVoicemail( ) assigns the number of messages in the specified folder to that variable.
类似于HasVoicemail()函数。如果vmbox提示有未听过的语音邮件在voicemail  box中则应用转移到优先级n+101(n为当前优先级)。下文讨论了相符合的语音环境,和相符合文件夹的语音文件夹。如果未指定文件夹,缺省到INBOX文件夹。如果变量名称确定的话,HasNewVoicemail()指定消息数目到指定的变量文件夹。

; check to see if there's unheard voicemail in INBOX of mailbox 123
; in the default voicemail context
在缺省的语音环境中,如果在INBOX邮箱123中未听到语音邮件则进行检查。
exten => 123,1,Answer( )
exten => 123,2,HasNewVoicemail(123@default,COUNT)
exten => 123,3,Playback(vm-youhave)
exten => 123,4,Playback(vm-no)
exten => 123,5,Playback(vm-messages) exten => 123,103,Playback(vm-youhave) exten => 123,104,SayNumber($COUNT) exten => 123,105,Playback(vm-messages)

See Also  请参阅

HasVoicemail( ), MailboxExists( )

IAX2Provision( )        Provisions a calling IAXy device

IAX2Provision([template])
Provisions a calling IAXy device (assuming that the calling entity is an IAXy) with the given template.  If  no  template  is  specified,  the  default  template  is  used.  IAXy  provisioning templates are defined in the iaxprov.conf configuration file.
供应一个呼叫IAXY设备(指定呼叫实体为IAXY)并指定模板,如果没有指定模板,则缺省模板被使用,IAXY指定模板是在iaxprov.conf配置文件中被指定。

Returns -1 on error or 0 on success.  错误返回-1成功则返回0

; provision IAXy devices with the default template when they dial this extension
                   当通过扩展拨号时通过缺省模板指定IAXy设备。
exten => 123,1,IAX2Provision(default)






ImportVar( )        Sets a variable based on a channel variable from a different channel
                                                  从不同的通道中设定一个基于通道变量的变量。

ImportVar(newvar=channel,variable)
Sets  variable  newvar  to  variable  as  evaluated  on  the  specified  channel  (instead  of  the current channel). If newvar is prefixed with _, single inheritance is assumed. If prefixed with__, infinite inheritance is assumed.
在指定通道设定新变量做为评估(不是当前通道),如果新变量带有_,则假定单一继承,如果变量带有__,则指定多继承。

; read the Caller ID information from channel Zap/1
exten => 123,1,Answer( )
exten => 123,1,ImportVar(cidinfo=Zap/1,CALLERID)

See Also

Set( )

LookupBlacklist( )        Performs a lookup of a Caller ID name/number from the blacklist database
                                               从数据库黑名单中执行呼叫ID名称/号码查找

LookupBlacklist( )
Looks  up  the  Caller  ID  number  on  the  active  channel  in  the  Asterisk  database  (family blacklist). If the number is found, and if there exists a priority n+101 (where n is the priority of the current instance), the channel will be set up to continue at that priority level. Other- wise, the application returns 0. If no Caller ID was received on the channel, it does nothing
在Asterisk数据库(系列黑名单)中查找动态通道中呼叫ID号码,如果号码被找到,并且如果存在一个N+101优先级(N是当前优先级),则该通道将被设置为当前优先级,否则返回0,如果呼叫ID未找到,则什么也不做。
To add to the blacklist from the Asterisk CLI, type database put blacklist name/number.
通过Asterisk命令行:database put blacklist name/number添黑名单。

; send blacklisted numbers to an endless loop
; otherwise, dial the number defined by the variable ${JOHN}
exten => s,1,Answer( )
exten => s,2,LookupBlacklist( )
exten => s,3,Dial(${JOHN})
exten => s,103,Playback(tt-allbusy)
exten => s,104,Wait(10)
exten => s,105,Goto(103)

LookupCIDName( )        Performs a lookup of a Caller ID name from the AstDB
                                                                      从AstDB中执行查找呼叫ID名称

LookupCIDName( )
Uses the Caller ID number on the active channel to retrieve the Caller ID name from the AstDB (family cidname). This application does nothing if no Caller"*ID was received on the channel. This is useful if you do not subscribe to Caller ID name delivery, or if you want to change the Caller ID names on some incoming calls.
在动态通道中使用呼叫ID从AstDB(cidname 系列)中检索呼叫名称,如果通道中没有找到呼叫ID则程序未反应,如果你不想将呼叫ID名称传输或者在一些呼入中不想改变呼叫ID名称,这将是非常有用的。

Always returns 0.  总是返回0

; look up the Caller ID information from the AstDB, and pass it along
; to Jane's phone
exten => 123,1,Answer( )
exten => 123,2,LookupCIDName( )
exten => 123,3,Dial(SIP/Jane)





Macro( )        Calls a previously defined macro
                                                                                  调用以前定义的宏

Macro(macroname,arg1,arg2...)
Executes a macro defined in the context named macro-macroname, jumping to the s exten- sion of that context and executing each step, then returning when the steps end.
执行在参数macro-macroname中定义的宏,并转至S范围然后按步执行,执行完后返回。
The calling extension, context, and priority are stored in ${MACRO_EXTEN}, ${MACRO_CONTEXT}, and ${MACRO_PRIORITY}, respectively. Arguments arg1, arg2, etc. become ${ARG1}, ${ARG2}, etc. in the macro context.
呼叫范围,上下文,和优先级分别存贮在变量${MACRO_EXTEN},${MACRO_CONTEXT},${MACRO_PRIORITY}中,参数arg1,arg2在宏中为${ARG1},${ARG2}等。
Macro( ) returns -1 if any step in the macro returns -1, and 0 otherwise. If ${MACRO_OFFSET} is set at termination, this application will attempt to continue at priority MACRO_OFFSET+n+1 if such a step exists, and at n+1 otherwise. (In both cases, n stands for the current priority.) If you call the Goto( ) application inside of the macro, the macro will terminate and control will go to the destination of the Goto( ).
如果任何结果返回-1则宏返回-1,否则为0。如果${MACRO_OFFSET}参数在终端中设置,如果存大的话则宏将试着去执行优先级MACRO_OFFSET+n+1,否则在n+1。(在两种情况下,n为当前优先级)。如果宏中包含Goto()应用,则宏将停止并且控制将交给Goto()应用程序

; define a macro to count down from the specified value
[macro-countdown]   定义宏用来统计从[macro-countdown]指定的值
exten => s,1,Set(COUNT=${ARG1}) exten => s,2,While($[ ${COUNT} > 0]) exten => s,3,SayNumber(${COUNT})
exten => s,4,Set(COUNT=$[ ${COUNT} - 1 ])
exten => s,5,EndWhile( )

; call our macro with two different values  用两种不同的值调用宏
[example]
exten => 123,1,Macro(countdown,10)
exten => 124,1,Macro(countdown,5)

See Also

Goto( ), Chapter 6


MailboxExists( )        Conditionally branches if the specified voicemail box exists
                                         如果voicemail box存在则有条件的转移
MailboxExists(mailbox[@context])
Conditionally branches to priority n+101 (where n is the current priority) if the voicemail box  specified  by  the  mailbox  argument  exists.  You  may  pass  a  voicemail  context  if  the mailbox is not in the default voicemail context.
如果被mailbox参数指定的voicemail box存在则将优先级转移到n+101(n为当前优先级).如果说mailbox不在缺省的voicemail环境则你可以通过一个voicemail环境.

exten => 123,1,Answer( )
exten => 123,2,MailboxExists(123@default)
exten => 123,3,Playback(im-sorry)
exten => 123,103,Voicemail(u123)

See Also

HasVoicemail( ), HasNewVoicemail( )

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics