[Asterisk-Dev] New answering machine detection app

Ben Hencke brainstar at gmail.com
Fri Feb 11 14:35:41 MST 2005


Hi everyone,
I would like to both post some code that people might find useful, as
well as ask some questions about how I can improve it.

>From the desc:
MachineDetect(x|y|z) Waits for answering machine greetings to finish
and sets a flag.
  Waits for 'x' milliseconds of silence, 'y' times.
  ${MACHINE} will be set to 1 if 'z' miliseconds of total (non-continuous)
  audio noise is detected.


This app is based on the WaitForSilence app in CVS. I have modified it
so that it will set a variable if it detects a threshold of non
silence. This is used to detect the greeting of answering machines
that is usually longer than a person greeting. I know there is no 100%
way to detect answering machines, but something is better than nothing
for my emergency notification service.

I have also added in some code to cope with the problem I am seeing
when I use this app (and WaitForSilence) on a VOIP channel. That is,
when there is silence on the line, the call to ast_waitfor() will
timeout. I assume this is from the protocols that remove silence
frames instead of transmitting them. There is nothing to read, so
ast_waitfor will block and timeout. I have a work-around where I
measure and detect the blocking time and timeouts and it works fine on
IAX2 channels.

The problem I am having is with a SIP channel. For whatever reason,
all calls to ast_waitfor() always block, and always timeout no matter
what kind of audio is on the line. It would seem that I can not use
any of the DSP functions on a SIP channel?

How can I access the audio frames or silence/non-silence information
on a SIP channel?

Any info would be appreciated.

Also, if anyone ends up using this on real hardware, please let me
know how it works for you and what settings you find are a best fit.

Thanks,
  Ben

PS feel free to include this in CVS or use it in your * build, just
don't use it to call me with telemarketing calls ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app_machinedetect.c
Type: application/octet-stream
Size: 6331 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20050211/d3797829/app_machinedetect.obj


More information about the asterisk-dev mailing list