[OpenSIPS-Devel] CDR module for OpenSIPS control panel

Ярин Андрей Анатольевич a.yarin at is-telecom.ru
Mon Jan 28 08:45:17 CET 2013


Hello.

First of all sorry for my English - i usually not write or speak - i'm 
from Russia, so it's not my language.

I use opensips at my work and when i install OCP, i see, that CDR module 
not useful - i can't use it for analysis for call history - there is no 
information about source and destination calls. When i try to change 
this, i understand, that it's not easy - main logic released as stored 
procedure. Our MySQL specialist says that's easy write a php-script then 
write a new procedure.
Second reason for rewriting CDR module was that if someone want to 
change cdr output (add new information or modify existed), modify stored 
procedure need's some high skills in MySQL. Modify php-script is easy, 
because it's programming, as opensips main script or asterisk dialplan.

Installation:
1) In acc and cdrs tables need to add 2 columns - src & dst.
2) For acc module add in opensips.cfg string: modparam("acc", 
"db_extra", "src=$fU; dst=$rU")
3) Copy folder from tar.gz in folder cron_job
4) Edit config.php - MySQL parameters and logging (if no need, set path 
as NULL)
5) main.php must be executable.
6) Edit config/tools/system/cdrviewer/local.inc.php:
   a) change $show_field array:
     $show_field[1]['src'] = "From user" ;
     $show_field[2]['dst'] = "To user" ;
   b) add new fields to $export_csv array
     $export_csv[12]['src'] = "From user" ;
     $export_csv[13]['dst'] = "To user" ;
7) Edit crontab:
   */5     *       *       *       * 
/var/www/html/OpenSIPSCP/cron_job/generate-cdrs_mysql/main.php
8) PROFIT!

I think my version of CDR tool will be more useful than original.

PS: comments in script at russian, because i write it for myself, and  i 
couldn't even think to send it to You from the beginning. Script is very 
simple, and 90% copy functionality from original stored procedure, but 
in one place i found that some times from_tag and to_tag change places 
in pair INVITE-BYE, that stored procedure can't see, so i add check - if 
script cant found pair for BYE based on f_t, t_t, so he revert it and 
send MySQL SELECT again. Script work 2 month at test server and 1 month 
at work server with no errors.

-- 
Ярин Андрей
Инженер ООО "И.С.-Телеком"
8(351)2555724 доб 113
8(351)2555787 доб 113

-------------- next part --------------
A non-text attachment was scrubbed...
Name: generate-cdrs_mysql.tar.gz
Type: application/x-gzip
Size: 3342 bytes
Desc: not available
URL: <http://lists.opensips.org/pipermail/devel/attachments/20130128/6c805a1f/attachment-0001.bin>


More information about the Devel mailing list