[asterisk-users] Realtime device update weirdness

Mindaugas Kezys mkezys at gmail.com
Thu Jan 31 03:46:10 CST 2008


Hello,

We use Asterisk Realtime for our billing software. 200+ installations of Asterisk with Realtime, but I see this for the first time.

Asterisk 1.4.17, Addons 1.4.5, No patches, no NAT - just plain simple installation.


With debug I can see:

[Jan 30 22:38:21] DEBUG[27885]: res_config_mysql.c:662 mysql_reconnect: MySQL RealTime: Everything is fine.
[Jan 30 22:38:21] DEBUG[27885]: res_config_mysql.c:138 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM devices WHERE name = '109' AND host = 'dynamic'
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:662 mysql_reconnect: MySQL RealTime: Everything is fine.
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:365 update_mysql: MySQL RealTime: Update SQL: UPDATE devices SET ipaddr = '0.0.0.0', port = '0', regseconds = '0' WHERE name = '109'
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:379 update_mysql: MySQL RealTime: Updated 0 rows on table: devices
[Jan 30 22:38:21] DEBUG[27885]: res_config_mysql.c:662 mysql_reconnect: MySQL RealTime: Everything is fine.
[Jan 30 22:38:21] DEBUG[27885]: res_config_mysql.c:365 update_mysql: MySQL RealTime: Update SQL: UPDATE devices SET ipaddr = '0.0.0.0', port = '0', regseconds = '0' WHERE name = '109'
[Jan 30 22:38:21] DEBUG[27885]: res_config_mysql.c:379 update_mysql: MySQL RealTime: Updated 0 rows on table: devices
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:662 mysql_reconnect: MySQL RealTime: Everything is fine.
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:365 update_mysql: MySQL RealTime: Update SQL: UPDATE devices SET ipaddr = '213.164.10.178', port = '60854', regseconds = '1201750701' WHERE name = '109'
[Jan 30 22:38:21] DEBUG[27917]: res_config_mysql.c:379 update_mysql: MySQL RealTime: Updated 1 rows on table: devices


Notice update: UPDATE devices SET ipaddr = '0.0.0.0', port = '0', regseconds = '0' WHERE name = '109'

Correct behaviour is: UPDATE devices SET ipaddr = '213.164.10.178', port = '60854', regseconds = '1201750701' WHERE name = '109'

Why update to 0.0.0.0 is executed? It makes devices unreachable. When device reregisters - it becomes available for short time - then again - update to 0.0.0.0. Why it is happening?


For temporaly solution i had to patch res_config_mysql.c at line 342, added such lines:

        if ((!strcmp(newparam, "ipaddr")) && (!strcmp(buf, "0.0.0.0"))){
            ast_log(LOG_DEBUG,"MySQL RealTime: Avoided to update %s to %s !!!\n", newparam, buf);
            ast_mutex_unlock(&mysql_lock);
            return -1;
        }


Regards/Pagarbiai,
Mindaugas Kezys
http://www.kolmisoft.com






More information about the asterisk-users mailing list