misc

Asterisk - Voicemail Feature Code

September 16, 2019 pbx

Asterisk - Voicemail Feature Code

I was tasked with setting up a Asterisk server with no helper interface and scripts such as FreePBX. Setting up the voicemail portion turned out to be fairly easy. Below is portions of the dial plan that I configured.

extensions.conf

exten => *97,1,answer()
exten => *97,n,agi(googletts.agi,"You have reached the voice mail system")
exten => *97,n,VoiceMailMain(${CALLERID(num)}@Main)
exten => *97,n,Hangup()
exten => *98,1,answer()
exten => *98,n,agi(googletts.agi,"Routing you to the voicemail")
exten => *98,n,VoiceMail(6001@Main)
exten => *98,n,Hangup()

The above start codes allow you to check the voicemail. *97 will route to the extension callerID num. Such as extension 6001 and *98 will route to extension 6001.

voicemail.conf

[main]
7001 => 123

7002 => 456
6001 => 456

I utilize an AGI script called googletts.agi for my testing environment. It essentially converts text to speech and plays the audio. I will write in detail about it in another blog and link to the original script.

In order to route a call to voicemail, all you need to do is the following code.

exten => [extension],n,VoiceMail([extension]@main)
Example:
exten => 7001,n,VoiceMail(7001@main)