<HTML>
<HEAD>
<TITLE>Re: [asterisk-users] Custom Application recording problem</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Greetings Dale,<BR>
<BR>
Thanks for the help I have updated my file to include the macro sample you gave me.<BR>
The system can make the recordings once I daily the required extension in this case 3552<BR>
<B>--- config section for 3552 -----<BR>
</B>exten => 3552,1,Macro(timo,contentdb)<BR>
exten => 3552,n,Hangup()<BR>
<BR>
<B>---Below is the macro section ------<BR>
</B>[macro-timo]<BR>
exten => s,1,Set(RecordingType=${ARG1})<BR>
exten => s,n,Set(TIMEOUT(digit)=2) ; Set Digit Timeout to 5 seconds<BR>
exten => s,n,Set(TIMEOUT(response)=2) ; Set Response Timeout to 10 seconds<BR>
exten => s,n,Answer<BR>
exten => s,n,NoOp(${CALLERID(num)})<BR>
exten => s,n,Set(number=${CALLERID(num)})<BR>
exten => s,n,NoOp(${number})<BR>
exten => s,n(recordmsg),Background(recmsg1) ;"Please say yo message after the beep and end with a hash" <BR>
exten => s,n,Record(/var/www/html/timo/crystalrecords/${RecordingType}/${number}.gsm)<BR>
exten => s,n(playmsg),Playback(/var/www/html/timo/crystalrecords/${RecordingType}/${number})<BR>
exten => s,n(askuser),Background(ackrec) ;"Press 1 to replay or 2 to re-record, 3 to save "<BR>
exten => s,11,WaitExten(5)<BR>
exten => 1,1,Goto(s,playmsg)<BR>
exten => 2,1,Goto(s,recordmsg) ; re-record message<BR>
exten => 3,1,Goto(4,1)<BR>
exten => 4,AGI($RecordingType}.php)<BR>
exten => i,1,Background(invalidentry)<BR>
exten => i,n,Goto(s,askuser)<BR>
exten => t,1,Playback(thankyoubye)<BR>
exten => t,n,Return<BR>
<BR>
--------<BR>
The system does not seem to recognize the buttons that I press e.g. when I presssed 1 it gave this error<BR>
<BR>
-- Invalid extension '1' in context 'from-internal' on SIP/261-0000005c<BR>
== CDR updated on SIP/261-0000005c<BR>
-- Executing [i@from-internal:1] BackGround("SIP/261-0000005c", "invalidentry") in new stack<BR>
-- <SIP/261-0000005c> Playing 'invalidentry.slin' (language 'en')<BR>
<BR>
The detailed error log is further below<BR>
<BR>
--------<BR>
Also one thing I have seen from the logs after giving the invalidentry error it moves to another section in my<BR>
extensions_custom.conf called rsvp.<BR>
--------<BR>
<B><BR>
-------------Below is the full extensions_custom.conf file ---------------<BR>
</B>[from-internal-custom] <BR>
exten => 1234,1,Playback(demo-congrats) ; extensions can dial 1234<BR>
exten => 1234,2,Hangup()<BR>
exten => h,1,Hangup()<BR>
include => agentlogin<BR>
include => conferences<BR>
include => calendar-event<BR>
include => weather-wakeup<BR>
include => timo<BR>
include => rsvp<BR>
<BR>
exten => 3789,1,AGI(voicesms.php)<BR>
<BR>
exten => 3552,1,Macro(timo,contentdb)<BR>
exten => 3552,n,Hangup()<BR>
<BR>
[agentlogin]<BR>
exten => _*8888.,1,Set(AGENTNUMBER=${EXTEN:5})<BR>
exten => _*8888.,n,NoOp(AgentNumber is ${AGENTNUMBER})<BR>
exten => _*8888.,n,AgentLogin(${AGENTNUMBER})<BR>
exten => _*8888.,n,Hangup()<BR>
<BR>
<BR>
[mm-announce]<BR>
exten => 9999,1,Set(CALLERID(name)="MMGETOUT")<BR>
exten => 9999,n,Answer<BR>
exten => 9999,n,Playback(conf-will-end-in)<BR>
exten => 9999,n,Playback(digits/5)<BR>
exten => 9999,n,Playback(minutes)<BR>
exten => 9999,n,Hangup<BR>
<BR>
[conferences]<BR>
;Used by cbEnd script to play end of conference warning<BR>
exten => 5555,1,Answer<BR>
exten => 5555,n,Wait(3)<BR>
exten => 5555,n,CBMysql()<BR>
exten => 5555,n,Hangup<BR>
<BR>
[calendar-event]<BR>
exten => _*7899,1,Answer <BR>
exten => _*7899,2,Playback(${FILE_CALL})<BR>
exten => _*7899,3,Wait(2) <BR>
exten => _*7899,4,Hangup()<BR>
<BR>
[weather-wakeup]<BR>
exten => *61,1,Answer <BR>
exten => *61,2,AGI(nv-weather.php) <BR>
exten => *61,3,Hangup <BR>
<BR>
<BR>
<BR>
[rsvp]<BR>
exten=> 3589,1,Background(thanks)<BR>
exten=> 3589,2,Read(choice,,1) <BR>
exten => 3589,3,AGI(rsvp.php|${choice})<BR>
exten => i,1,Background(invalidentry)<BR>
exten => i,n,Goto(3589,2)<BR>
exten => t,1,Playback(thankyoubye)<BR>
exten => t,n,Hangup<BR>
<BR>
exten => *62,1,Answer <BR>
exten => *62,2,AGI(wakeup.php) <BR>
exten => *62,3,Hangup <BR>
<BR>
[macro-timo]<BR>
exten => s,1,Set(RecordingType=${ARG1})<BR>
exten => s,n,Set(TIMEOUT(digit)=2) ; Set Digit Timeout to 5 seconds<BR>
exten => s,n,Set(TIMEOUT(response)=2) ; Set Response Timeout to 10 seconds<BR>
exten => s,n,Answer<BR>
exten => s,n,NoOp(${CALLERID(num)})<BR>
exten => s,n,Set(number=${CALLERID(num)})<BR>
exten => s,n,NoOp(${number})<BR>
exten => s,n(recordmsg),Background(recmsg1) ;"Please say yo message after the beep and end with a hash" <BR>
exten => s,n,Record(/var/www/html/timo/crystalrecords/${RecordingType}/${number}.gsm)<BR>
exten => s,n(playmsg),Playback(/var/www/html/timo/crystalrecords/${RecordingType}/${number})<BR>
exten => s,n(askuser),Background(ackrec) ;"Press 1 to replay or 2 to re-record, 3 to save "<BR>
exten => s,11,WaitExten(5)<BR>
exten => 1,1,Goto(s,playmsg)<BR>
exten => 2,1,Goto(s,recordmsg) ; re-record message<BR>
exten => 3,1,Goto(4,1)<BR>
exten => 4,AGI($RecordingType}.php)<BR>
exten => i,1,Background(invalidentry)<BR>
exten => i,n,Goto(s,askuser)<BR>
exten => t,1,Playback(thankyoubye)<BR>
exten => t,n,Return<BR>
<BR>
<B>----------Below is the full output from my logs when I call 3552---------<BR>
</B>-- Executing [3552@from-internal:1] Macro("SIP/261-0000005c", "timo,contentdb") in new stack<BR>
-- Executing [s@macro-timo:1] Set("SIP/261-0000005c", "RecordingType=contentdb") in new stack<BR>
-- Executing [s@macro-timo:2] Set("SIP/261-0000005c", "TIMEOUT(digit)=2") in new stack<BR>
-- Digit timeout set to 2.000<BR>
-- Executing [s@macro-timo:3] Set("SIP/261-0000005c", "TIMEOUT(response)=2") in new stack<BR>
-- Response timeout set to 2.000<BR>
-- Executing [s@macro-timo:4] Answer("SIP/261-0000005c", "") in new stack<BR>
-- Executing [s@macro-timo:5] NoOp("SIP/261-0000005c", "261") in new stack<BR>
-- Executing [s@macro-timo:6] Set("SIP/261-0000005c", "number=261") in new stack<BR>
-- Executing [s@macro-timo:7] NoOp("SIP/261-0000005c", "261") in new stack<BR>
-- Executing [s@macro-timo:8] BackGround("SIP/261-0000005c", "recmsg1") in new stack<BR>
-- <SIP/261-0000005c> Playing 'recmsg1.gsm' (language 'en')<BR>
-- Executing [s@macro-timo:9] Record("SIP/261-0000005c", "/var/www/html/timo/crystalrecords/contentdb/261.gsm") in new stack<BR>
-- <SIP/261-0000005c> Playing 'beep.gsm' (language 'en')<BR>
-- Executing [s@macro-timo:10] Playback("SIP/261-0000005c", "/var/www/html/timo/crystalrecords/contentdb/261") in new stack<BR>
-- <SIP/261-0000005c> Playing '/var/www/html/timo/crystalrecords/contentdb/261.gsm' (language 'en')<BR>
-- Executing [s@macro-timo:11] BackGround("SIP/261-0000005c", "ackrec") in new stack<BR>
-- <SIP/261-0000005c> Playing 'ackrec.gsm' (language 'en')<BR>
-- Invalid extension '1' in context 'from-internal' on SIP/261-0000005c<BR>
== CDR updated on SIP/261-0000005c<BR>
-- Executing [i@from-internal:1] BackGround("SIP/261-0000005c", "invalidentry") in new stack<BR>
-- <SIP/261-0000005c> Playing 'invalidentry.slin' (language 'en')<BR>
-- Executing [i@from-internal:2] Goto("SIP/261-0000005c", "3589,2") in new stack<BR>
-- Goto (from-internal,3589,2)<BR>
-- Executing [3589@from-internal:2] Read("SIP/261-0000005c", "choice,,1") in new stack<BR>
-- Accepting a maximum of 1 digits.<BR>
-- User entered nothing.<BR>
-- Executing [3589@from-internal:3] AGI("SIP/261-0000005c", "rsvp.php|") in new stack<BR>
-- Executing [3589@from-internal:4] Wait("SIP/261-0000005c", "1") in new stack<BR>
-- Executing [3589@from-internal:5] Playback("SIP/261-0000005c", "silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer") in new stack<BR>
-- <SIP/261-0000005c> Playing 'silence/1.gsm' (language 'en')<BR>
-- <SIP/261-0000005c> Playing 'cannot-complete-as-dialed.gsm' (language 'en')<BR>
-- <SIP/261-0000005c> Playing 'check-number-dial-again.gsm' (language 'en')<BR>
-- Executing [3589@from-internal:6] Wait("SIP/261-0000005c", "1") in new stack<BR>
-- Executing [3589@from-internal:7] Congestion("SIP/261-0000005c", "20") in new stack<BR>
== Spawn extension (from-internal, 3589, 7) exited non-zero on 'SIP/261-0000005c'<BR>
-- Executing [h@from-internal:1] Macro("SIP/261-0000005c", "hangupcall") in new stack<BR>
-- Executing [s@macro-hangupcall:1] GotoIf("SIP/261-0000005c", "1?noautomon") in new stack<BR>
-- Goto (macro-hangupcall,s,3)<BR>
-- Executing [s@macro-hangupcall:3] NoOp("SIP/261-0000005c", "TOUCH_MONITOR_OUTPUT=") in new stack<BR>
-- Executing [s@macro-hangupcall:4] GotoIf("SIP/261-0000005c", "1?noautomon2") in new stack<BR>
-- Goto (macro-hangupcall,s,6)<BR>
-- Executing [s@macro-hangupcall:6] NoOp("SIP/261-0000005c", "MONITOR_FILENAME=") in new stack<BR>
-- Executing [s@macro-hangupcall:7] GotoIf("SIP/261-0000005c", "1?skiprg") in new stack<BR>
-- Goto (macro-hangupcall,s,10)<BR>
-- Executing [s@macro-hangupcall:10] GotoIf("SIP/261-0000005c", "1?skipblkvm") in new stack<BR>
-- Goto (macro-hangupcall,s,13)<BR>
-- Executing [s@macro-hangupcall:13] GotoIf("SIP/261-0000005c", "1?theend") in new stack<BR>
-- Goto (macro-hangupcall,s,15)<BR>
-- Executing [s@macro-hangupcall:15] Hangup("SIP/261-0000005c", "") in new stack<BR>
== Spawn extension (macro-hangupcall, s, 15) exited non-zero on 'SIP/261-0000005c' in macro 'hangupcall'<BR>
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/261-0000005c'<BR>
<BR>
-----<BR>
<BR>
Kind Regards <BR>
<BR>
Billy <BR>
<BR>
<BR>
On 4/17/12 1:56 PM, "Dale Noll" <dnoll@wi.rr.com> wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> On 04/16/2012 04:09 PM, Billy Kaye wrote: <BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> Re: [asterisk-users] Custom Application recording problem Thanks Dale,<BR>
<BR>
Am not sure why it was working in 1.4 but for some reason it was ( Note : My Asterisk is running bundled with Elastix).<BR>
But any your suggestion worked very fine.<BR>
<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> <BR>
Glad to hear it.<BR>
<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> Now am having one problem how can define those extensions only with in different contexts, the problem I see is since am <BR>
Building 3 recording applications only one will be able call its AGI file,<BR>
<BR>
Say if someone calls custom extension 1114<BR>
They can record message <BR>
-Press 1 to Replay Press 2 to Re-record or Press 3 to Save the file<BR>
<BR>
Also if someone calls custom extension 1115<BR>
-Press 1 to Replay Press 2 to Re-record or Press 3 to Save the file<BR>
<BR>
Note Each save file selection calls a different AGI file <BR>
<BR>
E.g<BR>
<BR>
exten => 1,1,Goto,timo|3552|9<BR>
exten => 2,1,Goto(3552,7) ; re-record message<BR>
exten => 3,1,Goto(4,1)<BR>
exten => 4,AGI(timorec.php)<BR>
<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> <BR>
There a few ways to do it. Probably the easiest to maintain in the long run would be via the use of a macro.<BR>
<BR>
[macro-timo]<BR>
exten => s,1,Set(RecordingType=${ARG1})<BR>
exten => s,n,Set(TIMEOUT(digit)=2) ; Set Digit Timeout to 5 seconds<BR>
exten => s,n,Set(TIMEOUT(response)=2) ; Set Response Timeout to 10 seconds<BR>
exten => s,n,Answer<BR>
exten => s,n,NoOp(${CALLERID(num)})<BR>
exten => s,n,Set(number=${CALLERID(num)})<BR>
exten => s,n,NoOp(${number})<BR>
exten => s,n(recordmsg),Background(recmsg1) ;"Please say yo message after the beep and end with a hash" <BR>
exten => s,n,Record(crystalrecords/${RecordingType}/${number}.gsm)<BR>
exten => s,n(playmsg),Playback(crystalrecords/${RecordingType}/${number})<BR>
exten => s,n(askuser),Background(ackrec) ;"Press 1 to replay or 2 to re-record, 3 to save "<BR>
exten => s,11,WaitExten(5)<BR>
<BR>
exten => 1,1,Goto(s,playmsg)<BR>
exten => 2,1,Goto(s,recordmsg) ; re-record message<BR>
exten => 3,1,Goto(4,1)<BR>
exten => 4,AGI($RecordingType}.php)<BR>
<BR>
exten => i,1,Background(invalidentry)<BR>
exten => i,n,Goto(s,askuser)<BR>
<BR>
exten => t,1,Playback(thankyoubye)<BR>
exten => t,n,Return<BR>
<BR>
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.<BR>
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.<BR>
<BR>
Then, in your dialplan you simply make calls to your macro with the correct argument.<BR>
<BR>
[from-internal-custom]<BR>
<BR>
exten => 1114,1,Macro(timo,type1)<BR>
exten => 1114,n,Hangup()<BR>
<BR>
exten => 1115,1,Macro(timo,type2)<BR>
exten => 1115,n,Hangup()<BR>
<BR>
exten => 1116,1,Macro(timo,type3)<BR>
exten => 1116,n,Hangup()<BR>
<BR>
<BR>
<BR>
Dale<BR>
<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>