ldardini at gmail.com Guest
|
Posted: Mon Aug 31, 2015 10:05 am Post subject: [asterisk-users] Escaping parameter for ODBC function |
|
|
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 |
|