[asterisk-bugs] [Asterisk 0013603]: [patch] Database from extconfig.conf ignored

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Oct 2 11:47:42 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13603 
====================================================================== 
Reported By:                atis
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13603
Category:                   Addons/res_config_mysql
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.0 
SVN Revision (number only!): 595 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-10-02 08:34 CDT
Last Modified:              2008-10-02 11:47 CDT
====================================================================== 
Summary:                    [patch] Database from extconfig.conf ignored
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 :)
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0005881 [patch] Allow use of separate MySQL ser...
====================================================================== 

---------------------------------------------------------------------- 
 (0093082) atis (reporter) - 2008-10-02 11:47
 http://bugs.digium.com/view.php?id=13603#c93082 
---------------------------------------------------------------------- 
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 at 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. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-10-02 11:47 atis           Note Added: 0093082                          
======================================================================




More information about the asterisk-bugs mailing list