Need help with setting up Voicemail in FreePBX

NethServer Version: NethServer release 7.3.1611 (Final)
Module: FreePBX Voicemail

I have fresh installation of Nethserver with FreePBX. When I created extension (for example 4000) device with the same number created and I can connect either softphone or IP phone. Broken link 4000 created in /var/spool/asterisk/voicemail/device pointing to /var/spool/asterisk/voicemail/default/4000. But “default” even doesn’t exist in /var/spool/asterisk/voicemail. In /etc/asterisk/modules.conf I found only one line related to voicemail: noload = app_voicemail_odbcstorage.so. If I dial *4000 or *97 it not connect me to voicemail. So voicemail in FreePBX does not work out of the box. Does anyone know how to configure voicemail?

I activated the voicemail by creating /var/spool/asterisk/voicemail/default/100 (my extension)
I tried with uncommenting noload = app_voicemail_odbcstorage.so in /etc/asterisk/modules.conf, it made the voicemailbox work when calling but there is a db problem with storing voicemails in the odbc database. nethserver-freepbx requires voicemail-odbcstorage so voicemail is not working.

[root@testserver ~]# asterisk -r
[2017-10-21 02:07:55] WARNING[52171][C-00000003]: app_voicemail_odbcstorage.c:3966 retrieve_file: Failed to obtain database object for 'asterisk'!
[2017-10-21 02:07:56] WARNING[49782]: app_voicemail_odbcstorage.c:5757 inboxcount2: Failed to obtain database object for 'asterisk'!

without uncommenting I get

[2017-10-21 01:53:06] WARNING[46942][C-00000000]: pbx.c:2864 pbx_extension_helper: No application 'VoiceMail' for extension (macro-vm, s-NOANSWER, 2)

Maybe @Stll0 can help us here?

100 is a folder or just empty file?
And anothe question: Is no one using voicemail? Or may be no one using FreePBX with Nethserver?

It’s a folder.

Tried to create appropriate folder. Still does not work for me. When I dial *97 or *4000 (my Ext) I have error 488 in both cases. When I call extension and not pick up, it also not going to voice mail

You also have to uncomment the noload line like I described. Then you can call and come to voicemail. But it’s not recording because the odbc connection to MySQL DB could not be established.
You can check on command line with “asterisk -r” and then calling an extension. You may also try *98 but I could not login to voicemail…
I’ll give it another try this weekend…

It was an odbc database connection problem, user freepbxuser and password(see /etc/freepbx.conf for password) were missing in /etc/odbc.ini, and in /etc/asterisk/res_odbc.conf I made following changes:

Don’t know if it’s needed, but for testing I did(SECURITY WARNING):

chmod 777 /var/spool/asterisk/voicemail/default/100

Created the file /etc/e-smith/templates-custom/etc/odbc.ini/91voicemail with following content:

User = freepbxuser
Password = PASSWORDFROMFREEPBX.CONF

Edit /etc/asterisk/res_odbc.conf and add odbcstorage entry:

#include res_odbc_custom.conf
#include res_odbc_additional.conf
[odbcstorage]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes

In freepbx I setup odbcstorage and voicemessages table

Via phpmyadmin(https://wiki.nethserver.org/doku.php?id=phpmyadmin) I created a new table in asteriskcdrdb but now I have the script, so you can run it in mariadb:

mysql
CREATE TABLE `asteriskcdrdb`.`voicemessages` ( `msgnum` INT(11) NULL DEFAULT NULL , `dir` VARCHAR(80) NOT NULL , `context` VARCHAR(80) NULL DEFAULT NULL , `macrocontext` VARCHAR(80) NULL DEFAULT NULL , `callerid` VARCHAR(40) NULL DEFAULT NULL , `origtime` VARCHAR(40) NULL DEFAULT NULL , `duration` VARCHAR(20) NULL DEFAULT NULL , `flag` VARCHAR(8) NULL DEFAULT NULL , `mailboxuser` VARCHAR(80) NULL DEFAULT NULL , `mailboxcontext` VARCHAR(80) NULL DEFAULT NULL , `recording` LONGBLOB NULL DEFAULT NULL , `msg_id` VARCHAR(40) NULL DEFAULT NULL ) ENGINE = InnoDB;
exit

Then write the config and restart asterisk

expand-template /etc/odbc.ini
systemctl restart asterisk

Now it should work, I can dial *97 to listen to my messages or *98 to listen to another voicemailbox but I get a security warning in freepbx because I changed res_odbc.conf.

You can only disable it completely, so you won’t get a warning if any module file changed…

Please keep in mind, that this is just a quick solution…

https://wiki.freepbx.org/display/F2/Module+Signing

Sources:
https://wiki.asterisk.org/wiki/display/AST/ODBC+Voicemail+Storage

1 Like

Hi @Ivashenkov and @mrmarkuz, sorry for the delay.
Odbc is already configured in /etc/asterisk/res_odbc_additional.conf and also /etc/odbc.ini, is the same configuration used by cdr and cel.
Two words on that: to create an odbc configuration, you only need to add this configuration in e-smith db and launch # signal-event nethserver-unixODBC-update:

# config show MySQL-asteriskcdrdb
MySQL-asteriskcdrdb=odbc
    Database=asteriskcdrdb
    Description=ODBC on asteriskcdrdb
    Driver=MySQL
    Port=3306
    Server=localhost

This is already done by nethserver-freepbx package
the e-smith db configuration: # find /etc/e-smith/db/configuration/defaults/MySQL-asteriskcdrdb/
and odbc configuration action: /etc/e-smith/events/nethserver-freepbx-update/S50nethserver-unixODBC-conf

Only thing that I think is missing for voicemail to work is asteriskcdrdb database table.
I’ve opened a bug https://github.com/NethServer/dev/issues/5363 feel free to add infos on that.
I’ll keep you posted and let you know when there is a testing package to try

2 Likes

Thanks for your help, don’t know if I should comment on github or here, so I start here:
You are right. ODBC config is working after install, but /etc/asterisk/res_odbc.conf does not include res_odbc_additional.conf(commented out) and uncommenting doesn’t solve the problem, what’s really strange, why does the include not work?

Steps:
Installed fresh 7.4b1, updated, installed nethserver-dc and FreePBX.
Created extension 100 with voicemailbox.
Connected with MicroSIP Sipphone as extension 100 and called 100 to go to voicemailbox.

Trying to save to voicemail shows that the voicemail app is not loaded:

[2017-10-23 12:39:49] WARNING[68135][C-00000000]: pbx.c:2864 pbx_extension_helper: No application 'VoiceMail' for extension (macro-vm, s-BUSY, 3)

After uncommenting noload = app_voicemail_odbcstorage.so in /etc/asterisk/modules.conf and restarting asterisk I get following error:

[2017-10-23 12:44:36] WARNING[68403]: app_voicemail_odbcstorage.c:5757 inboxcount2: Failed to obtain database object for 'asterisk'!
[2017-10-23 12:44:38] WARNING[68435][C-00000000]: app_voicemail_odbcstorage.c:4141 count_messages: Failed to obtain database object for 'asterisk'!

Then I had to copy the [asteriskcdrdb] entry from /etc/asterisk/res_odbc_additional.conf to /etc/asterisk/res_odbc.conf. Uncomment the include line in res_odbc.conf doesn’t work.

My /etc/asterisk/res_odbc.conf:

#include res_odbc_custom.conf
#include res_odbc_additional.conf
[asteriskcdrdb]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes
max_connections=>5
username=>freepbxuser
password=>09081e404001a4af1ed850b022b9c2b3
database=>asteriskcdrdb

Then I had to config freepbx. In Settings/Voicemail Admin Menu under Settings/ODBC Storage I entered asteriskcdrdb in ODBC Storage Name and voicemessages in ODBC Table Name. This sets odbcstorage and odbctable in /etc/asterisk/voicemail.conf.

Then I had to create the voicemessages table to make it finally work:

CREATE TABLE `asteriskcdrdb`.`voicemessages`(`msgnum`INT(11) NULL DEFAULT NULL ,`dir`VARCHAR(80) NOT NULL ,`context`VARCHAR(80) NULL DEFAULT NULL ,`macrocontext`VARCHAR(80) NULL DEFAULT NULL ,`callerid`VARCHAR(40) NULL DEFAULT NULL ,`origtime`VARCHAR(40) NULL DEFAULT NULL ,`duration`VARCHAR(20) NULL DEFAULT NULL ,`flag`VARCHAR(8) NULL DEFAULT NULL ,`mailboxuser`VARCHAR(80) NULL DEFAULT NULL ,`mailboxcontext`VARCHAR(80) NULL DEFAULT NULL ,`recording`LONGBLOB NULL DEFAULT NULL ,`msg_id` VARCHAR(40) NULL DEFAULT NULL ) ENGINE = InnoDB;
1 Like

Thank you for quick response. Unfortunately can not neither confirm nor deny if it help. I’m on another project right now, but will return in couple days. It worked for you, hopefully it will work for me. Thanks again.

1 Like

Package that automatically configure voicemail is in testing repository and needs QA, https://github.com/NethServer/dev/issues/5363
Let me know if it works for you

2 Likes

Tried it on new 7.4 and voicemail now works out of the box. Thanks, great work!

3 Likes

Well, I installed a Nethserver on minimum Centos 7. Now Nethserver shows 7.4. Freepbx installed. Created ext 4000 & 4001 for testing. For testing used Grandstream 1450 (4000) and iPhone soft phone “GS Wave” (4001). No other setting touched. Calls from one ext to another going through without problems in both directions. Now I can call *4000 and *4001 to leave a message, but message never left either I just hang up or I push # after I finish with message. On PBX web interface I have 0 messages on every extension. All folders in /var/spool/asterisk/voicemail/default created automatically and having right ownership (asterisk:asterisk) Anything else I can do?

By the way, there in default folder nothing but empty folder structure. On Database in the voicemessages table I see several rows created

The voicemessages are just stored in the db, not in local filesystem. You can listen to them when you call *97 for your own voicemailbox or *98 for any voicemailbox.

Where exactly on the freepbx interface do you see this? Maybe only filesystem saved messages are shown there.

When I call *97 from VOIP phone it guides me to setup a voicemail: “your name”, “busy message”… Next time I call *97 is starts over and guides me to setup my voicemail again. When i call *98 and putting my extension and password it tells me “login incorrect”.

“settings” -> “Voicemail Admin” I see 0 messages everywhere

That’s right. But as I said it’s because only file stored messages are counted… I am able to call voicemail and listen to messages so there has to be a difference in how we setup our PBX. I use 3 digits, as 100 is my extension, you use 4 digits, but that shouldn’t be the problem, I hope.

I will make some screenshots of my PBX setup steps and post it so you can compare…

There 83 warning lines in the PBX log. Most of them shouldn’t be relevant. Not sure about last one:
[2017-10-26 11:54:47] WARNING[22467] app_voicemail_odbcstorage.c: maxsilence should be less than minsecs or you may get empty messages
In the /etc/asterisk/voicemail.conf in a [general] section I see:

maxsilence=10
minsecs=1

Hope config files are right

I created extension 100 and was able to retrieve a voice message. System does not work with 4 digit extensions, I guess
There several other weird things:
I can not get *98 work from VOIP phone (“Login incorrect”). When no messages, if I call *97 it starts voicemail setup.
On soft phone *98 allows me to connect with Ext/pass and brings me to voicemail setup. *97 never connects (404 error).
I don’t know what can I do with all that…
(soft phone and voip phone successfully work with other voip providers)

1 Like

That’s really interesting, I’ll investigate that later on a fresh VM and report…