Steve Edwards wrote:
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.


hmm, no luck.  Here's what I have:

exten => append,1,Noop(${PHRASEID}) ; this is the full path to original message without extension .wav
exten => append,n,Playback(custom/dax/record)
exten => append,n,Set(TEMPMESSAGE=/var/lib/asterisk/sounds/custom/${IVR-EXTEN}/temp);this is the full path to temp message without extension .wav exten => append,n,Record(${TEMPMESSAGE}:wav|4|369) ; Begin recording new message exten => append,n,System(sox ${PHRASEID}.wav ${TEMPMESSAGE}.wav ${PHRASEID}.wav)
exten => append,n,system(rm ${TEMPMESSAGE}.wav)
exten => append,n,Goto(record,${IVR-EXTEN},confirm); go back and play entire message


-- Goto (record,append,1)
-- Executing [app...@record:1] NoOp("SIP/8001-0a0227c8", "/var/lib/asterisk/sounds/custom/7146762004/1_17692") in new stack -- Executing [app...@record:2] Playback("SIP/8001-0a0227c8", "custom/dax/record") in new stack
-- <SIP/8001-0a0227c8> Playing 'custom/dax/record' (language 'en')
-- Executing [app...@record:3] Set("SIP/8001-0a0227c8", "TEMPMESSAGE=/var/lib/asterisk/sounds/custom/7146762004/temp") in new stack -- Executing [app...@record:4] Record("SIP/8001-0a0227c8", "/var/lib/asterisk/sounds/custom/7146762004/temp:wav|4|369") in new stack
-- <SIP/8001-0a0227c8> Playing 'beep' (language 'en')
-- Executing [app...@record:5] System("SIP/8001-0a0227c8", "sox /var/lib/asterisk/sounds/custom/7146762004/1_17692.wav /var/lib/asterisk/sounds/custom/7146762004/temp.wav /var/lib/asterisk/sounds/custom/7146762004/1_17692.wav") in new stack -- Executing [app...@record:6] System("SIP/8001-0a0227c8", "rm /var/lib/asterisk/sounds/custom/7146762004/temp.wav") in new stack -- Executing [app...@record:7] Goto("SIP/8001-0a0227c8", "record|7146762004|confirm") in new stack
-- Goto (record,7146762004,39)

Anything wrong?

Bart

<<attachment: bhfisher.vcf>>

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to