Asterisk 通话过程中执行动作(即applicationmap )的使用方法和电话转会议的实现

 

 

 

asterisk在正常通话过程中执行拨号计划中动作是通过feature.conf中的[applicationmap ]下定义的,举例如下:

nway-start => *0,callee,Macro,nway-start nway-zhustart => *0,caller,Macro,nway-zhustart

nway-inv => *7,caller,Macro,nway-ok nway-noinv => *9,self,Macro,nway-notok

zhugoto-meeting => *5,caller,Macro,zhugoto-meeting goto-meeting => *5,callee,Macro,goto-meeting

caller和callee 的区别参考:http://blog.csdn.net/radkitty/archive/2009/12/29/5102097.aspx

有些人定义了applicationmap 按键后不能引发制定动作 这是由于未设置DYNAMIC_FEATURES引起的

可以使用DYNAMIC_FEATURES来决定哪些动作可以被执行。

可以在globals_custom.conf中定义DYNAMIC_FEATURES全局变量来使用:

DYNAMIC_FEATURES=nway-start#goto-meeting

也可在拨号计划中通过

exten => s,n,Set(DYNAMIC_FEATURES=nway-zhustart#zhugoto-meeting)

来设置

电话转会议的实现方法请参考我前面的笔记:http://blog.csdn.net/seven407/archive/2010/05/14/5591078.aspx

并附下我最新的实现代码:

extensions.conf 末尾添加:

[default] ;exten => _XXXX,1,Set(DYNAMIC_FEATURES=nway-start#nway-zhustart) exten => _XXXX,n,Dial(SIP/${EXTEN})

[dynamic-nway] exten => _XXXXXXXX,1,Answer exten => _XXXXXXXX,n,Set(CONFNO=${EXTEN}) exten => _XXXXXXXX,n,Set(MEETME_EXIT_CONTEXT=dynamic-nway-invite) exten => _XXXXXXXX,n,Set(DYNAMIC_FEATURES=) exten => _XXXXXXXX,n,MeetMe(${CONFNO},1pdMXr) exten => _XXXXXXXX,n,Hangup()

[dynamic-nway-invite] exten => 0,1,Read(DEST,dial,,i) exten => 0,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv) ;exten => 0,n,Dial(SIP/${DEST},,g) exten => 0,n,Dial(Local/${DEST}@from-internal,,g) exten => 0,n,Set(DYNAMIC_FEATURES=) exten => 0,n,Gosub(dynamic-nway,${CONFNO},1) exten => i,1,Goto(dynamic-nway,${CONFNO},1)

[dynamic-nway-dest] exten => _XXXX,1,Dial(SIP/${EXTEN},,g)

[my-meet-dial] exten => _XXXXXXXX,1,Read(DEST,dial,,i) exten => _XXXXXXXX,n,Set(CONFNO=${EXTEN}) exten => _XXXXXXXX,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv) ;exten => _XXXXXXXX,n,Dial(SIP/${DEST},,g) exten => _XXXXXXXX,n,Dial(Local/${DEST}@from-internal,,g) exten => _XXXXXXXX,n,Set(DYNAMIC_FEATURES=)

exten => _XXXXXXXX,n,Answer exten => _XXXXXXXX,n,Set(CONFNO=${EXTEN}) exten => _XXXXXXXX,n,Set(MEETME_EXIT_CONTEXT=dynamic-nway-invite) exten => _XXXXXXXX,n,Set(DYNAMIC_FEATURES=) exten => _XXXXXXXX,n,MeetMe(${CONFNO},1pdMXr) exten => _XXXXXXXX,n,Hangup()

[macro-nway-start] ;exten => s,n, SetGlobalVar(MEETMENUM=$[${MEETMENUM} + 1]) ;exten => s,1,Set(CONFNO=$[10000 + ${AMPUSER}]);XX ;exten => s,1,Set(CONFNO=$[10000 + ${CALLERID(num)}]);XX ;exten => s,1,Set(CONFNO=10000) ;exten => s,1,Set(CONFNO=$[10000 + ${EXTEN}]) exten => s,1,Set(CONFNO=${STRFTIME(${EPOCH},,%d%H%M%S)}) exten => s,n,ChannelRedirect(${BRIDGEPEER},my-meet-dial,${CONFNO},1) exten => s,n,Hangup() exten => s,n,Gosub(dynamic-nway,${CONFNO},1)

[macro-nway-zhustart] exten => s,1,Set(CONFNO=${STRFTIME(${EPOCH},,%d%H%M%S)}) exten => s,n,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1) exten => s,n,Hangup() exten => s,n,Read(DEST,dial,,i) exten => s,n,Set(DYNAMIC_FEATURES=nway-inv#nway-noinv) ;exten => s,n,Dial(SIP/${DEST},,g) exten => s,n,Dial(Local/${DEST}@from-internal,,g) exten => s,n,Set(DYNAMIC_FEATURES=) exten => s,n,Gosub(dynamic-nway,${CONFNO},1)

[macro-nway-ok] exten => s,1,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1)

[macro-nway-notok] exten => s,1,SoftHangup(${BRIDGEPEER})

[macro-zhugoto-meeting] exten => s,1,Set(CONFNO=${STRFTIME(${EPOCH},,%d%H%M%S)}) exten => s,n,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1) exten => s,n,Hangup() exten => s,n,Gosub(dynamic-nway,${CONFNO},1)

[macro-goto-meeting] exten => s,1,Set(CONFNO=${STRFTIME(${EPOCH},,%d%H%M%S)}) exten => s,n,ChannelRedirect(${BRIDGEPEER},dynamic-nway,${CONFNO},1) exten => s,n,Hangup() exten => s,n,Gosub(dynamic-nway,${CONFNO},1)

并修改

[macro-dial] exten => s,1,GotoIf($["${MOHCLASS}" = ""]?dial)

[macro-dial] exten => s,1,Set(DYNAMIC_FEATURES=nway-zhustart#zhugoto-meeting) exten => s,n,GotoIf($["${MOHCLASS}" = ""]?dial)

globals_custom.conf中添加:

DYNAMIC_FEATURES=nway-start#goto-meeting

features_applicationmap_custom.conf添加:

nway-start => *0,callee,Macro,nway-start nway-zhustart => *0,caller,Macro,nway-zhustart

nway-inv => *7,caller,Macro,nway-ok nway-noinv => *9,self,Macro,nway-notok

zhugoto-meeting => *5,caller,Macro,zhugoto-meeting goto-meeting => *5,callee,Macro,goto-meeting

 

 

你可能感兴趣的:(application)