SoX from System Application


Asterisk 13.18.2

I’m trying to merge the two files (in and out) created with the MONITOR application:

same => n,Monitor(wav,${UNIQUEID},b)

in a stereo file with SoX. I’m using this command:

exten => h,1,System(sox -M -v 0.95 /var/spool/asterisk/monitor/${UNIQUEID}-in.wav -v 0.95 /var/spool/asterisk/monitor/${UNIQUEID}-out.wav /tmp/${UNIQUEID}-stereo.wav)

without success; the result is always a 144 bytes (or 44) output file.

If I use the same command from linux prompt, working fine…

Maybe Asterisk don’t release the two files in the h extension… and sox can’t use them…

Any hint?

Thank you


Can you use MixMonitor?


I can’t use MixMonitor because I’d like have a Stereo file with separate
telephone channels, one left and one right.

With Mixmonitor I have a audio file with mix telephone audio channels.


Then instead of trying to run the mix command in your h extension I’d recommend setting a MONITOR_EXEC variable.

MONITOR_EXEC is not the solution because I need the stereo file with
each channel separated:

example: channel in on the left ear and channel out on the right ear

Thank you.


I think there is some kind of restriction at the asterisk level because
if I use sox from command line or bash script no problem.

Any help is appreciated.


MONITOR_EXEC allows you to specify what command to run after the file is closed, you can run your sox command via monitor exec.

1 Like

Working with:

MONITOR_EXEC=/usr/bin/sox -M

Thank you very much!!!


1 Like