Voicemail is required to allow the caller to leave a message if the recipient does not answer. How to configure it with asterisk on Ubuntu? That’s what this article is about. We will explain step by step how to do it. Let’s go!
Norton Secure VPN 2023 for up to 5 Devices | |
19,99 $ |
Basic setup
Voice mail
You must first go to the …etc/asterisk directory. The configuration file is voicemail.conf.
Now we are going to make a copy to have a backup in case something goes wrong
We can now start creating our voicemail. To do this the command looks like this: mailbox_number => password, name, email. So we have:
- The voicemail number: this is the number of the voiceMail() command. This number will be used to register a user in the sip.conf or iax.conf file.
- Password: this is the password required for registering a user in sip.conf or iax.conf.
- name: is the name attached to the mailbox
- Email: this is the place of transfer of messaging notifications.
That’s about all the configurations we need for now. Exit the file by saving it with the wq command.
Checking the settings
Return to the console level then reload your voicemail.conf file.
Now let’s take a look inside! Enter the command: voicemail show users.
Well everything is perfect! the mailbox has been successfully created. Now for the next step, it’s about understanding how the messaging system works and where messages are created in your system.
Mail files
In order to locate the mail files, let’s go into the..asterisk/voicemail/ directory and display the detailed content using the ls -la command.
We can notice that a default folder was automatically created because we used the default configuration. It is in this default folder that our mail files will be located.
Now it’s good to know all this, but we are far from having finished our configurations 😎 . Now let’s talk about the dial plan.
Add voicemail to dial plan
For this step, let’s start by highlighting the applications that we will need. Let’s go ! Let’s switch to command mode in asterisk then enter the command: core show applications like mail
We have 3 main applications:
MailboxExists: it checks whether or not a mailbox exists in the dynamic environment!
VoiceMail: You need it to leave a voice message to your correspondent, i.e. the one who is calling you.
VoiceMailMain: This is the main voice mail application. It allows you to properly administer and manage your mailboxes.
Start by taking a closer look at the Voicemail app. specifically the configuration syntax. Enter the following command then press Enter:
Which gives us:
Now let’s access the configuration file: extensions.conf. The settings are already there, so we will just comment on them. To do this, let’s go back to main mode and enter the following tree structure: ../asteirsk/extensions.conf .
- A timeout to the dialing application of 5s, i.e. if a person tries to dial the user Mathias, this will be done for max 5 seconds. If no one answers the extension with the next priority level should be executed. The failover can also occur because of network issues preventing the creation of a communication channel with the application.
- In the previous case we are therefore automatically directed in “B” to voicemail 100, with a default context. That said, you can remove the default! Then hang up!
We can do similar implementations for the second user james!
Notice
As argument VoiceMail() takes 100 and 200 for users Mathias and James. We could have saved time by using the exten variable which contains them. Like this :
Now let’s go to the asterisk console and test everything:
- In the console enter the command: dialplan reload
- Then make the call, in my case Mathias call James
- And finally you can just hang up by clicking on the red cross or by pressing #.
Let’s go into more detail and see what happens during the process after the 5s of no response:
- There is a call in “A” from voicemail 100
- Then in “B” we have directly the introductory message of the genre: “Welcome to the voicemail of Mr…”
- Then in “C” we have the beep which marks the start of the recording of voice messages in different formats!
- And finally the user ended the call by pressing #
Access to voicemail
Now we have a perfectly working voicemail, however we still cannot retrieve voicemail or even change voicemail options. To do this, let’s see the application in more detail.
VoiceMailMain(). Let’s try setting up James’s email. What will mainly interest us is the syntax and the available options. In the console, enter the command core show application VoiceMailMain.
Now let’s go back to main mode and go to the extensions.conf file. We are going to add a new extension and the hangup app.
Now let’s test: Let’s call James’s voicemail directly
- You must enter the password and then validate.
- The system makes us understand that we have 4 new messages.
- Finally, it lists the possibilities of access to the different options according to the 1234 numbers.
Here is your voicemail is now configured 🙂! But you can continue to explore the different options and app arguments.
See as well :