[asterisk-users] answering machine screening with MixMonitor

G. Paul Ziemba pz-asterisk-users at ziemba.us
Wed Feb 5 11:09:34 CST 2014


I'm using asterisk 1.8 as an answering machine. I'd like to
hear the calls it answers aloud in case I want to pick up and
interrupt the call.

There are a few articles describing, for example, three-way
calling a monitor phone set to auto-answer, but I couldn't
find anything that described how to just send the audio to
a local speaker.

I am currently using MixMonitor to append the audio to a
named pipe ("mkfifo /home/asterisk/var/soundpipe.au"), as
follows (extensions.conf):

    [from-pstn]
    exten => s,1,Wait(20)
    exten => s,2,Answer
    exten => s,3,Wait(1)
    exten => s,4,Set(TIMEOUT(response)=10)
    exten => s,5,MixMonitor(/home/asterisk/var/soundpipe.au,av(2))
    exten => s,6,Background(/home/asterisk/sounds/main)

I wrote a small script to loop opening the named pipe and then
copying to "/usr/bin/play" from the sox package.

MixMonitor uses the filename extension to determine what format
to use for the audio data. I tried all of the formats common
to both asterisk ("core show file formats") and play (as described
on the man page), except for "raw". I'm not sure if "raw" is
compatible with sox "play" - I need to determine bit rates and
other parameters before I can try it.

I found that in all cases I tested, there was significant latency
between the audio on the PSTN line vs. the audio played from the
speakers, on the order of 3-10 seconds depending on the format
specified. Based on some debug output from my pipe-reader script,
it seemed that asterisk opened the write end of the pipe immediately
but did not start writing data until the aforementioned delay had
passed. "au" and "sln" had the lowest latency (3 seconds), so I'm
using "au" for now. 

Is there any way to reduce the startup latency and make MixMonitor
write the audio stream to the output file immediately? I looked
briefly at apps/app_mixmonitor.c and main/file.c but I don't fully
understand the code. Is mixmonitor forking an external conversion
process to generate the audio data?

thanks for any insights!
-- 
G. Paul Ziemba
FreeBSD unix:
 9:06AM  up 10 days, 11:05, 4 users, load averages: 1.39, 1.50, 1.54



More information about the asterisk-users mailing list