[asterisk-users] Custom Application recording problem

Dale Noll dnoll at wi.rr.com
Tue Apr 17 05:56:11 CDT 2012


On 04/16/2012 04:09 PM, Billy Kaye wrote:
> Thanks Dale,
>
> Am not sure why it was working in 1.4 but for some reason it was ( 
> Note : My Asterisk is running bundled with Elastix).
> But any your suggestion worked very fine.
>

Glad to hear it.

> Now am having one problem how can define those extensions only with in 
> different contexts, the problem I see is since am
> Building 3 recording applications only one will be able call its AGI file,
>
> Say if someone calls custom extension 1114
> They can record message
> -Press 1 to Replay Press 2 to Re-record or Press 3 to Save the file
>
> Also if someone calls custom extension 1115
> -Press 1 to Replay Press 2 to Re-record or Press 3 to Save the file
>
> Note Each save file selection calls a different AGI file
>
> E.g
>
> exten => 1,1,Goto,timo|3552|9
> exten => 2,1,Goto(3552,7) ; re-record message
> exten => 3,1,Goto(4,1)
> exten => 4,AGI(timorec.php)
>

There a few ways to do it.  Probably the easiest to maintain in the long 
run would be via the use of a macro.

[macro-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(crystalrecords/${RecordingType}/${number}.gsm)
exten => s,n(playmsg),Playback(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,AGI($RecordingType}.php)

exten => i,1,Background(invalidentry)
exten => i,n,Goto(s,askuser)

exten => t,1,Playback(thankyoubye)
exten => t,n,Return

Here I have taken you original dialplan and created a macro out of it.  
I made a few other changes such as using the 'n' priority and labels to 
make the macro easier to maintain later.
This macro takes an argument which would be the recording type.  I do 
not know what the three variations you need are, but that is not really 
relevant.  When the macro is called, it will save the argument as a 
variable 'RecordingType' which is used elsewhere.  It saves the 
recording under a subdirectory of 'crystalrecords' that is the same name 
as the recording type.  When saving the message, it also calls the AGI 
as RecordingType.php, so simply name the script the same as the 
recording type.

Then, in your dialplan  you simply make calls to your macro with the 
correct argument.

[from-internal-custom]

exten => 1114,1,Macro(timo,type1)
exten => 1114,n,Hangup()

exten => 1115,1,Macro(timo,type2)
exten => 1115,n,Hangup()

exten => 1116,1,Macro(timo,type3)
exten => 1116,n,Hangup()



Dale

-- 
"The truth speaks for itself. I'm just the messenger."
      Lyta Alexander - Babylon 5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120417/80317a6a/attachment.htm>


More information about the asterisk-users mailing list