System() command problems

okay, ignore the gotoif logic from s,33-s,35 as that’s going to be replaced by mp3 conversion logic once i get the system commands working. The complexity of the commands are not the issue, as i’ve been unable to even get System() to copy a single file, or make a simple directory. All of these commands work, flawlessly, from the command prompt, yet when i throw /bin/sh -c infront of them it always gives me an error inregard to too few arguments.

Any help inregards to this would be appreciated as i’m 90% done with this.

also ignore the period infront of the custom sounds files. After repeated testing, i put those there to show that it’s running the command, but skipping the actual playback…saves me about 7minutes each run. the Festival prompts are in place for custom prompts i’ve yet to record, so those will be gone in the final version as well.



exten => s,1,Set(ICOUNT=0)
exten => s,2,Playback(custom/.automated-interview-main)
exten => s,3,Playback(custom/.user-number)
exten => s,4,Set(unum=1234)
exten => s,5,Authenticate(${unum})
exten => s,6,Set(ipass=567890)
exten => s,7,Playback(custom/.please-enter-your-ipassword)
exten => s,8,Authenticate(${ipass})
exten => s,9,Background(thnk-u-for-patience)
exten => s,10,Background(custom/.info-verified)
exten => s,11,Background(custom/.pound-sign)
exten => s,12,Set(idir=${TIMESTAMP})
exten => s,13,Background(custom/.who-dad)
exten => s,14,Record(mymessage:wav)
exten => s,15,AGI(|You said)
exten => s,16,Background(Q1)
exten => s,17,AGI(|Press 1 to continue or 2 to change your message)
exten => s,18,WaitExten(3)
exten => s,19,Playback(custom/.who-wall)
exten => s,20,Record(mymessage:wav)
exten => s,21,AGI(|You said)
exten => s,22,Background(Q2)
exten => s,23,AGI(|Press 1 to continue or 2 to change your message)
exten => s,24,WaitExten(3)
exten => s,25,Playback(custom/.who-grail)
exten => s,26,Record(mymessage:wav)
exten => s,27,AGI(|You said)
exten => s,28,Background(Q3)
exten => s,29,AGI(|Press 1 to continue or 2 to change your message)
exten => s,30,WaitExten(3)
exten => s,31,Playback(custom/.conclude)
exten => s,32,Hangup()
exten => s,33,GotoIf($["${ICOUNT}" = “1”]?18:34)
exten => s,34,GotoIf($["${ICOUNT}" = “2”]?23:35)
exten => s,35,GotoIf($["${ICOUNT}" = “3”]?28:36)
exten => s,36,Goto(s,31)
exten => s,37,GotoIf($["${ICOUNT}" = “1”]?13:38)
exten => s,38,GotoIf($["${ICOUNT}" = “2”]?19:39)
exten => s,39,GotoIf($["${ICOUNT}" = “3”]?25:40)
exten => s,40,Goto(s,31)
exten => t,1,AGI(|Sorry, I did not get that)
exten => t,2,GotoIf($["${ICOUNT}" = “0”]?3:4)
exten => t,3,Goto(s,1)
exten => t,4,Goto(s,37)
exten => i,1,AGI(|Sorry, that is an invalid choice)
exten => i,2,GotoIf($["${ICOUNT}" = “0”]?3:4)
exten => i,3,Goto(s,1)
exten => i,4,Goto(s,37)
exten => 1,1,System(/bin/mkdir -p /usr/local/${unum}/${idir})
exten => 1,2,System(/bin/cp /var/lib/asterisk/sounds/mymessage.wav /usr/local/autolame/in/Q${ICOUNT}${idir}${unum}.wav)
exten => 1,3,SetVar(ICOUNT=$[${ICOUNT} + 1])
exten => 1,4,AGI(|Thank you your recording has been saved)
exten => 1,5,System(/usr/bin/mutt -x -z -s Interview${TIMESTAMP} -a /usr/local/autolame/in/${ICOUNT}${idir}${unum}.wav < .)
exten => 1,6,AGI(|Press 3 to proceed to the next question)
exten => 1,7,WaitExten(3)
exten => 2,1,Goto(s,37)
exten => 3,1,Goto(s,37)

should this be posted in the developer forum?

I think this forum is fine, it is a problem with the dialplan.

I think the problem is that Asterisk is still writing to the file when you try and copy it. Try moving your system commands to a h extension. This way the system commands will run after the call is hung up.