[OpenSIPS-Users] drouting - acc issue version 1.7

Răzvan Crainea razvan at opensips.org
Fri Jun 27 09:29:29 CEST 2014


Hi Russ!

If you need to determine the call duration, you should use the CDR flag[1].
Also note that 1.7 is no longer supported, so you might miss important 
fixes of the acc module. I strongly suggest you to upgrade to a newer 
version.

[1] http://www.opensips.org/html/docs/modules/1.7.x/acc#id294995

Best regards,

Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 06/27/2014 01:57 AM, Russ East wrote:
> Hi guys.
>
> I've been running opensips 1.7 for a couple years without an issue. Had
> been routing based on IP, but now need to add destination based routing
> and generating accounting records.  Followed my printed manual for 1.7
> and also guides that I found on the internet.  The issue I am running
> into looks to be some sort of timer loop.  I also get 22 records for
> each call in the acc table. Each showing there was a BYE and a "200" but
> no way to determine a call duration from the 200 to the BYE.
>
> I have been at this all week, trying different things and cannot find a
> solution.  I hope someone can point out an obvious mistake for a simple
> fix.
>
>
> Config and dr table data below...
>
> Thanks,
> Russ East
>
>
>
>
>
> ##################### Global Parameters #######################
> debug=3
> log_stderror=no
> log_facility=LOG_LOCAL0
> fork=yes
> children=4
> port=5060
> listen=udp:osip:5060
> disable_tcp=yes
> auto_aliases=no
> check_via=yes
> dns=off
> rev_dns=off
> server_header="Server: ComSIP"
> server_signature = yes
> user_agent_header="User-Agent: ComSIP"
> db_default_url="mysql://opensips:opensipsrw@localhost/opensips"
>
> ##################### Modules Section ######################
> mpath="//lib64/opensips/modules/"
> loadmodule "db_mysql.so"
> loadmodule "signaling.so"
> loadmodule "sl.so"
> loadmodule "tm.so"
> loadmodule "rr.so"
> loadmodule "maxfwd.so"
> loadmodule "usrloc.so"
> loadmodule "registrar.so"
> loadmodule "textops.so"
> loadmodule "mi_fifo.so"
> loadmodule "uri.so"
> loadmodule "acc.so"
> loadmodule "dialog.so"
> loadmodule "drouting.so"
> loadmodule "load_balancer.so"
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
> modparam("rr", "append_fromtag", 0)
>
> # -- dlg (dialog) params --
> # dialog default dlg_match_mode is preset to 0 (did cookie only)
> # This is changing it to first try the did cookie, then try SIP element
> matching
> #    Need to do this because Amity2 does not include the did cookie in BYEs
> modparam("dialog", "dlg_match_mode", 1)
>
> # ------- drouting params -------
> modparam("drouting", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips")
> modparam("drouting", "probing_interval", 49)
> modparam("drouting", "probing_from", "sip:100 at osip")
> modparam("drouting", "probing_method", "OPTIONS")
> modparam("drouting", "probing_reply_codes", "501, 403, 404")
>
> # -- lb (load_balancer) params --
> modparam("load_balancer", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips")
> modparam("load_balancer", "db_table", "load_balancer")
> modparam("load_balancer", "probing_interval", 41)
> modparam("load_balancer", "probing_method", "OPTIONS")
> modparam("load_balancer", "probing_from", "sip:100 at osip")
> modparam("load_balancer", "probing_reply_codes", "400")
>
> modparam("usrloc", "db_mode",   0)
> modparam("uri", "use_uri_table", 0)
>
> # -- acc params --
> modparam("acc", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")
> modparam("acc", "db_flag", 1)
> modparam("acc", "db_missed_flag", 2)
> modparam("acc", "log_extra",
> "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd")
> modparam("acc", "db_extra",
> "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd")
> modparam("acc", "report_cancels", 1)
> modparam("acc", "detect_direction", 0)
> modparam("acc", "failed_transaction_flag", 3)
>
> route[4] {
>          t_on_failure("4");
>          xlog(" DRT:   $si   CLI: $fU  DST: $tU   To: $rd\n");
>          t_relay();
>
>    exit;
> }
>
> ####### Routing Logic ########
> route{
>          if (!mf_process_maxfwd_header("10")) {
>                  sl_send_reply("483","Too Many Hops");
>                  exit;
>          }
>
>          if (is_method("BYE")) {
>                  xlog(" BYE    $si   CLI: $fU  DST: $tU To: $rd\n");
>          }
>
>     # sequential requests
>          if (has_totag()) {
>                  loose_route();
>                  t_relay();
>                  exit;
>          }
>
>     # Initial Requests
>          record_route();
>          if (is_method("CANCEL")) {
>                  xlog(" CANCEL $si   CLI: $fU  DST: $tU To: $rd\n");
>                  if (t_check_trans())
>                          t_relay();
>                  exit;
>          }
>          if (!is_method("INVITE")) {
>                  send_reply("405","Not Allowed");
>                  exit;
>          }
>
>          if (is_method("INVITE")) {
>
>                  if ( do_routing("0") ) {
>                          setflag(1);  # ACCounting - create CDR
>                          route(4);
>                  }
>                  else {
>                          xlog(" DRT:   $si   CLI: $fU  DST: $tU   No
> More Routes\n");
>                          t_reply("503","Service not available");
>                  }
>          }
> }
>
>
> failure_route[4] {
>
>          if (t_was_cancelled()) {
>                  xlog(" CANCEL $si   CLI: $fU  DST: $tU To: $rd\n");
>                  exit;
>          }
>          if (t_check_status("[3-6][0-9][0-9]")) {
>                  exit;
>          }
>
>          if (use_next_gw()) {
>                  t_on_failure("5");
>                  xlog(" DRT:   $si   CLI: $fU  DST: $tU Re-routeTo:
> $rd\n");
>                  t_relay();
>                  exit;
>          }
>          else {
>                  xlog(" DRT:   $si   CLI: $fU  DST: $tU   No More
> Routes\n");
>                  t_reply("503","Service not available");
>                  exit;
>          }
> }
>
> failure_route[5] {
>
>          if (t_was_cancelled()) {
>                  xlog(" CANCEL $si   CLI: $fU  DST: $tU To: $rd\n");
>                  exit;
>          }
>          if (t_check_status("[3-6][0-9][0-9]")) {
>                  exit;
>          }
>
>          xlog(" DRT:   $si   CLI: $fU  DST: $tU   No More Routes\n");
>          t_reply("503","Service not available");
>          exit;
>
> }
> ###################### END OF CONFIG ###############################
>
> mysql> select * from acc;
> +-------+--------+------------+---------------+-----------------------------------------+----------+------------+---------------------+--------+-----------------+----------------+-------------+-------------+
>
> | id    | method | from_tag   | to_tag        |
> callid                                  | sip_code | sip_reason |
> time                | src_ip | dst_user        | dst_domain     |
> src_user    | src_domain  |
> +-------+--------+------------+---------------+-----------------------------------------+----------+------------+---------------------+--------+-----------------+----------------+-------------+-------------+
>
> | 36604 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36605 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36606 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36607 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36608 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36609 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36610 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36611 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36612 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36613 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36614 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36615 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36616 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36617 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36618 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36619 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36620 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36621 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36622 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36623 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36624 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> | 36625 | BYE    | as28fda4c7 | 87C21310-1AD0 |
> U2GUTJRMHVCT3CBVR37FCIGJTE at 81.201.85.45 | 200      | OK         |
> 2014-06-26 21:44:57 |        | 507733170807153 | 173.251.68.251 |
> 14025221938 | voxbone.com |
> +-------+--------+------------+---------------+-----------------------------------------+----------+------------+---------------------+--------+-----------------+----------------+-------------+-------------+
>
>
>
>
> mysql> select * from dr_gateways;
> +------+------+-----------------+-------+----------------+-------+------------+---------------------------------------------+
>
> | gwid | type | address         | strip | pri_prefix     | attrs |
> probe_mode | description                                 |
> +------+------+-----------------+-------+----------------+-------+------------+---------------------------------------------+
>
> |    2 |    1 | 173.251.68.251  |     0 |                | NULL
> |          0 | Test DRT 33170807153 To NY                  |
> +------+------+-----------------+-------+----------------+-------+------------+---------------------------------------------+
>
>
> mysql> select * from dr_groups;
> Empty set (0.00 sec)
>
> mysql> select * from dr_gw_lists;
> Empty set (0.00 sec)
>
> mysql> select * from dr_rules;
> +--------+---------+------------------+---------+----------+---------+--------+-------+-------------------------------------+
>
> | ruleid | groupid | prefix           | timerec | priority | routeid |
> gwlist | attrs | description                         |
> +--------+---------+------------------+---------+----------+---------+--------+-------+-------------------------------------+
>
> |      3 | 0       | 507733170807153  |         |        0 |         |
> 2      | NULL  | Test DRT 33170807153 To NY          |
> +--------+---------+------------------+---------+----------+---------+--------+-------+-------------------------------------+
>
>
>
>
> ---
> This email is free from viruses and malware because avast! Antivirus
> protection is active.
> http://www.avast.com
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list