[asterisk-users] Method to use SOX inside a Dialplan

Steve Edwards asterisk.org at sedwards.com
Sat Oct 10 18:23:46 CDT 2009


On Sat, 10 Oct 2009, Bart Fisher wrote:

> I'm trying create a feature that allows a callers to add more speech to 
> his recording. I think this can be done inside a dialplan, but I can't 
> find an example of how to do this.
>
> Basically,after he records the primary message, a menu would play asking 
> if he wants to append to this message.  If yes, then he would record a 
> temp file with the additional message and when done, I want SOX to add 
> the temp message to the primary message making it one larger message.
>
> Would you mind showing me an example of how to run SOX inside the 
> dialplan?

The system() dialplan application will allow you to run any executable.

If you plan on concatenating more than 32 input files you'll have to make 
sure you have sox v14.3.0 or later.

The dialplan snippet would look something like:

         exten = s,n,system(/path-to-sox/sox a.wav b.wav c.wav)

This would copy a.wav followed by b.wav to a new file, c.wav.

I would code the entire feature up as an AGI so you can hide all the ugly 
details like creating files with unique file names, maybe running 
normalize on the pieces before concatenation, error handling, maybe even 
trimming the leading and trailing silence off each file so the gaps are 
consistent, allowing the caller to listen to the new file and accept or 
re-record the "suffix," cleaning up in case the caller hangs up, etc, etc, 
etc.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list