Voicemail "auto-attendant"
not that i'm aware of, i used to sell macrovoice voicemails and thats exactly what their voicemail did upon the first call to your own voicemail.
doesn't that bug you when you install a system for someone and show them how to use it and a year goes by and they haven't even recorded a voicemail greeting.
Ok, here's the code that will force new users to enter in their voicemail prompts upon logging into their voicemail box for the first time. Sorry wasn't sooner, I didn't really get a chance to really look at it till last night. Better late than never! :)
The script asks for the users mailbox number, checks to see if its a new user.
If it is, they are asked to enter in their Name and Busy/Unavailable messages.
Once successful, they are sent to their mailbox.
I've tested it, but please test yourself.
This would be a nice feature request someone could place with FreePBX developers or Digium.
INSTALLATION
Here's how you can test to see if it will work for you
Open /etc/asterisk/extension_custom.conf
Paste the code below (everything below the =========== symbols)
Save and exit
In freePBX, you'll need to point to this context.
You can do it from a
ringgroup, IVR or Inbound route for example.
Simply select a "CUSTOM" destination in FreePBX and in the box put in:
custom-voicemail-newuser,s,1
Save your changes and click on the RELOAD bar in FreePBX.
Call the number you assigned. You should be prompted for a voicemail box.
Test and let me know.
TESTING PROCESS:
Create a new extension in FreePBX and assign it a mailbox.
Call the above script, enter in that new mailbox and try it.
Also call an existing mailbox.
IMPLEMENTATION
If you want to implement to work with *98 / *99 / *97 i would disable them in the feature codes in FreePBX.
Then, in extension.conf, scroll down to the context
[from-internal-xfer]
underneath that, put in:
include => custom-voicemail-newuser
save the changes and exit
Add the following line directly under [custom-voicemail-newuser] in _custom.conf
exten => *98,1,Goto(custom-voicemail-newuser,s,1)
Now when your users dial *98 they will execute the script automatically.
==============================
[custom-voicemail-newuser]
;this code if for demonstration purposes.
exten => s,1,answer()
exten => s,2,SetVar(vmnu_dstdir=/var/spool/asterisk/voicemail/default)
;Ask the caller for their mailbox number
exten => s,3,read(vmnu_mbx,vm-login)
;Check the users destination box for existing greeting files.
;Remove any temporary .wav files that might exist if the caller aborted early
exten => s,4,System(rm ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav)
exten => s,5,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,7 - s,9)
exten => s,6,GotoIf($["${SYSTEMSTATUS}" = "SUCCESS"]?7:20)
exten => s,7,Macro(get-vmcontext,${vmnu_mbx})
exten => s,8,VoiceMailMain(${vmnu_mbx}@${VMCONTEXT})
exten => s,9,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,23,SetVar(vmnu_msgtype=greet)
exten => s,24,SetVar(vmnu_msgprmpt=vm-rec-name)
exten => s,25,Gosub(vmnurecord)
exten => s,26,SetVar(vmnu_msgtype=unavail)
exten => s,27,SetVar(vmnu_msgprmpt=vm-rec-unv)
exten => s,28,Gosub(vmnurecord)
exten => s,29,SetVar(vmnu_msgtype=busy)
exten => s,30,SetVar(vmnu_msgprmpt=vm-rec-busy)
exten => s,31,Gosub(vmnurecord)
;Once all questions are asked, the system puts them into their voicemailbox
exten => s,32,VoiceMailMain(${vmnu_mbx}@default|s)
exten => s,33,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,44,Playback(${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg)
exten => s,45,Playback(to-accept-recording)
exten => s,46,Playback(1-yes-2-no)
exten => s,47,read(vmnu_yesno||1)
exten => s,48,Gotoif($["${vmnu_yesno}" = "1"]?50:40
exten => s,49,Goto(s,40) ;just in case they manage to go past the gotoif, forces them to re-record
exten => s,50,System(mv ${vmnu_dstdir}/${vmnu_mbx}/vmnu_tmpmsg.wav ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.wav)
exten => s,51,System(cp ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.wav ${vmnu_dstdir}/${vmnu_mbx}/${vmnu_msgtype}.WAV)
exten => s,52,Return
FreePBX in the VM Setup, you can set the VM Password the same as the extension number, and then in VM Options, type this: forcename=yes|forcegreetings=yes
Having the VM Password the same as the extension forces the system to make the user change their password, record their name and both greetings. I have used it for a long time. Works great.
Make sure they choose a different password. If they reuse the same, it will repeat the setup.
Dickson, even though there's a feature in Trixbox similar to what your script does, I prefer your script because I only want the user to be prompted for their unavailable greeting. However, when I install the script and call the IVR, I hear a message that says, "Your call was not accepted". The CLI log is below. Any ideas what I can do to rectify?
-- Executing [800340XXXX@from-trunk:1] Set("SIP/xxxxx-xxxxxxxxx", "__FROM_DID=800340XXXX") in new stack
-- Executing [800340XXXX@from-trunk:2] Gosub("SIP/xxxxx-xxxxxxxxx", "cidlookup|cidlookup_1|1") in new stack
-- Executing [cidlookup_1@cidlookup:1] Set("SIP/xxxxx-xxxxxxxxx", "CALLERID(name)=Unknown Caller") in new stack
-- Executing [cidlookup_1@cidlookup:2] Return("SIP/xxxxx-xxxxxxxxx", "") in new stack
-- Executing [800340XXXX@from-trunk:3] GotoIf("SIP/xxxxx-xxxxxxxxx", "1 ?cidok") in new stack
-- Goto (from-trunk,800340XXXX,5)
-- Executing [800340XXXX@from-trunk:5] NoOp("SIP/xxxxx-xxxxxxxxx", "CallerID is "Unknown Caller" <8472712266>") in new stack
-- Executing [800340XXXX@from-trunk:6] Set("SIP/xxxxx-xxxxxxxxx", "FAX_RX=disabled") in new stack
-- Executing [800340XXXX@from-trunk:7] Goto("SIP/xxxxx-xxxxxxxxx", "custom-voicemail-newuser|s|1") in new stack
-- Goto (custom-voicemail-newuser,s,1)
-- Executing [s@custom-voicemail-newuser:1] Answer("SIP/xxxxx-xxxxxxxxx", "") in new stack
== Spawn extension (custom-voicemail-newuser, s, 2) exited non-zero on 'SIP/xxxxx-xxxxxxxxx'
-- Executing [800340XXXX@from-trunk:1] Set("SIP/xxxxx-xxxxxxxxx", "__FROM_DID=800340XXXX") in new stack
-- Executing [800340XXXX@from-trunk:2] Gosub("SIP/xxxxx-xxxxxxxxx", "cidlookup|cidlookup_1|1") in new stack
-- Executing [cidlookup_1@cidlookup:1] Set("SIP/xxxxx-xxxxxxxxx", "CALLERID(name)=Unknown Caller") in new stack
-- Executing [cidlookup_1@cidlookup:2] Return("SIP/xxxxx-xxxxxxxxx", "") in new stack
-- Executing [800340XXXX@from-trunk:3] GotoIf("SIP/xxxxx-xxxxxxxxx", "1 ?cidok") in new stack
-- Goto (from-trunk,800340XXXX,5)
-- Executing [800340XXXX@from-trunk:5] NoOp("SIP/xxxxx-xxxxxxxxx", "CallerID is "Unknown Caller" <8472712266>") in new stack
-- Executing [800340XXXX@from-trunk:6] Set("SIP/xxxxx-xxxxxxxxx", "FAX_RX=disabled") in new stack
-- Executing [800340XXXX@from-trunk:7] Goto("SIP/xxxxx-xxxxxxxxx", "custom-voicemail-newuser|s|1") in new stack
-- Goto (custom-voicemail-newuser,s,1)
-- Executing [s@custom-voicemail-newuser:1] Answer("SIP/xxxxx-xxxxxxxxx", "") in new stack
Dickson, I know it's been a long-time since you wrote this, but a question on your script....
If a person enters the wrong mailbox #, when they get to the password prompt, entering their right password gives them a "password is invalid" message (since it's really the mailbox # they got wrong), and then it prompts them to enter the password again. At this point, I'd actually like the script to return them to the point where they can re-enter their mailbox number. Is there a way to do that? Thanks.


Member Since:
2006-11-26