First off, LOVE the new feature code idea for updating system recordings. Before upgrading to 2.5.1 we had to implement a hack to do this.
However, with the new feature code method of updating a recording, it seems that once the recording is made…it is live! Which means there is a potential chance that a customer calling in could get blasted by a sneeze, or hear someone in the background swearing about something before a new recording can be made.
We use the old hacked method to allow “Network Status Messages” to be recorded by whomever is on duty in the event of a network issue. They dial, for example, 8989 to enter the IVR and when the current status message plays, they hit 99 and then a password, at which time they are prompted to record the new message.
The code looks something like this:
exten => s,1,NoOp(IVR recording test)
exten => s,2,Answer()
exten => s,3,Authenticate(463825)
exten => s,4,Background(say-temp-msg-prs-pound)
exten => s,5,Record(/var/lib/asterisk/sounds/custom/tempcustommessage.gsm)
exten => s,6,Background(to-listen-to-it&press-1)
exten => s,7,Background(to-accept-recording&press-2)
exten => s,8,Background(to-rerecord-announce&digits/3)
exten => s,9,Wait(6)
exten => 1,1,Playback(/var/lib/asterisk/sounds/custom/tempcustommessage)
exten => 1,2,Goto(s,6)
exten => 2,1,System(cp /var/lib/asterisk/sounds/custom/tempcustommessage.gsm /var/lib/asterisk/sounds/custom/Network-Status.gsm)
exten => 2,2,Playback(auth-thankyou)
exten => 2,3,Goto(IVR-6,s,1)
exten => 3,1,Goto(s,4)
We have to manually find “IVR-6” for the IVR that the message is to be attached to, and create a Custom Destination, and a few other things that I can’t remember off the top of my head.
But, after recording, the user is given the option to review the message, accept the message, or re-record the message. The nice part is, during this time, the current message is still being used. If there’s some background noise or other sort of blooper, no big deal. Unless you actually accept the recording, the new one will never be used.
I’ve modified the macro to use temporary files during the recording and review process. I put my version of macro-systemrecording in extensions_override_freepbx.conf. I tried putting [macro-systemrecording-custom] in extensions_custom.conf, but the system didn’t seem to recognize it. Overriding it entirely seems to work.
Here is my modified version. It’s a bit clunky, but it seems to work for creating system recording through the web interface, and updating system recordings using the new feature code method. Haven’t fully tested it in production yet, but my demo box hasn’t complained yet.
[macro-systemrecording]
exten => s,1,NoOp( "Enter macro-systemrecording override ARG1: ${ARG1} ARG2: ${ARG2} ARG3: ${ARG3} MYRECFILE: ${MYRECFILE}" )
exten => s,n,ExecIf($["${ARG3}" != ""],Authenticate,${ARG3})
exten => s,n,Set(MYRECFILE=${IF($["${ARG2}" = ""]?/tmp/${AMPUSER}-ivrrecording:${ASTVARLIBDIR}/sounds/${ARG2})})
exten => s,n,Set(MYTMPRECFILE=${IF($["${ARG2}" = ""]?/tmp/${AMPUSER}-ivrrecording-tmp:${ASTVARLIBDIR}/sounds/${ARG2}-tmp)})
exten => s,n,NoOp( "Variables set for macro-systemrecording override ARG1: ${ARG1} ARG2: ${ARG2} ARG3: ${ARG3} MYRECFILE: ${MYRECFILE} MYTMPRECFILE: ${MYTMPRECFILE}" )
exten => s,n,NoOp( "copy ${MYRECFILE} to ${MYTMPRECFILE}" )
exten => s,n,System(cp ${MYRECFILE}.wav ${MYTMPRECFILE}.wav)
exten => s,n,NoOp( "SYSTEMSTATUS returned: ${SYSTEMSTATUS}" )
exten => s,n,Goto(${ARG1},1)
exten => dorecord,1,NoOp( "Start recording to ${MYTMPRECFILE}" )
exten => dorecord,n,Background(say-temp-msg-prs-pound)
exten => dorecord,n,Record(${MYTMPRECFILE}:wav)
exten => dorecord,n,Wait(1)
exten => dorecord,n,Goto(confmenu,1)
exten => docheck,1,NoOp( "Check recording of ${MYTMPRECFILE}" )
exten => docheck,n,Playback(beep)
exten => docheck,n(dc_start),Background(${MYTMPRECFILE},m,${LANGUAGE},macro-systemrecording)
exten => docheck,n,Wait(1)
exten => docheck,n,Goto(confmenu,1)
exten => doaccept,1,NoOp( "copy ${MYTMPRECFILE} to ${MYRECFILE}" )
exten => doaccept,n,System(cp ${MYTMPRECFILE}.wav ${MYRECFILE}.wav)
exten => doaccept,n,NoOp( "SYSTEMSTATUS returned: ${SYSTEMSTATUS}" )
exten => doaccept,n,Playback(auth-thankyou)
exten => doaccept,n,Wait(1)
exten => doaccept,n,Hangup
exten => confmenu,1,Background(to-listen-to-it&press-1&to-accept-recording&press-2&to-rerecord-it&press-3,m,${LANGUAGE},macro-systemrecording)
exten => confmenu,n,Read(RECRESULT,,1,,,4)
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x3"]?dorecord,1)
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x1"]?docheck,dc_start)
exten => confmenu,n,GotoIf($["x${RECRESULT}"="x2"]?doaccept,1)
exten => confmenu,n,Goto(1)
exten => 1,1,Goto(docheck,dc_start)
exten => 3,1,Goto(dorecord,1)
exten => t,1,Playback(goodbye)
exten => t,n,Hangup
exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(confmenu,1)
exten => h,1,Hangup
; end of [macro-systemrecording]
One thing I’ve noticed is that when confmenu is called, sometimes you have to wait until all the options are spoken before pressing a key, and sometimes it will accept a keypress right away. Not sure why that is.
Now, I can set the feature code and a password for the message(s) that need to be updated, let the appropriate people know, and they can update it themselves. Adding new messages to the mix is so much easier now, too. It can be done entirely through the web interface.
If anyone can see a way to tighten this up, feel free to comment.
DionV