Mailbox column in mysql, Asterisk

Dear colleagues I have configured realtime asterisk. I have created SIP table in mysql for registering extensions and etc… Please see below it briefly

CREATE TABLE sip (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(80) NOT NULL DEFAULT ‘’,
context varchar(80) DEFAULT ‘internal’,
deny varchar(95) DEFAULT ‘0.0.0.0/0.0.0.0’,
permit varchar(95) DEFAULT ‘192.168.0.0/16’,
secret varchar(80) DEFAULT NULL,
md5secret varchar(80) DEFAULT NULL,
host varchar(31) NOT NULL DEFAULT ‘dynamic’,
nat varchar(5) NOT NULL DEFAULT ‘no’,
type enum(‘user’,‘peer’,‘friend’) NOT NULL DEFAULT ‘friend’,
language char(2) DEFAULT NULL,
mailbox varchar(50) DEFAULT NULL,

There is a strange situation for me. When I insert data in the mailbox column the extension that is associated with that malbox cannot be registered. As soon as I remove that data and make it as it was before - to the default state the phone can be registered successfully.

I have tried to configure the same thing in sip.conf and it is working properly. I wonder what is going wrong.

Can you please help me with that ? I would appreciate that very much!

Thanks!

Two things to try:

  1. If this what you’re seeing in the log, you should prune the realtime record, then add it back (see below).
    NOTICE[13776]: chan_sip.c:27655 handle_request_subscribe: Received SIP subscribe for peer without mailbox: 62966

>sip prune realtime 62966
>sip show peer 62966 load

  1. Try including the context with the mailbox (62966@default).

My users (extensions) are created by mysql. So when I enter “sip show peers” it does not give me any result about that extension. Therefore when I do

sip prune realtime 1010
Peer ‘1010’ not found

The thing is that “sip show peers” lists users (extensions) created in sip.conf . But at that case I don’t face any issue because as told before in sip.conf when I enter ‘mailbox’ for any extension everything is ok. But as we must use instead of sip.conf mysql we must find solution for doing the same to work in mysql.

Its really very strange for me that only when ‘mailbox’ column is added to any extension that user is not able to register.

So after

mysql -u root -p

I do

update sip set mailbox = ‘1010@default’ where id = ‘1’;

(sip is the table that I have created before )

Immediately when the user is trying to register I see this:

WARNING[11110]: taskprocessor.c:887 taskprocessor_push: The ‘stasis-core’ task processor queue reached 500 scheduled tasks.
WARNING[11110]: taskprocessor.c:887 taskprocessor_push: The ‘stasis-core’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-0000001c’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-0000001c’ task processor queue reached 500 scheduled tasks.
[WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-0000001e’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-0000001e’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-00000022’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-00000022’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-00000024’ task processor queue reached 500 scheduled tasks.
WARNING[11128]: taskprocessor.c:887 taskprocessor_push: The ‘subp:1010@default-00000024’ task processor queue reached 500 scheduled tasks.

After I have very high cpu usage.

Regarding to the second point

Do you mean to try put 1010@default instead of 1010 in mysql ? If so I have tried that but in the logs I see - Wrong password

What do you think what is wrong, at what point there is a mistake ?

Thank you very much for your help!!!

First, make sure you have “rtcachefriends=yes” in the general section of sip.conf. That will allow realtime caching of the extensions. Also, “default” may not be the correct context. Take a look in you voicemailusers table and if the context is blank, make it the same as your sip extension context, then make the mailbox ext@context. For me, my extensions’ context is from-internal-sip, so my voicemailusers table has from-internal-sip as the context for every mailbox. In the sip table, I have 12966@from-internal-sip. On the phone, I just set the mailbox to 12966 and tell it the voicemail server ip.

I’ve been having trouble with the taskprocessor also. Similar errors on 13.11 and 13.8. Been working with a developer on this. It’s due to a deadlock in how it queues tasks. They have an internal bug that they’re working on. He said he’d bump it up internally, but he also said that it had to do with realtime and voicemail. You and I may be in the same boat with this one. Keep and eye on your memory consumption for the asterisk process. If it gets too high, so far, I’ve just done a “core restart now” from the cli and it goes back down. Not a long term solution, I know. Hopefully they’ll find the problem soon.

Dear friend. Thank you for your kind reply. I added “rtcachefriends=yes” and could register successfully.
Right now I am doing testing. I made a test call and left voicemail. So now when I check for voicemail and want to hear the message the voice tells me to enter mailbox and the password (as it should do). When I enter them it tells that - ‘login indirect’

in “voicemail.conf” I have this:

[my_context]

1010 => 123, John john@example.com
1011 => 456, Gago, gago@example.com

Do I need to do create “voicemail” table and instert data there ? or it should work like this as well ?

Thank you very much for your help!!!

Can you post the log from a call to VoiceMailMain()? Sounds like it didn’t read the password correctly.

You may also want to add a “,u” or “,b” for unavailable or busy greeting.

If you want to use realtime voicemail, you can, but you’ll need change the Voicemail Options in make menuselect from FILE_STORAGE to ODBC_STORAGE, create the tables, and modify the config files. Some might need adjusted for your installation.

extconfig.conf
voicemail => odbc,asterisk,voicemail_users

voicemail.conf
[general]
format=wav
odbcstorage=asterisk
odbctable=voicemessages

res_config_odbc.conf
[settings]
connection = asterisk_connector

res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => your_database_username
password => your_database_password
pooling => no
limit => 1
pre-connect => yes

/etc/odbc.ini
[asterisk-connector]
Description = MySQL connection to ‘asterisk’ database
Driver = MySQL
Database = asterisk
Server = localhost
Port = 3306
Socket = /var/run/mysqld/mysqld.sock

/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1

Dear friend regarding to the log

Executing [700@internal:1] VoiceMailMain(“SIP/1010-00000000”, “”) in new stack
<SIP/1010-00000000> Playing ‘vm-login.gsm’ (language ‘en’)
<SIP/1010-00000000> Playing ‘vm-password.gsm’ (language ‘en’)
Incorrect password ‘123’ for user ‘1010’ (context = default)

As you see there is a context default, but I have written in “voicemail.conf” my_context and its not default.
Default I wrote before but then I have changed it to my_context. It doesnt “see” the new context I guess or anything else should be done ?

Regarding to the realtime part I will come back to it a bit later. Firstly I want to finish with this one.

Thanks!

For this config, you’ll need to add the context to the VoiceMainMain box.

exten => 700,1,VoicemailMain(700@my_context)

Done, thank you very much! I did

exten => 700,1,VoicemailMain(700@my_context)

and it helped.

For realtime part, do I need to use only ODBC, or there is another option as well ?

Thank you!

For realtime, it’s recommended to use the ODBC driver. I believe the MySQL driver either is no longer available, or will be phased out.

for the rest realtime functions I am using MySQL. Is it ok ? Or I should switch it to ODBC. Sorry I havent used that before and thus don’t know its mission and the purpose of using it.

If you’re wanting to store the mailbox messages in the database, the only option now is ODBC. If you’re just storing the voiecmail users in the database, you could continue with the MySQL driver, but I wouldn’t expect it to be available forever in future versions.

ODBC manages the connection information and drivers to databases. Several database servers can be configured in to use Open DataBase Connectivity. It standardizes the connections. Makes it easier to change between backends if you need to. Unless you’re stuck using microsoft sql server and a few others, then you also will need to use FreeTDS.

From a non-voicemail perspective ODBC is the core supported functionality, as it allows us to support multiple databases easiest. Other modules are community supported.

1 Like