[asterisk-bugs] [Asterisk 0012166]: MYSQL Query using wrong delimiters and not returning results

noreply at bugs.digium.com noreply at bugs.digium.com
Fri Mar 7 05:36:56 CST 2008


The following issue has been CLOSED 
====================================================================== 
http://bugs.digium.com/view.php?id=12166 
====================================================================== 
Reported By:                ruffle
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12166
Category:                   Addons/app_addon_sql_mysql
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Asterisk Version:           1.4.18 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             03-07-2008 04:43 CST
Last Modified:              03-07-2008 05:36 CST
====================================================================== 
Summary:                    MYSQL Query using wrong delimiters and not returning
results
Description: 
app_addon_sql_mysql seems to be changing the delimiters for a query and not
returning the result as expected (this code was working in previous
versions).

My Dialplan has:

;   Update MySql autorecord database
exten => s,n,MYSQL(Connect connid localhost asterisk secret asterisk)
exten => s,n,NoOp(Connid is ${connid})
exten => s,n,GotoIf($[${connid} = ""]?s-GNORECORD|1)
exten => s,n,NoOp(Updating MYSQL)
exten => s,n,NoOp(Uniqueid is ${UNIQUEID})
exten => s,n,NoOp(RecordFile is ${RECORDFILE})
exten => s,n,MYSQL(Query resultid ${connid} INSERT\ INTO\ autorecord\ SET\
calldate=now()\,src=\"${CALLERID(num)}\"\,dest=\"${ARG1}\"\,filename=\"${RECORDFILE}\",uniqueid=\"${UNIQUEID}\")
exten => s,n,NoOp(MYSQL resultid is ${resultid})
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${connid})

Which inserts a record into my autorecord database. However, running this
with 1.4.18/1.4.6 the separator between the filename and uniqueid get
changed from a comma to a pipe!  and the resultid is blank (not sure if
this is new or not. See the CLI output below.
-- Executing [s at macro-stdexten:10] MYSQL("SIP/117-00713c90", "Connect
connid localhost asterisk secret asterisk") in new stack
-- Executing [s at macro-stdexten:11] NoOp("SIP/117-00713c90", "Connid is 1")
in new stack
-- Executing [s at macro-stdexten:12] GotoIf("SIP/117-00713c90",
"0?s-GNORECORD|1") in new stack
-- Executing [s at macro-stdexten:13] NoOp("SIP/117-00713c90", "Updating
MYSQL") in new stack
-- Executing [s at macro-stdexten:14] NoOp("SIP/117-00713c90", "Uniqueid is
lls-1204885650.24") in new stack
-- Executing [s at macro-stdexten:15] NoOp("SIP/117-00713c90", "RecordFile is
/var/spool/asterisk/autorecord/2008/03/07/102730-lls-1204885650.24-112-117")
in new stack
-- Executing [s at macro-stdexten:16] MYSQL("SIP/117-00713c90", "Query
resultid 1 INSERT INTO autorecord SET
calldate=now(),src="117",dest="112",filename="/var/spool/asterisk/autorecord/2008/03/07/102730-lls-1204885650.24-112-117"|uniqueid="lls-1204885650.24"")
in new stack
*******  This should be a comma -------------------------------------^
-- Executing [s at macro-stdexten:17] NoOp("SIP/117-00713c90", "MYSQL
resultid is ") in new stack
-- Executing [s at macro-stdexten:18] MYSQL("SIP/117-00713c90", "Clear ") in
new stack
-- Executing [s at macro-stdexten:19] MYSQL("SIP/117-00713c90", "Disconnect
1") in new stack

Hmm that didn't work very well with the wrapping on the web site. I'll
include the dialplan and CLI output as an attachment.




====================================================================== 

---------------------------------------------------------------------- 
 mvanbaak - 03-07-08 05:36  
---------------------------------------------------------------------- 
This is a configuration issue.
You should escape that last comma. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-07-08 05:36  mvanbaak       Status                   new => closed       
03-07-08 05:36  mvanbaak       Note Added: 0083587                          
======================================================================




More information about the asterisk-bugs mailing list