D
D
Dmitry Tallmange2014-08-25 10:16:05
JavaScript
Dmitry Tallmange, 2014-08-25 10:16:05

Asterisk 12 ODBC bug or crooked hands?

I'm trying to get CDR to work through the ODBC driver.

sip*CLI> core show version
Asterisk 12.5.0 built by ubuntu @ sip.xxxxxx on a x86_64 running Linux on 2014-07-25 04:57:36 UTC
sip*CLI> module show like odbc
Module                         Description                              Use Count  Status
cdr_adaptive_odbc.so           Adaptive ODBC CDR backend                0          Running
cdr_odbc.so                    ODBC CDR Backend                         0          Running
cel_odbc.so                    ODBC CEL backend                         0          Running
func_odbc.so                   ODBC lookups                             0          Running
res_config_odbc.so             Realtime ODBC configuration              0          Running
res_odbc.so                    ODBC resource                            0          Running
6 modules loaded
sip*CLI> odbc show all

ODBC DSN Settings
-----------------

  Name:   asteriskcdrdb
  DSN:    MySQL-asteriskcdrdb
    Last connection attempt: 1970-01-01 05:00:00
  Pooled: No
  Connected: Yes

sip*CLI> cdr show status

Call Detail Record (CDR) settings
----------------------------------
  Logging:                    Enabled
  Mode:                       Simple
  Log unanswered calls:       Yes
  Log congestion:             No

* Registered Backends
  -------------------
    ODBC
    csv
    cdr-custom
    Adaptive ODBC
    cdr_manager

At the moment when the asterisk has to make a record, the following happens:
[2014-08-25 12:14:58] WARNING[7049] cdr_odbc.c: cdr_odbc: Error in ExecDirect: -1, query is: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ({ts '2014-08-25 12:14:39'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[2014-08-25 12:14:58] WARNING[7049] res_odbc.c: SQL Execute error! Verifying connection to asteriskcdrdb [MySQL-asteriskcdrdb]...
[2014-08-25 12:14:58] WARNING[7049] cdr_odbc.c: cdr_odbc: Error in ExecDirect: -1, query is: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ({ts '2014-08-25 12:14:39'},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[2014-08-25 12:14:58] ERROR[7049] cdr_odbc.c: CDR direct execute failed

The strangest thing is that the "?" substitutions are not finished in the request body. on the field values.
Next, I query the ODBC driver to make sure it's not the problem:
root@sip:/var/log/asterisk# echo 'insert into asteriskcdrdb.cdr (calldate) VALUES ("0000-00-00 00:00:00");' | isql -v MySQL-asteriskcdrdb asteriskuser 2Nv6kUAtRrC76y7jL
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> insert into asteriskcdrdb.cdr (calldate) VALUES ("0000-00-00 00:00:00");
SQLRowCount returns 1
root@sip:/var/log/asterecho 'select * from asteriskcdrdb.cdr;' | isql -v MySQL-asteriskcdrdb asteriskuser 2Nv6kUAtRrC76y7jL
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select * from asteriskcdrdb.cdr;
SQLRowCount returns 1
1 rows fetched

Thus, it turns out that the asterisk itself generates an incorrect request.
Topic with no answers on the asterisk forum.
Has anyone come across?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Ridz, 2016-07-11
@littleguga

Why search when you already have everything...

current_elem.checkboxDiv.addEventListener('click', function() {
           hide(current_elem.cardDiv);
        },false);

D
Dmitry Tallmange, 2014-08-25
@p00h

@rostel

root@sip:/var/log/asterisk# cat /etc/asterisk/res_odbc.conf | grep -v "^;"

#include res_odbc_custom.conf
#include res_odbc_additional.conf
root@sip:/var/log/asterisk# cat /etc/asterisk/cdr_odbc.conf | grep -v "^;"

[global]
dsn=asteriskcdrdb
loguniqueid=yes
dispositionstring=yes
table=cdr		;"cdr" is default table name
usegmtime=no             ; set to "yes" to log in GMT
hrtime=yes		;Enables microsecond accuracy with the billsec and duration fields

V
Vladimir, 2014-08-25
@rostel

value substitution occurs after confirmation is received that the prepared expression is accepted by the server
show the output

cat /etc/asterisk/res_odbc.conf | grep -v "^;"
cat /etc/asterisk/cdr_odbc.conf | grep -v "^;"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question