[asterisk-users] Custom Application recording problem

Dale Noll dnoll at wi.rr.com
Tue Apr 17 15:11:20 CDT 2012


Billy,

I really should have had my coffee before answering you previous 
message.  My head was in the wrong place (not saying where) and I sent 
you down the wrong path.

Macro() is not the answer because of the WaitExten().  When WaitExten is 
used in a Macro(), it does not match within the macro, it matches an 
extension within the context where the macro was called.  This is what 
is causing your errors.

What you really should do is use gosub(), not macro().

Here is the recording routine

[sub-timo]
exten => s,1,Set(RecordingType=${ARG1})
exten => s,n,Set(TIMEOUT(digit)=2)             ; Set Digit Timeout to 5 
seconds
exten => s,n,Set(TIMEOUT(response)=2)         ; Set Response Timeout to 
10 seconds
exten => s,n,Answer
exten => s,n,NoOp(${CALLERID(num)})
exten => s,n,Set(number=${CALLERID(num)})
exten => s,n,NoOp(${number})
exten => s,n(recordmsg),Background(recmsg1)   ;"Please say yo message 
after the beep and end with a hash"
exten => 
s,n,Record(/var/www/html/timo/crystalrecords/${RecordingType}/${number}.gsm)
exten => 
s,n(playmsg),Playback(/var/www/html/timo/crystalrecords/${RecordingType}/${number})
exten => s,n(askuser),Background(ackrec)     ;"Press 1 to replay or 2 to 
re-record, 3 to save "
exten => s,11,WaitExten(5)
exten => 1,1,Goto(s,playmsg)
exten => 2,1,Goto(s,recordmsg)  ; re-record message
exten => 3,1,Goto(4,1)
exten => 4,1,AGI($RecordingType}.php)
exten => 4,n,Return()
exten => i,1,Background(invalidentry)
exten => i,n,Goto(s,askuser)
exten => t,1,Playback(thankyoubye)
exten => t,n,Return


I know big change there eh?  Note:  I did make some changes to extension 
4, but that was fix syntax error, not because of the change from macro 
to gosub.


The difference is really how you call it.

exten => 3552,1,Gosub(sub-timo,s,1(contentdb))
exten => 3552,n,Hangup()


Also note.  I have not tested this code.  I have something similar in 
place, but not your specific code.

Oh.  You should be able to remove the 'include => timo' from the
[from-internal-custom] context.


Dale



More information about the asterisk-users mailing list