ODBC func problem

Hello,
i got problem with getting asterisk send queries to db via odbc functions.

this is what i have done:
installed odbc packages(unixODBC,unixODBC-bin,unixODBC-dev,libmyodbc)
recompiled asterisk with these modules cdr_odbc, cdr_adaptive_odbc, func_odbc, func_realtime, pbx_realtime, res_config_odbc and res_odbc

/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1

/etc/odbc.ini
[asterisk-connector]
Description= MySQL connection to asterisk database
Driver=MySQL
Database=asterisk
Server=localhost
UserName=root
Password=passwd123
Port=3306
Socket=/var/run/mysqld/mysqld.sock

/etc/asterisk/res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => root
password => passwd123
pooling => no
limit => 1
pre-connect => yes

this is my dial plan:
exten=> _XXXXX,1,NoOp()
same=>n,Set(E=${EXTEN})
same=>n,Set(USER=GET_USERDATA(${E}))
same=>n,Dial(SCCP/${E},120)
same=>n,Goto(s-${DIALSTATUS},1)

exten=>s-BUSY,1,NoOp(CALLS_MISSED(${USER},${E},'BUSY'))
same=>n,Hangup()

exten=>s-CANCEL,1,NoOp(CALLS_MISSED(${USER},${E},'CANCEL'))
same=>n,Hangup()

exten=>s-CHANUNAVAIL,1,NoOp(CALLS_MISSED(${USER},${E},'CHANNELUNAVAIL'))
same=>n,Hangup()

exten=>s-NOANSWER,1,NoOp(CALLS_MISSED(${USER},${E},'NOANSWER'))
same=>n,Hangup()

exten=>s-ANSWER,1,NoOp(CALLS_INCOMMING(${USER},${E}))
same=>n,Hangup()


and here are the function:
[MISSED]
prefix=CALLS
dsn=asterisk
writesql=INSERT INTO missedcalls (callername,callednumber,status) VALUES ('${ARG1}','${ARG2}','${ARG3}')

[INCOMMING]
prefix=CALLS
dsn=asterisk
writesql=INSERT INTO incomming (callername,callednumber) VALUES ('${ARG1}','${ARG2}')

Problem is nothing in db changes and i don’t know if i missed something or not.
thanks for help

Oh i forgot to add:
Asterisk version 11.13.0
Debian 64bit
MySQL 5.5 (both mysql-server and mysql-client installed)

(phones register to asterisk correctly and i can dial bettwen them)
don’t know if this info will help.

Hi,
after long period of time, i find out that odbc function works (tried them in asterisk cli)
the problem was in dialplan , i left calling of the odbc functions in NoOp() which does nothing by itself :smile:.
So here comes my new dialplan:

exten=> _XXXXX,1,NoOp()
same=>n,Set(GLOBAL(E)=${EXTEN})
same=>n,Set(GLOBAL(USER)=${GET_USERDATA(${E})})
same=>n,Set(GLOBAL(MCALLER)=${CALLERID(name)})
same=>n,Set(CALLS_PLACEDCALLS()=${MCALLER},${E},BEFORECALL,${USER})
same=>n,Dial(SCCP/${E},60)
same=>n,Set(CALLS_PLACEDCALLS()=${MCALLER},${E},${DIALSTATUS},${USER})

Function PLACEDCALLS() looks:

[PLACEDCALLS]
prefix=CALLS
dsn=asterisk
writesql=INSERT INTO missedcalls (callername,callednumber,status,calledname) VALUES ('${VAL1}','${VAL2}','${VAL3}')

My current problem is this, PLACEDCALLS() before Dial() is corectly called by asterisk and write corectly to database, but the PLACEDCALLS() after Dial() is not reached by asterisk at all. I don’t know if it’s SCCP-b channel thing, but it doesn’t matter if call is answered or not, it allways ends in Dial.

So please if someone is more knowleable with dialplans with SCCP channel and point me to right way, i would be very happy. :smile:

You should have Set(CALLS_PLACEDCALLS()=${MCALLER},${E},${DIALSTATUS},${USER}) in your h extension

–Satish Barot

[quote=“satish4asterisk”]You should have Set(CALLS_PLACEDCALLS()=${MCALLER},${E},${DIALSTATUS},${USER}) in your h extension

–Satish Barot[/quote]

You mean like extension.h, i never heard of it :frowning: could you please point me to source from where you know it from.
Thanks

Check https://wiki.asterisk.org/wiki/display/AST/Special+Dialplan+Extensions and http://www.voip-info.org/wiki/view/Asterisk+h+extension
–Satish Barot

[quote=“satish4asterisk”]Check https://wiki.asterisk.org/wiki/display/AST/Special+Dialplan+Extensions and http://www.voip-info.org/wiki/view/Asterisk+h+extension
–Satish Barot[/quote]
Thanks A lot :smile: