星号静音检测到已连接的呼叫

问题描述:

对不起,如果我的问题对您没有意义. 我是星号的新手,我想做的是编写一个拨号计划,该计划可以连接2个软电话端点(VoIP客户端端点),然后尝试检测正在进行的呼叫中的静音状态.我可以使用以下拨号方案拨打电话

Sorry in advance if my question makes no sense to you. I am newbie in asterisk, and what I am trying to do is writing a dial plan which can connects 2 soft phone end point (VoIP client end points) and then try to detect silence in ongoing call. I am able to make through call by using following dial plan

exten = 100, 1, Answer() 
same =  100, n, Monitor()
same =  100, n, Dial(SIP/client1,15) 

当我拨打100时,它会优雅地接收到client1的呼叫,并且现在通话正在进行,现在我将两端麦克风(主叫方和被叫方)静音,通话仍在进行中.正在正确创建每个通道的记录.现在,只要检测到静音3秒钟,我就需要触发一个事件,我需要抓住该音频块直到静音.

when I dialed 100, it makes call to client1, which I received gracefully and now call is on going, now I mute my both end mics (caller and callee), the call is still going. Recording of each channel is creating properly. Now I need to fire an event whenever there is silence detected for 3 seconds and I need to grab that audio chunk till silence.

有什么想法可以实现这个目标吗?

Any idea how I can achieve this objective ?

在Asterisk 13中,您可以使用

In Asterisk 13, you can use the TALK_DETECT dialplan function:

简介

当Asterisk检测到静音或正在通话时引发通知 频道.

Raises notifications when Asterisk detects silence or talking on a channel.

说明

TALK_DETECT函数在其应用的通道上启用事件 到.这些事件可以通过AMI,ARI和其他潜在事件发出 侦听内部通知的星号模块.

The TALK_DETECT function enables events on the channel it is applied to. These events can be emited over AMI, ARI, and potentially other Asterisk modules that listen for the internal notification.

请记住,TALK_DETECT仅查找来自 通道设备侧(即读取侧)的音频.因此,如果我们想引发两个通道的事件,则需要将其应用于每个通道.例如,以下将通过在出站通道上使用预拨号处理程序将语音检测应用于两个通道:

Keep in mind that TALK_DETECT only looks for audio coming from the device side of the channel, i.e., the read side. Thus, if we want to raise events for both channels, we need to apply it to each channel. As an example, the following would apply talk detection to both channels by using a pre-dial handler on the outbound channel:

[default]

exten => 100,1,Answer()
 same => n,Set(TALK_DETECT(set)=)
 same => n,Monitor()
 same => n,Dial(SIP/client1,15,b(default^apply_talk_detect^1)) 
 same => n,Hangup()

exten => apply_talk_detect,1,NoOp()
 same => n,Set(TALK_DETECT(set)=)
 same => n,Return()

使用此方法,您应该获得AMI事件 ChannelTalkingStart 检测到通话时发生的事件,并且 ChannelTalkingStop 事件是其中之一,频道停止通话.然后,您的外部应用程序可以查看事件之间是否存在三秒钟的间隔,并采取相应的措施.

Using this, you should get the AMI event ChannelTalkingStart event when talking is detected, and ChannelTalkingStop event when one of the channels stops talking. Your external application can then look to see if there is a three second gap between the events, and take action accordingly.