Insert into DB

I have an extension that when called i want to write some data to the DB.

func_odbc.conf

[some]
prefix=data
DSN=mydns
writesql=INSERT INTO activeCalls(channel, extension, cid, fname, time) VALUES ($[VAL1],$[VAL2],$[VAL3],$[VAL4],$[VAL5])

from my extensions.conf

[ConferenceRooms]
exten => 6300,1,NoOp()
        same => n,Set(data_some()=$(${CHANNEL}\,${EXTEN}\,${CALLERID(ani)}\,${CALLERID(name)}\,${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
        same => n,ConfBridge(${EXTEN})

I know my code gets to my database and can write data because i wrapped ‘$[VALx]’ around my $[VALx] and they show up in the db.

I suspect the issue is the code from the value from extensions.com don’t get passed to the func_odbc.conf . My output from the CLI is

Executing [6300@LocalSets:2] Set(“SIP/xxxSomeValuexxx-00000000”, “data_some()=$(SIP/xxxSomeValuexxx-00000000,6300,1235551212,Some Caller,20140417-201225”) in new stack

I’m not aware of any syntax with $() and nor, it seems, is your version of Asterisk.

Note General forums are discussion ones. Questions should be asked in Support ones.

Ok figured it out sharing with everyone.

extension.conf

[ConferenceRooms]
exten => 6300,1,NoOp()
        same => n,Set(data_some()=${CHANNEL},${EXTEN},${CALLERID(ani)},${CALLERID(name)},${STRFTIME(${EPOCH},,%Y-%m-%d-%H:%M:%S)})
        same => n,ConfBridge(${EXTEN})

func_odbc.conf

[some]
prefix=data
DSN=myDNS
writesql=INSERT INTO activeCalls(channel,showID, cid, fname, time) VALUES ('${SQL_ESC(${VAL1})}','${SQL_ESC(${VAL2})}','${SQL_ESC(${VAL3})}','${SQL_ESC(${VAL4})}','${SQL_ESC(${VAL5})}')