asterisk silence detection on connected call

不想你离开。 提交于 2019-12-24 15:03:40

问题


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) 

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 ?


回答1:


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

Synopsis

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

Description

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.

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()

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.




回答2:


There are no such functionallity in asterisk

You can create our own c/c++ application or attach enother channel using ChanSpy and use SilenceDetect command+ UserEvent command.

However such diaplan is not for newbie,sorry



来源:https://stackoverflow.com/questions/34556653/asterisk-silence-detection-on-connected-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!