[Home]

Summary:ASTERISK-13095: Didn't call UPDATE or INSERT query to database
Reporter:nord (nord)Labels:
Date Opened:2008-11-20 06:19:16.000-0600Date Closed:2008-11-21 13:04:51.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:writesql like ignored.
Does not work writesql(no any changes in database).
but if you will write : readsql=UPDATE clients SET name='someone'
You will get FETCH ERROR, but changes will be done.
In any case writesql like ignored.

No error, no warrnings....

****** ADDITIONAL INFORMATION ******

func_odbc.c REVISION 155396

sample of func_odbc.conf
[VALUE]
prefix=UPD
dsn=asterisk
writesql=UPDATE clients SET value='${SQL_ESC(${ARG1})}'
readsql=SELECT ${ARG1}

Comments:By: Leif Madsen (lmadsen) 2008-11-20 16:27:54.000-0600

Please provide the dialplan you are using to call func_odbc along with the console output from Asterisk.

Thanks!

By: nord (nord) 2008-11-21 01:16:29.000-0600

extensions.conf

[sip_user]
exten => _[0-9].,1,Verbose(${UPD_VALUE(111)})
exten => _[0-9].,2,Dial(SIP/${EXTEN},30,gL(5000:0:0))
exten => _[0-9].,3,Hangup()

console output

 == Using SIP RTP CoS mark 5
 == Using UDPTL CoS mark 5
   -- Executing [111@sip_user:1] Verbose("SIP/111-b7da7350", "111") in new stack
111
switch*CLI>
   -- Executing [111@sip_user:2] Dial("SIP/111-b7da7350", "SIP/111,30,gL(5000:0:0)") in new stack
   -- Setting call duration limit to 5.000 seconds.
 == Using SIP RTP CoS mark 5
 == Using UDPTL CoS mark 5
   -- Called 111
   -- SIP/111-082332f0 is ringing
   -- SIP/111-082332f0 answered SIP/111-b7da7350
   -- Native bridging SIP/111-b7da7350 and SIP/111-082332f0
   -- Executing [111@sip_user:3] Hangup("SIP/111-b7da7350", "") in new stack
 == Spawn extension (sip_user, 111, 3) exited non-zero on 'SIP/111-b7da7350'

By: Tilghman Lesher (tilghman) 2008-11-21 10:34:04.000-0600

There's where the problem lies.  You're not actually calling it in a way that calls the write portion.  The way to do this is to use Set:

Set(UPD_VALUE(111)=)

By: nord (nord) 2008-11-21 12:37:36.000-0600

Sorry for mistake.

By: Jason Parker (jparker) 2008-11-21 13:04:51.000-0600

Saw this as I was passing by.

Closing, per reporter.