Asterisk 13.3+PJSIP cdr odbc error on pickup call&att.trasf

Hi,

I don’t want to log in cdr my internal calls and this work fine. But when I pickup a call or I do an attended transfer there is a big problem with cdr…

First of all, my cdr backends is odbc mysql, pickup code is *8 , xfer transfer code is *7

my extensions.conf is:

exten => _20[01],1,Set(CDR_PROP(disable)=true)
exten => _20[01],2,Dial(${CENTRALINO},${TIMEOUT},tTrkKxXwW)

exten => _2[234]X,1,Set(CDR_PROP(disable)=true)
exten => _2[234]X,n,GoSub(subInterni,s,1(${EXTEN}))

exten => _*8.,1,Set(CDR_PROP(disable)=true)
exten => _*8.,n,PickupChan(PJSIP/${EXTEN:2})
exten => _*8.,n,Hangup()

I have this scenario:

  1. 227 call 221
  2. 240 pickup the call with *8221 (work fine)
  3. 240 (or 227) hangup

Now I don’t want to log in my cdr this call but in cli I have:

WARNING[14324]: cdr_odbc.c:145 execute_cb: 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 ‘2015-04-07 10:34:00’},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

[Apr 7 10:34:09] WARNING[14324]: res_odbc.c:612 ast_odbc_direct_execute: SQL Execute error! Verifying connection to asteriskcdr [asteriskcdr]…

[Apr 7 10:34:09] WARNING[14324]: cdr_odbc.c:145 execute_cb: 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 ‘2015-04-07 10:34:00’},?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

[Apr 7 10:34:09] ERROR[14324]: cdr_odbc.c:174 odbc_log: CDR direct execute failed

I have the same problem when I try to make an attended transfer…

Why? I don’t want to log this internal call in my cdr…

External calls are logged fine in cdr…

Can someone help me?

Thank you…

The normal mistake people make is assuming that uniqueid is a unique key for the CDR.

However, more generally, Channel Event Logging was developed because CDRs don’t work well for non-trivial cases, and your cases are non-trivial in this respect.

@David55,

sincerely I didn’t understand what you say…
What do you mean with “non-trivial cases”?
Why “exten => _*8.,1,Set(CDR_PROP(disable)=true)” doesn’t work?

Thank you…

Anything more complex than just Dial.

Can you suggest me a way to solve my problem?

Thanks a lot…

Assuming this is the common problem with databases and CDRs, remove the unique or primary key constraint from the uniqueid column, but expect the CDRs to be difficult to use for non-trivial calls, or use channel event logging instead of CDRs.

Ok, I will use CEL instead of CDRs, but I would like to know why
"exten => _*8.,1,Set(CDR_PROP(disable)=true)" is not working…

Thank you very much…

I’m not familiar with CDR_PROP; I’ve just given you the normal reason that people get database errors for transferred calls.