Help with Voicemail

I am running Asterisk 11 on a CentOS server and all of the documentation that I have been sorting through (along with books) haven’t helped me since I believe that the documentation is out dated and I have the newest version of asterisk. My dialplans look like this
for the Dial application.

exten => 1001,1,Answer()
exten => 1001,n,Dial(SIP/1001,10)
exten => 1001,n,VoiceMail(1001@default,u)
exten => 1001,n,Hangup()

I have no way of testing this yet but I have been trying to test the voicemailmain application and the extension looks like this

exten => 10,1,VoiceMailMain(${CALLERID(num)}@default)

I am not sure if I was supposed to specify some options inside of the parenthesis but I did anyway assuming that I got the variables right (and that the mailbox is located in the default context). When I tried to dial this extension the softphone got disconnected as if it wasn’t connected to any applications in the first place and I want to know why. Is there a simple way to do voicemail because I am only a beginner and all of the tutorials have some very advanced and complicated setups that are hard for newcomers to comprehend.

I also briefly changed the voicemailmain application extension to look like this and it still didn’t work (the phone keeps getting disconnected)

exten => 2,1,Answer()
exten => 2,n,VoiceMailMain()

Show us the cli output and the complete dialplan.

I am unsure what command you want me to run (I am assuming that it’s in the asterisk console) but I have my dial plan right here


exten => 1,1,Answer()
exten => 1,n,Playback(/etc/asterisk/sounds/demo-echotest)
exten => 1,n,Echo()
exten => 1,n,Playback(/etc/asterisk/sounds/demo-echodone)
exten => 1,n,Hangup()

exten => 0,1,Answer()
exten => 0,n,Playback(/etc/asterisk/sounds/demo-congrats)
exten => 0,n,Hangup()

exten => 2,1,Answer()
exten => 1001,n,VoiceMail(1001@default,u)

exten => 1001,1,Answer()
exten => 1001,n,Dial(IAX2/1001,20,t)
exten => 1001,n,VoiceMail(1001@default,u)
exten => 1001,n,Hangup()

exten => 1002,1,Answer()
exten => 1002,n,Dial(IAX2/1002,20,t)
exten => 1002,n,Hangup()

exten => 1003,1,Answer()
exten => 1003,n,Dial(IAX2/1003,20,t)
exten => 1003,n,Hangup()

exten => 1004,1,Answer()
exten => 1004,n,Dial(SIP/1004,20,t)
exten => 1004,n,Hangup()

exten => 1005,1,Answer()
exten => 1005,n,Dial(SIP/1005,20,t)
exten -> 1005,n,Hangup()

exten => 1006,1,Answer()
exten => 1006,n,Dial(SIP/1006,20,t)
exten => 1006,n,Hangup()

Enter in the linux console an run: asterisk -rvvvv then make a call a copy & paste all the output.

This is wrong:

exten => 2,1,Answer() exten => 1001,n,VoiceMail(1001@default,u)

You should have:

exten => 2,1,Answer() exten => 2,n,VoiceMailMain(1001@default)


exten => 1001,1,Answer() exten => 1001,n,VoiceMaiMainl(1001@default)

To leave a voicemail use Voicemail(NumberofMailbox@ContextofMailbox,OPTIONS).
To Check the messages in the Mailbox use VoiceMailMain(Numberofthemailbox@context).

I just modified the code a little goibg by what you have mentioned and came out with this

exten => 10,1,Answer()
exten => 10,2,VoiceMailMain(${CALLERID(num)}@default)

I guess instead of putting a 2 in the priority section of the voicemailmain function I was putting an n. I might come back and see what I can do about the actual voicemail mechanism that sounds on timeout.

Hold on a second, It works but it only works after I run this command on the server

asterisk -c

When I exit the console for the asterisk server it stops accepting voicemail requests. Now I am confused as to why it is doing this now.

I just ran that command and here is the output

Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

So it does appear that this is my actual problem (one that doesn’t seem to pertain to any type of syntax or arrangement error in the dialplan configuration). What I now want to know is why it’s not executing the voice mail applications in the dialplan unless I’m in the asterisk CLI, the one I dropped into by typing the command.

asterisk -c

I can’t use voicemail unless I’m inside of the cli and I want to be able to use it without having a machine logged into the asterisk cli. Google search can’t show me whats wrong here since its a very unusual defect.

Seems like you doesn’t start asterisk as a service, to connect to asterisk you use asterisk -r.
Start the service first.

I did start the service, asterisk is answering, dialing and playing back sounds like it should. The only thing that isn’t working is the voicemail. Here are the commands I used to start it

/etc/init.d/asterisk start

and this one

service asterisk start

If these aren’t starting asterisk as a service then what is?

And I mentioned earlier that when I try to run this command

asterisk -r

It comes back with an error saying that a file wasn’t found. I want this error to go away so that I can access the cli properly and I think voicemail will work if I get asterisk running like it should. Remember I am running a red hat system so I performed the commands after installing it.

make config
make samples
chkconfig asterisk on

If there is something wrong with these commands let me know.

If asterisk -r don’t work for you maybe you have issues with your user and the user running asterisk. Your user is the same running asterisk? If not, your user has permission to run asterisk?
Other possible issue is SELINUX, its disabled?

[quote=“navaismo”]If asterisk -r don’t work for you maybe you have issues with your user and the user running asterisk. Your user is the same running asterisk? If not, your user has permission to run asterisk?
Other possible issue is SELINUX, its disabled?[/quote]
SELinux is in fact disabled, but when I had it set to enforcing it still wouldn’t work. How do I remedy the user aspect of this problem?

This issue is starting to become very frustrating because when I tried to drop into a shell to see an error by making things verbose it starts to work. you can see how this makes it difficult to look for errors since the shell doesn’t show an error because the service is suddenly working. when I exit the shell it stops working. I need more solution ideas because google searches are turning up nothing.

How did you installed asterisk?
Which user run asterisk?
Which user are you using to enter in the cli?
Which permissions has your user?
What is the status of selinux … ewing.html?

Is the asterisk starting with console in the asterisk.conf file?

Asterisk was installed from source along with libpri and dahdi. I have been trying to access the CLI as root and I am guessing that the installation scripts in the asterisk source tarball automatically added the asterisk username and group but this is only an assumption. I have just solved the problem but only partially. It turns out that whenever I start asterisk I need to run the command.


But the problem is that when the computer is rebooted or if asterisk is restarted the voicemail won’t work until I run that command again. How do I make it to where this command or the process executed by this command runs every time asterisk starts up

Sounds like you didn’t run make config.

yes I did run make config. I ran it to place the daemon file in the /etc/init.d/ directory and it is in there, I’ve checked. What has worked up to this point where I can leave the server alone and walk away is running this command


My only complaint is that I have to run this command every time I restart the asterisk daemon (It seems that doing it through the init.d directory doesn’t do that, neither does the service command.)

make config should install a script that runs safe_asterisk. The daemon itself is installed by make install.


When you want start your asterisk server you just had to do this:

When you create a voicemail you must stop completely your asterisk and start him again:

killall asterisk asterisk
When you do that your voicemail is create and it’s works without any problems. It’s not cool but it’s like that.

Just for information… :mrgreen: