[Home]

Summary:ASTERISK-12814: [patch] Database from extconfig.conf ignored
Reporter:Atis Lezdins (atis)Labels:
Date Opened:2008-10-02 08:34:18Date Closed:2008-11-10 14:25:49.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/res_config_mysql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) multi_db.patch
Description:For example if i set in res_mysql.conf:
dbname = asteriskcdrdb

and in extconfig.conf:
sippeers => mysql,asterisk,sip_buddies
sipusers => mysql,asterisk,sip_buddies

i get:
[Oct  2 06:21:09] DEBUG[16812] res_config_mysql.c: MySQL RealTime: Connection okay.
[Oct  2 06:21:09] DEBUG[16812] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM sip_buddies WHERE name = '90132'
[Oct  2 06:21:09] WARNING[16812] res_config_mysql.c: MySQL RealTime: Failed to query database. Check debug for more info.        

It seems that refactoring of res_config_mysql missed switch to correct database at some point. In 1.4 code I've found that database name is passed to mysql_reconnect, however in 1.6 there's some handle structure.

Of course i could use one db for everything, but i would want to have queue_log next to cdr, so main config can be backed up easily :)
Comments:By: Atis Lezdins (atis) 2008-10-02 11:47:42

Ok, this restores functionality, but in a little different way:

[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Connection okay.
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM queue_table WHERE name = '22901'
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Connection okay.
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM queue_members WHERE interface LIKE '%' AND queue_name = '22901' ORDER BY interface
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Connection okay.
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Update SQL: UPDATE queue_members SET status = '1' WHERE uniqueid = '48305'
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Updated 0 rows on table: queue_members
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Connection okay.
[Oct  2 09:36:14] DEBUG[20259] res_config_mysql.c: MySQL RealTime: Insert SQL: INSERT into asteriskcdrdb.queue_log (time, callid, queuename, agent, event, data) values ('1222965374', 'REALTIME', '22901', 'Local/21168@default_queue', 'ADDMEMBER', '')
[Oct  2 09:36:15] DEBUG[20259] res_config_mysql.c: MySQL RealTime: row inserted on table: queue_log, id: 1274767                                            

If database specified in extconfig.conf is not the same as default database, it's prepended to table name.

If anybody have objections, i could put a mysql_use_db before each query - how it was originally done in mysql_reconnect, but this just gives more details in query if using non-default db.

By: Tilghman Lesher (tilghman) 2008-11-07 01:06:11.000-0600

Changed in trunk revision 688.

By: Atis Lezdins (atis) 2008-11-07 07:22:00.000-0600

I think you missed initial point of this patch.

This bug has been introduced in 0005881, as Asterisk 1.4 had multiple databases working (and it's also described in documentation). I believe that it's regression and have to be applied to 1.6.0 too.

By: Tilghman Lesher (tilghman) 2008-11-07 10:10:20.000-0600

I may do that with some more testing of the patch I applied to trunk.

Actually, now that I look at it, it won't happen.  The modifications I made to res_config_mysql depend on a previous feature-add, and this is an enhancement of that feature-add, so this fix won't go into addons-1.6.0.  It will, however, go into 1.6.1.



By: Atis Lezdins (atis) 2008-11-10 12:32:46.000-0600

Reopening this, until distinct database names can be used for different families in extconfig.conf

For reference - discussion on asterisk-dev list:

http://lists.digium.com/pipermail/asterisk-dev/2008-November/035129.html

By: Digium Subversion (svnbot) 2008-11-10 14:25:49.000-0600

Repository: asterisk-addons
Revision: 690

U   branches/1.6.0/configs/res_mysql.conf.sample
U   branches/1.6.0/res/res_config_mysql.c

------------------------------------------------------------------------
r690 | tilghman | 2008-11-10 14:25:48 -0600 (Mon, 10 Nov 2008) | 7 lines

Fix specification of different databases in extconfig.conf when using MySQL
backend.  This fixes a regression.
(closes issue ASTERISK-12814)
Reported by: atis
Patches:
      multi_db.patch uploaded by atis (license 242)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=690