Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Escaping parameter for ODBC function


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
ldardini at gmail.com
Guest





PostPosted: Mon Aug 31, 2015 10:05 am    Post subject: [asterisk-users] Escaping parameter for ODBC function Reply with quote

Hello,I just noticed a weird behavior when using ODBC functions. If the content of any of the paramter has a "=" inside, then the function is not processed correctly by asterisk.


Let's take for example the following ODBC function in func_odbc.conf


[LOG_SMS]
dsn=asterisk1,asterisk2
synopsis=Log the route of a SMS
writesql=INSERT INTO sm_smslogs(sm_te_id,sm_date,sm_direction,sm_sourceraw,sm_destraw,sm_from,sm_to,sm_body,sm_fullresult,sm_response) values ('${ARG1}',NOW(),'${ARG2}','${ARG3}','${ARG4}','${ARG5}','${ARG6}','${SQL_ESC(${ARG7})}','${SQL_ESC(${ARG8})}','${SQL_ESC(${VAL1})}')



When it is called using:


[2015-08-31 16:35:16] VERBOSE[29562][C-00000001] pbx.c: Executing [103@astsms:37] Set("Message/ast_msg_queue", "ODBC_LOG_SMS(1,ONNET,<sip:102-DEVEL@devel.mirtapbx.com ([email]sip%3A102-DEVEL@devel.mirtapbx.com[/email]);transport=UDP>,sip:103@devel.mirtapbx.com ([email]sip%3A103@devel.mirtapbx.com[/email]);transport=UDP,102,103,Second test 4,)=SUCCESS") in new stack



Asterisk interprets the first "=" as assignment. In the debug log I found:


Variable: ODBC_LOG_SMS(1,ONNET,<sip:102-DEVEL@devel.mirtapbx.com ([email]sip%3A102-DEVEL@devel.mirtapbx.com[/email]);transport

AppData: UDP>,sip:103@devel.mirtapbx.com ([email]sip%3A103@devel.mirtapbx.com[/email]);transport=UDP,102,103,Second test 4,)=SUCCESS



And the ODBC function is not executed.


Is there a way, beside using REPLACE, to avoid this problem?


Leandro
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services