[OpenSIPS-Users] Regarding opensips-cp 5.0

Mike Tesliuk mike at ultra.net.br
Sun Aug 4 10:05:42 CEST 2013


The acc table:

CREATE TABLE `acc` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `method` char(16) NOT NULL DEFAULT '',
  `from_tag` char(64) NOT NULL DEFAULT '',
  `to_tag` char(64) NOT NULL DEFAULT '',
  `callid` char(64) NOT NULL DEFAULT '',
  `sip_code` char(3) NOT NULL DEFAULT '',
  `sip_reason` char(32) NOT NULL DEFAULT '',
  `time` datetime NOT NULL,
  `cdr_id` bigint(11) NOT NULL DEFAULT '0',
  `duration` int(11) unsigned NOT NULL DEFAULT '0',
  `setuptime` int(11) unsigned NOT NULL DEFAULT '0',
  `created` datetime DEFAULT NULL,
  `src_uri` varchar(250) DEFAULT NULL,
  `caller_domain` varchar(250) DEFAULT NULL,
  `dst_uri` varchar(250) DEFAULT NULL,
  `callee_domain` varchar(250) DEFAULT NULL,
  `legtype` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `callid_idx` (`callid`)
) ENGINE=MyISAM AUTO_INCREMENT=61660 DEFAULT CHARSET=latin1


Modparam extra information:

modparam("acc", "db_extra",
"src_uri=$fU;caller_domain=$fd;dst_uri=$rU;callee_domain=$rd;legtype=$avp(s:LEG)")


On your route you need to call the DB_FLAG where you call the ACC_DO

With this you should get in your acc table the INVITE and BYE method, with
this information, the stored procedure from opensips-cp should work fine.


2013/8/2 Nandini madhu <sermj2012 at gmail.com>

> Hi Mike Tesliuk,
>
> Thank for your prompt response. I am giving you the acc module parameters
> in from my table and also the script.
> Please have a glance on these and help me
>
> Acc table:
> +------------+------------------+------+-----+---------+----------------+
> | Field      | Type             | Null | Key | Default | Extra          |
> +------------+------------------+------+-----+---------+----------------+
> | id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
> | method     | char(16)         | NO   |     |         |                |
> | from_tag   | char(64)         | NO   |     |         |                |
> | to_tag     | char(64)         | NO   |     |         |                |
> | callid     | char(64)         | NO   | MUL |         |                |
> | sip_code   | char(3)          | NO   |     |         |                |
> | sip_reason | char(32)         | NO   |     |         |                |
> | time       | datetime         | NO   |     | NULL    |                |
> | cdr_id     | bigint(11)       | NO   |     | 0       |                |
> | duration   | int(11) unsigned | NO   |     | 0       |                |
> | setuptime  | int(11) unsigned | NO   |     | 0       |                |
> | created    | datetime         | YES  |     | NULL    |                |
> +------------+------------------+------+-----+---------+----------------+
> 12 rows in set (0.00 sec)
>
> And this is my script:
>
>
> loadmodule "acc.so"
> modparam("acc", "failed_transaction_flag", 1)
> modparam("acc", "report_cancels",     0)
> ##modparam("acc", "report_ack",         0)
> modparam("acc", "early_media",        0)
> modparam("acc", "log_level",          1)
> modparam("acc", "log_flag",           1)
> modparam("acc", "log_missed_flag",    1)
> modparam("acc", "cdr_flag", "CDR_FLAG")
> modparam("acc", "db_flag", "DB_FLAG")
> modparam("acc", "db_missed_flag", "DB_MISSED_FLAG")
>
> modparam("acc", "db_url", "mysql://opensips:opensipsrw@opensips/opensips")
> modparam("acc", "db_table_acc", "acc")
> modparam("acc", "acc_method_column", "method")
> modparam("acc", "acc_from_tag_column", "from_tag")
> modparam("acc", "acc_to_tag_column", "to_tag")
> modparam("acc", "acc_callid_column", "callid")
> modparam("acc", "acc_sip_code_column", "sip_code")
> modparam("acc", "acc_sip_reason_column", "sip_reason")
> modparam("acc", "acc_time_column", "time")
>
> route{
>     if (!mf_process_maxfwd_header("10")) {
>         sl_send_reply("483","Too Many Hops");
>         exit;
>     }
>
>     if (has_totag()) {
>         # sequential requests within a dialog should
>         # take the path determined by record-routing
>         if (loose_route()) {
>             if (is_method("BYE")) {
>                 setflag(ACC_DO); # do accounting ...
>                 setflag(ACC_FAILED); # ... even if the transaction fails
>             } else if (is_method("INVITE")) {
>                 # even if in most of the cases is useless, do RR for
>                 # re-INVITEs alos, as some buggy clients do change route
> set
>                 # during the dialog.
>                 record_route();
>             }
>
>             # route it out to whatever destination was set by loose_route()
>             # in $du (destination URI).
>             route(relay);
>         } else {
>             if ( is_method("ACK") ) {
>                 if ( t_check_trans() ) {
>                     # non loose-route, but stateful ACK; must be an ACK
> after
>                     # a 487 or e.g. 404 from upstream server
>                     t_relay();
>                     exit;
>                 } else {
>                     # ACK without matching transaction ->
>                     # ignore and discard
>                     exit;
>                 }
>             }
>             sl_send_reply("404","Not here");
>         }
>         exit;
>     }
>
>     # CANCEL processing
>     if (is_method("CANCEL"))
>     {
>         if (t_check_trans())
>             t_relay();
>         exit;
>     }
>
>     t_check_trans();
>
>     if ( !(is_method("REGISTER")  ) ) {
>         if (from_uri==myself)
>         {
>         } else {
>             # if caller is not local, then called number must be local
>             if (!uri==myself) {
>                 send_reply("403","Rely forbidden");
>                 exit;
>             }
>         }
>     }
>
>     # preloaded route checking
>     if (loose_route()) {
>         xlog("L_ERR",
>         "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
>         if (!is_method("ACK"))
>             sl_send_reply("403","Preload Route denied");
>         exit;
>     }
>
>     # record routing
>     if (!is_method("REGISTER|MESSAGE"))
>         record_route();
>
>     # account only INVITEs
>     if (is_method("INVITE")) {
>         setflag(ACC_DO); # do accounting
>     }
>
>
>     if (!uri==myself) {
>         append_hf("P-hint: outbound\r\n");
>         route(relay);
>     }
>
>     # requests for my domain
>     if (is_method("PUBLISH|SUBSCRIBE"))
>     {
>         sl_send_reply("503", "Service Unavailable");
>         exit;
>     }
>
>     if (is_method("REGISTER"))
>     {
>         if (   0 ) setflag(TCP_PERSISTENT);
>
>         if (!save("location"))
>             sl_reply_error();
>
>         exit;
>     }
>
>     if ($rU==NULL) {
>         # request with no Username in RURI
>         sl_send_reply("484","Address Incomplete");
>         exit;
>     }
>
>     # do lookup with method filtering
>     if (!lookup("location","m")) {
>         t_newtran();
>         t_reply("404", "Not Found");
>         exit;
>     }
>
>     # when routing via usrloc, log the missed calls also
>     setflag(ACC_MISSED);
>     route(relay);
> }
>
>
> route[relay] {
>     # for INVITEs enable some additional helper routes
>     if (is_method("INVITE")) {
>         t_on_branch("per_branch_ops");
>         t_on_reply("handle_nat");
>         t_on_failure("missed_call");
>     }
>
>     if (!t_relay()) {
>         send_reply("500","Internal Error");
>     };
>     exit;
> }
>
>
> branch_route[per_branch_ops] {
>     xlog("new branch at $ru\n");
> }
>
>
> onreply_route[handle_nat] {
>
>     xlog("incoming reply\n");
> }
>
>
> failure_route[missed_call] {
>     if (t_was_cancelled()) {
>         exit;
>     }
>
>     # uncomment the following lines if you want to block client
>     # redirect based on 3xx replies.
>     ##if (t_check_status("3[0-9][0-9]")) {
>     ##t_reply("404","Not found");
>     ##    exit;
>     ##}
>
> }
>
> Thanks in advance.
>
> Regards
> sermj
>
>
> On Fri, Aug 2, 2013 at 2:16 AM, Mike Tesliuk <mike at ultra.net.br> wrote:
>
>> The CDR module from opensips-cp use the table cdrs, the acc module use
>> the table acc , the opensips-cp use a procedure on mysql to get the
>> information from acc and generate the data on cdrs, this happen through a
>> cron script .
>>
>> you need to generate the accounting to your INVITE too, becuase the
>> procedore check the INVITE and BYE status on the acc table.
>>
>>
>>
>>
>>
>>
>> 2013/8/1 Nandini madhu <sermj2012 at gmail.com>
>>
>>> Dear Shahzad,
>>> Greetings.
>>>
>>> Thanks for the input i will try as per your suggestions and get back to
>>> you.
>>>
>>> Regards,
>>> sermj
>>>
>>>
>>> On Wed, Jul 31, 2013 at 8:55 PM, Muhammad Shahzad <shaheryarkh at gmail.com
>>> > wrote:
>>>
>>>> The acc module params are missing flags for db, you only have flags for
>>>> logging, which actually logs acc data to syslog, also note that flags MUST
>>>> be quoted strings as integer flags have been deprecated in opensips 1.9.x.
>>>> See below link for details,
>>>>
>>>> http://www.opensips.org/html/docs/modules/1.9.x/acc.html#id293425
>>>>
>>>> Thank you.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jul 31, 2013 at 12:07 PM, Nandini madhu <sermj2012 at gmail.com>wrote:
>>>>
>>>>> Dear Shahzad,
>>>>>
>>>>> I have tried the above options to know the status. But still i am
>>>>> facing the same problem.
>>>>>
>>>>> I am giving my acc module configuration list please have a glance and
>>>>> advice me please.
>>>>>
>>>>> loadmodule "acc.so"
>>>>> modparam("acc", "failed_transaction_flag", 1)
>>>>> modparam("acc", "report_cancels",     0)
>>>>> ##modparam("acc", "report_ack",         0)
>>>>> modparam("acc", "early_media",        0)
>>>>> modparam("acc", "log_level",          1)
>>>>> modparam("acc", "log_flag",           1)
>>>>> modparam("acc", "log_missed_flag",    1)
>>>>> modparam("acc", "cdr_flag", 1)
>>>>> modparam("acc", "db_url", "mysql://opensips:opensipsrw@opensips
>>>>> /opensips")
>>>>> modparam("acc", "db_table_acc", "acc")
>>>>> modparam("acc", "acc_method_column", "method")
>>>>> modparam("acc", "acc_from_tag_column", "from_tag")
>>>>> modparam("acc", "acc_to_tag_column", "to_tag")
>>>>> modparam("acc", "acc_callid_column", "callid")
>>>>> modparam("acc", "acc_sip_code_column", "sip_code")
>>>>> modparam("acc", "acc_sip_reason_column", "sip_reason")
>>>>> modparam("acc", "acc_time_column", "time")
>>>>>
>>>>> i have given super privileges to opensips user in mysql database
>>>>>
>>>>> Please advice
>>>>>
>>>>> regards
>>>>> sermj
>>>>>
>>>>>
>>>>> On Wed, Jul 31, 2013 at 1:09 PM, Nandini madhu <sermj2012 at gmail.com>wrote:
>>>>>
>>>>>> Dear Shahzad,
>>>>>>
>>>>>> Thank you for your prompt response. i will follow your suggestions
>>>>>> and let you know thank you.
>>>>>>
>>>>>> regards
>>>>>> sermj
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 31, 2013 at 11:48 AM, Muhammad Shahzad <
>>>>>> shaheryarkh at gmail.com> wrote:
>>>>>>
>>>>>>> Check if,
>>>>>>>
>>>>>>> 1. you have set required module parameters for acc module as well,
>>>>>>> most importantly accounting flags.
>>>>>>> 2. you have set those accounting flags in appropriate routes in
>>>>>>> opensips.cfg.
>>>>>>> 3. you acc table is accessible and permitted for opensips (check
>>>>>>> connection string, the user used in it is allowed to insert rows in acc
>>>>>>> table etc).
>>>>>>> 4. you can connect to mysql or whatever backend you are using, and
>>>>>>> see acc table is being populated by opensips during / end of calls.
>>>>>>> 5. your opensips-cp has correct db connection string set to access
>>>>>>> acc table.
>>>>>>>
>>>>>>> one of above should solve your problem.
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jul 31, 2013 at 8:06 AM, Nandini madhu <sermj2012 at gmail.com>wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I am using opensips-cp 5.0 . domain andrtpproxy modules are working
>>>>>>>> fine on myserver (opensips-1.9.1-tls). But i am unable to see CDRviewer in
>>>>>>>> my GUI.
>>>>>>>>
>>>>>>>> I hav loaded required acc module parameters in opensips.cfg file.
>>>>>>>>
>>>>>>>> Please help me
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> sermj
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Mit freundlichen Grüßen
>>>>>>> Muhammad Shahzad
>>>>>>> -----------------------------------
>>>>>>> CISCO Rich Media Communication Specialist (CRMCS)
>>>>>>> CISCO Certified Network Associate (CCNA)
>>>>>>> Cell: +49 176 99 83 10 85
>>>>>>> MSN: shari_786pk at hotmail.com
>>>>>>> Email: shaheryarkh at googlemail.com
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opensips.org
>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Mit freundlichen Grüßen
>>>> Muhammad Shahzad
>>>> -----------------------------------
>>>> CISCO Rich Media Communication Specialist (CRMCS)
>>>> CISCO Certified Network Associate (CCNA)
>>>> Cell: +49 176 99 83 10 85
>>>> MSN: shari_786pk at hotmail.com
>>>> Email: shaheryarkh at googlemail.com
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130804/d21f0217/attachment-0001.htm>


More information about the Users mailing list