Dial Plan Help: Prompting people to record their VM greeting...

aaelghat

Member
Joined
Dec 4, 2007
Messages
40
Reaction score
0
I know there's a feature where if the extension and VM password are the same, you can have Asterisk guide people through a set-up process, but for various reasons I don't want to use that. I only care about them recording their unavail greeting. Is there some easy way I can have people call into a number, have a prompt for extension and password, and then have them record their greeting without setting the password the same?

I actually do have some code (below), and it works, except if the ID and password don't match it will re-prompt for the password, but won't prompt for the invitation number. So if the invitation number was mistyped, your only choice is to call back.

Any thoughts on the best way of accomplishing what I'd like to do? Thanks in advance.



Code:
[custom-voicemail-newuser]
;this code if for demonstration purposes.
exten => s,1,answer()
exten => s,2,Set(vmnu_dstdir=/var/spool/asterisk/voicemail/default)

;Ask the caller for their mailbox number
exten => s,3,Playback(custom/Welcome-to-LOR)
exten => s,4,read(vmnu_mbx,custom/please-enter-LOR-invitation-number)

;Check the users destination box for existing greeting files.
;Remove any temporary .wav files that might exist if the caller aborted early
exten => s,5,System(rm ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav)
exten => s,6,System(ls ${vmnu_dstdir}/${vmnu_mbx}/ | grep wav)

;If there was existing greeting files, this means its an existing
;user and they can go straight to their mailbox (s,8 - s,10)
exten => s,7,GotoIf($["${SYSTEMSTATUS}" = "SUCCESS"]?20:20)
;exten => s,8,Macro(get-vmcontext,${vmnu_mbx})
;exten => s,9,VoiceMailMain(${vmnu_mbx}@${VMCONTEXT})
;exten => s,10,Macro(hangupcall,)

;S,20 verifies the password to the usersmail box
exten => s,20,VMAuthenticate(${vmnu_mbx})

;we tell the user that we are going to step them through a vm process
;exten => s,21,Playback(vm-newuser)
;creates the actual voicemailbox folder
;exten => s,22,System(mkdir ${vmnu_dstdir}/${vmnu_mbx})

;The sections s,23 - s,31 simply set variables for a GOSUB routine.
;It allows the user to be prompted for their NAME, BUSY MESSAGE and UNAVIALABLE MESSAGE
;if you don't want to force the entry of all of them, just change
;the GOSBUB to NoOp and that will bypass the question

exten => s,21,Set(vmnu_msgtype=greet)
exten => s,22,Set(vmnu_msgprmpt=vm-rec-name)
exten => s,23,NoOp(vmnurecord)

exten => s,24,Set(vmnu_msgtype=unavail)
exten => s,25,Set(vmnu_msgprmpt=vm-rec-unv)
exten => s,26,Gosub(vmnurecord)

exten => s,27,Set(vmnu_msgtype=busy)
exten => s,28,Set(vmnu_msgprmpt=vm-rec-busy)
exten => s,29,NoOp(vmnurecord)

;Once all questions are asked, the system puts them into their voicemailbox

;exten => s,30,VoiceMailMain(${vmnu_mbx}@default|s)
exten => s,30,Playback(vm-goodbye)
exten => s,31,Hangup()

;this code prompts and records for each greeting.
exten => s,40(vmnurecord),Playback(${vmnu_msgprmpt})
exten => s,41,Record(${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg:wav)
exten => s,42,System(chmod +x ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav)
;exten => s,43,Background(vm-youhave&recorded)
exten => s,43,System(sox ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg-copy.wav
exten => s,44,System(sox ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg-copy.wav ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav compand 0.3\,1 6:-70\,-60\,-20 -5 -90 0.2 vad reverse vad reverse)

exten => s,45,Playback(${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg)
exten => s,46,Playback(to-accept-recording)
exten => s,47,Playback(1-yes-2-no)
exten => s,48,read(vmnu_yesno||1)
exten => s,49,Gotoif($["${vmnu_yesno}" = "1"]?51:40
exten => s,50,Goto(s,40) ;just in case they manage to go past the gotoif, forces them to re-record
exten => s,51,System(mv ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.wav)
exten => s,52,System(cp ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.wav ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.WAV)
exten => s,53,Playback(your-msg-has-been-saved)
;exten => s,54,Playback(auth-thankyou)
exten => s,55,Return
 

Members online

Forum statistics

Threads
26,688
Messages
174,412
Members
20,259
Latest member
Fadeek86
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top