Cannot insert data into database (func_ODBC)

Hello
I have some problems with using func_odbc
I’ve created table in my asterisk db.
Install func_odbc module

[code]ODBC DSN Settings

Name: asterisk
DSN: asterisk-connector
Last connection attempt: 1969-12-31 18:00:00
Pooled: No
Connected: Yes[/code]
I write it in func_odbc.conf

[RATE] prefix=GET dsn=asterisk writesql=INSERT INTO count_rating(extension,calldate,callerid,first_dest,uniqueid,rating) VALUES ('${VAL1}','${VAL2}','${VAL3}','${VAL4}','{VAL5},'${VAL6}')
Dialplan:

exten => 2,n,Set(a=${GET_RATE(${EXTEN})\,${DIALEDTIME}\,${CALLERID}\,${ORIG_DID}\,${UNIQUEID},\${EXTEN})})

But in database only one uniqueid is right inserted, another columns is empty or 0

Can anyone help me? What I’m doing wrong?

Just for curiosity what are you doing, a billing system ?

yep, also I have IVR. I have to count the chooses of users, who how many time chooses 1 or 2 etc.
I know that I can do it with CDR, but CDR counts all calls, I have to count only incoming calls with IVR.

You can use SQL queries against the CDR DB to filter and count incoming calls to the IVR , too could help if you place the IVR into an special context.

But there are problem, when I put my ivr another new context, I can’t call to that number with IVR.
It works only when I put it into [from-internal] context.

P.S: Did you mean that i can use userfield as ivr choice?

from-internal, it sounds like Freepbx. If this is your case let me give you an advice :

Many Asterisk newbies use Freepbx looking the Easiest Way to Accomplish Difficult Tasks . But at the end it is will be harder due to the Limitation of the GUI. You need to learn to write and debug your own dial plan. You cant develop an Asterisk billing system in a platform where you don’t have a clue of the dial plan. it doesnt make any sense.

Yep, it’s freepbx
But I also can make dial-plans, with dial-plan i’ve made ivr choices, conferences and trunks, connected to the CDR base, use odbc and so on. they choose freepbx because of this GUI settings, where they can easily make trunks, routings, internal numbers and such things. But I want to make more than simple settings))) I can’t change it to the another one, because it’s not in my competence.
So if freepbx it’s not possible?

Yes it is possible, but you could have issue debugging the Freepbx dial plan . it is a little bit more complicated using Freepbx but you can do it.