简体   繁体   English

星号拨号计划:如何检测何时成功接听电话?

[英]Asterisk Dialplan: How to detect when a call has been successfully answered?

I'm having a really hard time figuring out if there is a trigger or a way to continue from the Dial action that allows you to detect if the call is answered. 我很难确定拨号操作是否存在触发器或继续操作的方法,该方法可以让您检测呼叫是否已应答。 It seems like Dial doesn't respond until hangup, busy, or congested . 似乎Dial挂断,忙碌或拥挤之前没有响应。 What action or event am I missing that would tell me when the other end of the line actually answers the call? 我缺少什么动作或事件可以告诉我该线路的另一端何时实际接听电话? Hoping there is something like this available that I'm just missing: 希望我缺少这样的东西:

exten => s,7,Dial(${ARG1},20,rt)       ; Ring the interface, 20 seconds maximum
exten => s,8,Goto(s-${DIALSTATUS},1)                    
; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-ANSWER(do something)

Finally figured it out. 终于想通了。 It involves calling the M flag in the Dial action call. 它涉及在“ 拨号”操作调用中调用M标志。 By calling the M flag, you can call a custom macro that will execute immediately after the call is connected/answered. 通过调用M标志,您可以调用自定义宏,该宏将在连接/应答呼叫后立即执行。

Ex: Dial(SIP/200,60,M(myCustomMacro)) 例如: 拨号(SIP / 200,60,M(myCustomMacro))

Hope this helps for any that were also curious. 希望这对任何好奇的人有所帮助。

You can also do a Gosub when call is answered: 您也可以在接听电话时进行Gosub操作:

asterisk*cli> core show application Dial
...
    U(x[^arg[^...]]):
        x - Name of the subroutine to execute via Gosub
        arg - Arguments for the Gosub routine
Execute via Gosub the routine <x> for the *called* channel before connecting to
the calling channel. Arguments can be specified to the Gosub using '^' as a
delimiter. The Gosub routine can set the variable ${GOSUB_RESULT} to specify
the following actions after the Gosub returns

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM