<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Steve Edwards wrote:
<blockquote cite="mid:Pine.LNX.4.64.0910101610090.22765@fs.sedwards.com"
type="cite">
<pre wrap="">On Sat, 10 Oct 2009, Bart Fisher wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap=""><!---->
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.
</pre>
</blockquote>
<br>
hmm, no luck. Here's what I have:<br>
<br>
e<small>xten => append,1,Noop(${PHRASEID}) ; this is the full path
to original message without extension .wav<br>
exten => append,n,Playback(custom/dax/record)<br>
exten =>
append,n,Set(TEMPMESSAGE=/var/lib/asterisk/sounds/custom/${IVR-EXTEN}/temp);this
is the full path to temp message without extension .wav<br>
exten => append,n,Record(${TEMPMESSAGE}:wav|4|369) ; Begin recording
new message<br>
exten => append,n,System(sox ${PHRASEID}.wav ${TEMPMESSAGE}.wav
${PHRASEID}.wav)<br>
exten => append,n,system(rm ${TEMPMESSAGE}.wav)<br>
exten => append,n,Goto(record,${IVR-EXTEN},confirm); go back and
play entire message<br>
<br>
<br>
-- Goto (record,append,1)<br>
-- Executing [append@record:1] NoOp("SIP/8001-0a0227c8",
"/var/lib/asterisk/sounds/custom/7146762004/1_17692") in new stack<br>
-- Executing [append@record:2] Playback("SIP/8001-0a0227c8",
"custom/dax/record") in new stack<br>
-- <SIP/8001-0a0227c8> Playing 'custom/dax/record' (language 'en')<br>
-- Executing [append@record:3] Set("SIP/8001-0a0227c8",
"TEMPMESSAGE=/var/lib/asterisk/sounds/custom/7146762004/temp") in new
stack<br>
-- Executing [append@record:4] Record("SIP/8001-0a0227c8",
"/var/lib/asterisk/sounds/custom/7146762004/temp:wav|4|369") in new
stack<br>
-- <SIP/8001-0a0227c8> Playing 'beep' (language 'en')<br>
-- Executing [append@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<br>
-- Executing [append@record:6] System("SIP/8001-0a0227c8", "rm
/var/lib/asterisk/sounds/custom/7146762004/temp.wav") in new stack<br>
-- Executing [append@record:7] Goto("SIP/8001-0a0227c8",
"record|7146762004|confirm") in new stack<br>
-- Goto (record,7146762004,39)<br>
<br>
Anything wrong?<br>
<br>
Bart<br>
</small>
</body>
</html>