Requiring callers to know passcodes to leave voicemail


For my business I’d like to have a system that allows customers to call in to leave messages with our staff, but I need to require a few passcodes or information from them so our VM box doesn’t get questions from non-customers. Basically I want them to first enter their account id, and possibly a second form of id (numeric).

Is this possible to setup? I’d like to play a message if they enter an invalid id too. Basically, prompt them for their customer id, if they enter it correctly, possible prompt them for another number, then send them to voicemail if its correct.

Can this be done? I want to support a whole bunch of customer id’s, but have them all go to one inbox.



Yes it can do that. You just need to use the internal databse and authenticate.
then forward the call to the required destination based on the account number if required.



You can do the above or simply put in an athenticate line before the vm line

Exten => s,1,Answer
Exten => s,n,Dial(SIP/Exten-To-Call)
Exten => s,n,Authenticate(1234)
Exten => s,n,Voicemail(userVmNumber@Context)


Awesome, thanks guys. When I get Astrerisk set up I might have some questions on how to do the authentication, but hopefully I can figure it out.

Thanks again!



Yes it can do that. You just need to use the internal databse and authenticate.
then forward the call to the required destination based on the account number if required.


Hey Ian-

Looking at the handbook and the docs, can’t figure out how I would use a database to authenticate (Dovid, I can’t have a static code like that, it will vary from customer to customer, as they all have their own customer id).

So basically I want to do something like this:

Exten => s,1,Answer
Exten => s,n,Authenticate(see if first code exists in DB)
Exten => s,n,Authenticate(see if second code exists in DB)
Exten => s,n,Voicemail(u100)


this isn’t a direct answer to your query, but an example of an inline MySQL table lookup for you to look at. you can use the bits you need to perform the DB lookup appropriate to you.

; MYSQL experiment exten => s,1,Answer exten => s,2,Wait(1) exten => s,3,Playback(allison7/please-enter-your) exten => s,4,Playback(extension) exten => s,5,Read(fromext|then-press-pound) exten => s,6,Wait(1) exten => s,7,Playback(ent-target-attendant) exten => s,8,Read(toext|then-press-pound) exten => s,9,Wait(1) exten => s,10,Playback(please-enter-your) exten => s,11,Playback(vm-password) exten => s,12,Playback(then-press-pound) exten => s,13,Read(extsecret) exten => s,14,Wait(1) ; change the next line to match your MySQL account details exten => s,15,MYSQL(Connect connid localhost username password asterisk) ;next line should be all on one line !!! exten => s,16,MYSQL(Query resultid ${connid} SELECT\ `data`\ FROM\ `sip`\ WHERE\ `id`=${fromext}\ AND\ `keyword`=\"secret"\) exten => s,17,MYSQL(Fetch foundRow ${resultid} mysecret) exten => s,18,MYSQL(Clear ${resultid}) exten => s,19,MYSQL(Disconnect ${connid}) exten => s,20,NoOp(${extsecret}) exten => s,21,GotoIf($["${mysecret}" = "${extsecret}"]?22:32) exten => s,22,Playback(auth-thankyou) exten => s,23,DBput(CF/${fromext}=${toext}) exten => s,24,Playback(call-fwd-unconditional) exten => s,25,Playback(for) exten => s,26,Playback(extension) exten => s,27,SayDigits(${fromext}) exten => s,28,Playback(is-set-to) exten => s,29,SayDigits(${toext}) exten => s,30,Playback(goodbye) exten => s,31,Macro(hangupcall) exten => s,32,Playback(auth-incorrect) exten => s,33,Goto(s,13) exten => h,1,Hangup()



Here is an example using the internal database that works well under load exten => 514,1,Answer ; Answer the line or has carried on exten => 514,n,Read(acc_code,access-code,4) exten => 514,n,set(passkey=${DB(auth_user/${acc_code})}) exten => 514,n,Authenticate(${passkey}) exten => 514,n, ;<-- dialplan carries on here

the internal database then has entries when the family is auth_user the key is the 4 digit code they have entere and the value is the passkey this can be ammended to use $EXTEN or even the CLI for authenticating against CLI.