[Asterisk-Users] New App: WaitForSilence

David Troy dave at popvox.com
Sun Sep 19 10:01:03 MST 2004


I just posted this app, which I've been testing for a while and should be 
ready for inclusion in CVS.

http://bugs.digium.com/bug_view_page.php?bug_id=0002467

This app was put together so as to be able to deal with answering machines 
when making outbound calls. The idea is that you probably don't want to 
start playing your soundfile until the call has been fully answered by a 
human, and there has been a given amount of silence.

Here is a simple implementation; note that it can be called repeatedly to 
deal with cadences of different situations:

Exten => 7001,1,WaitForSilence(200,7)
Exten => 7001,2,WaitForSilence(700,1)
Exten => 7001,3,Playback,outboundmsg
Exten => 7001,4,Hangup

This in (1) waits for silence 200ms, 7 times (1.4 seconds). Then in (2), 
it waits for silence 700ms once.

This deals with the possibility of multiple short periods of silence 
occuring within or before an answering machine message (200 x 7 
instances), and then waits for 700ms of silence to be SURE that the remote 
side really is ready for you to talk. This essentially emulates human 
behavior when calling an answering machine, and in my tests, this 
configuration works very well.

This general idea could also be coupled with CDR information (ResetCDR, 
Answer, etc) to log statistics about termination of calls to humans or 
answering machines, depending on the amount of post-answer delay 
experienced while waiting for silence.  A longer amount of wait would 
indicate an answering machine (>10 sec?) while a short amount of wait (1-2 
sec?) might indicate a human simply saying "hello?".  You could make an 
accurate distinction based on that.  I leave that as an exercise for the 
reader. :)

This code is based on *'s internal DSP functions. It should be ready for 
inclusion in the CVS head. Just edit apps/Makefile to include 
app_waitforsilence.c in app list.

This app can be used for good or for evil; please use only for good.

Dave Troy




More information about the asterisk-users mailing list