Asterisk Dialplan防止拨号计划不断重复

时间:2014-09-01 12:20:40

标签: asterisk

我的diaplan中有以下宏,每次有来电时都会被执行。

问题在于它无限期地重复着自己。我希望它重复3次,如果没有来自用户的输入,它应该说再见并退出。请有人帮我这个。

由于

[macro-test]   
;exten => s,1,Answer()   
;exten => s,n,Wait(2)   
exten => s,1,Set(AGISIGHUP=no)   
exten => s,n,NoOp(AGISUGHUP: ${AGISIGHUP})   
exten => s,n,Set(CALLED=${MACRO_EXTEN})   
exten => s,n,Set(CALLER=${CUT(CUT(SIP_HEADER(From),@,1),:,2)})  
exten => s,n(action),Set(EXIT=0)  
exten => s,n,Set(TOKEN="")    
exten => s,n,Set(INIT="true")   
exten => s,n,While($[${EXIT}<1])   
exten => s,n,Set(EXIT=1)   
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})   
exten => s,n,Set(INIT="false")   
exten => s,n,NoOp(AGISTATUS: ${AGISTATUS})    
exten => s,n,GotoIf($["${AGISTATUS}" != "SUCCESS"]?fail:succ)   
exten => s,n(succ),EndWhile()   
exten => s,n,Set(INIT="end")   
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})   
exten => s,n,Hangup()   
exten => s,n(fail),Wait(2)   
exten => s,n,Playback(vm-goodbye)   
exten => s,n,Hangup()   

exten => h,1,NoOp(Notify Billing System)   
exten => h,n,NoOp(Other Tasks)   
exten => h,n,Hangup()   

2 个答案:

答案 0 :(得分:0)

简单循环拨号方案

exten =>s ,1,Set(loop=3)
exten =>s,n(loop),Noop(loop start here)
exten =>s,n,Noop(do something here)
exten =>s,n,Set(loop=$[ ${loop} - 1 ]);decrease loop countr
exten =>s,n,GotoIf($[ ${loop} > 0 ]?loop); if still have something, do again

答案 1 :(得分:0)

  

exten =&gt; H,N,挂断()

当你已经挂断电话时,不要打电话给挂机。