Yate Community Forum

General Category => Yate users hangout place => Topic started by: jehanzaib_kiani on August 13, 2014, 08:21:30 PM

Title: cdr not working
Post by: jehanzaib_kiani on August 13, 2014, 08:21:30 PM
hi guys,
i have hard time to configure the cdr thingy. i can make calls without any issue but i also want to log my call record in the cdr table of database. i can register users using db without any issue.

for cdr i have changed the below lines. cant see anything in the table and also on the console. i am on the debug level 9. can anyone guide me please

[call.cdr]
; Queries for the CDR updating message

cdr_initialize=INSERT INTO yate_cdr VALUES(NULL, '${time}', '${billid}', '${chan}', '${address}', '${caller}', '${called}', '${billtime}', '${ringtime}', '${duration}', '${direction}', '${status}',
 '${reason}', 0)


cdr_update=UPDATE yate_cdr SET address = '${address}', direction = '${direction}', billid = '${billid}', caller = '${caller}', called = '${called}',
duration = '${duration}', billtime = '${billtime}', ringtime  = '${ringtime}', status = '${status}', reason = '${reason}'
WHERE chan = ${chan}' AND time = CAST(${time} AS UNSIGNED)

cdr_finalize=UPDATE yate_cdr SET address = '${address}', direction = '${direction}', billid = '${billid}', caller = '${caller}', called = '${called}',
duration = '${duration}', billtime = '${billtime}', ringtime = '${ringtime}', status = '${status}', reason = '${reason}', ended = 1 WHERE chan = '${chan}'
AND time = CAST(${time} AS UNSIGNED)
Title: Re: cdr not working
Post by: Monica Tepelus on August 14, 2014, 05:13:04 AM
Hi,

Did you enable  "call.cdr=yes" in general section?
Did you set the database account? Are your queries run? Do you see them failing?

Also you should make sure that the order of the columns in the INSERT query matches the the one in the table structure, otherwise modify the query or set the columns name. You should also make sure the queries are appropriate for the database type. The one in the default file are for postgres. Check in docs.yate.ro for mysql queries.

http://docs.yate.ro/wiki/Register#Section_.5Bcall.cdr.5D
Title: Re: cdr not working
Post by: jehanzaib_kiani on August 14, 2014, 10:07:26 PM
Ok all done, thanks now i can save the cdr fine. for some reason default query had errors. i changed to the column name and it seems fine now.
just not getting any value in ${reason} variable

Title: Re: cdr not working
Post by: jehanzaib_kiani on August 14, 2014, 10:51:01 PM
i am liking yate, i am going to use yate as my SBC. My billing is written on the other RTP servers so when i send calls to them the customer IP is ofcorse overwritten with my SBC IP.
because my RTP sees the call from yate and RTP thinks this is the customer IP. the only piece left is yate_cdr integration with my own billing. thats what i am acheiving by saving yate_cdr.
any idea how can i send yate cdr id in the SIP INVITE to other rtp servers? so on RTP i can extrat these headers and look for the real customer IP from the yate_cdr
Title: Re: cdr not working
Post by: asymetrixs on August 17, 2014, 02:13:58 AM
You can for example introduce a custom SIP header field in call.route like osip_OriginalID=${billid} which then is put into the SIP Header as sip_OriginalID.

Moreover, take care when using connection pooling! Sometimes the finalize-statement hits the database server before initialize-statement, read:
http://docs.yate.ro/wiki/Register
http://docs.yate.ro/wiki/Register_Database_Schema  (upsert)
Title: Re: cdr not working
Post by: jehanzaib_kiani on August 18, 2014, 07:58:39 PM
ah you mean i can introduce a custom sip header in register.conf?
like

[call.route]

yate_call_id = ${billid}

Title: Re: cdr not working
Post by: jehanzaib_kiani on August 26, 2014, 02:13:17 AM
got it osip_Yatebillid=${billid}
workin

cheers!