Hello,
I’m trying (without success ) to use ARA/Realtime mode with auto registration (on SIP). I mean I’m trying to implement the equivalent of “register => username:password@domaine” using a database.
I’m testing this on a two-asterisk architecture, so I’m supposed to see a connection coming from the first Asterisk when I add a new entry to my MySQL table.
To activate the Realtime, I installed a standard MySQL server (Ubuntu), and activated the corresponding module in Asterisk (1.8.3.3) which is res_config_mysql.so (modules.conf).
Next, I modified the extconfig.conf file:
sippeers => mysql,asterisk,sipfriends
sipregs => mysql,asterisk,sipregs
Then, I configured an ‘asterisk’ block in the res_config_mysql.conf file:
[asterisk]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = XYZ
dbpass = XXXXXX
dbport = 3306
dbsock = /var/run/mysqld/mysqld.sock
dbcharset = latin1
requirements=createclose
I created the corresponding tables in a database named ‘asterisk’: sipfriends comes from https://wiki.asterisk.org/wiki/display/AST/SIP+Realtime%2C+MySQL+table+structure and sipregs was a littile harder to find, but I’m using:
CREATE TABLE `sipregs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(40) DEFAULT NULL,
`ipaddr` char(45) DEFAULT NULL,
`port` smallint(5) unsigned DEFAULT NULL,
`regseconds` int(10) DEFAULT NULL,
`defaultuser` char(10) DEFAULT NULL,
`fullcontact` char(35) DEFAULT NULL,
`regserver` char(20) DEFAULT NULL,
`useragent` char(20) DEFAULT NULL,
`lastms` int(10) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
For the entries set in sippeers (in the sipfriends table), it works fine, the routing is done correctly, and I see the queries done by Asterisk in the SQL database when a call comes in. However, for sipregs: nothing. I see the queries done to the database for the sipregs table, but never I see any peer registered on the remote Asterisk (when doing it by hand using the flat file sip.conf with a register => …, it works perfectly).
Normally, I have to create an entry in the sipfriends table including an attribute ‘name’ set to ‘foobar’, and in the sipregs table, if I create an entry with ‘name’ set to ‘foobar’, this should trigger the ‘register’.
My frist question: Does Asterisk really support/work like this? I ask this question because when one does a normal register (flat files), Asterisk connects on the remote Asterisk [color=#BF0000]IMMEDIATELY[/color] (that’s register’s goal, right?), and not when a new call comes in. I don’t see in my logs Asterisk regularly querying the database to see if a new record was added to the sipregs table…
My second question: If it should work, how do I do this? What did I do wrong?
My third question: If Asterisk isn’t capable of triggering registrations when using Realtime, how can I go around this? (I need to dynamically create/delete several registers on a regular frequent basis, and modifying the text files/reloading asterisk is kind of dirty, especially if I have to do this several times a minute… )
Thanks for your help,
David