[OpenSIPS-Users] Regarding cdrs table in opensips

Nandini madhu sermj2012 at gmail.com
Tue Aug 6 14:57:38 CEST 2013


Hi all,

I am using opensips-1.9.1-tls vaersion. And opensips-cp-5.0.

I am able to see some changes in acc table after made calling between
clients.

But i did't see any changes in cdrs table.

I loaded dialog module and enabled cdr_flag in acc.

Please help me to solve this issue.

Here is my accounting module parameters:
#### ACCounting module
loadmodule "acc.so"
modparam("acc", "failed_transaction_flag", "FAIL_TRANS_FLAG")
modparam("acc", "report_cancels", 1)
##modparam("acc", "report_ack", 0)
modparam("acc", "early_media", 0)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", "LOG_FLAG")
modparam("acc", "log_missed_flag", "LOG_MISSED_FLAG")
modparam("acc", "db_flag", "DB_FLAG")
modparam("acc", "cdr_flag", "CDR_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")
modparam("acc", "db_extra",
"src_uri=$fU;caller_domain=$fd;dst_uri=$rU;callee_domain=$rd;legtype=$avp(s:LEG)")

And this is my script

# main request routing logic

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")) {
                create_dialog();
                setflag(TRACE_FLAG);
                setflag(DB_FLAG); # do accounting ...
                setflag(CDR_FLAG); # ... 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(DB_FLAG); # 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;
    ##}

}

Kindly help me

Thanks in advance

Regards

sermj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130806/a47b1dfc/attachment.htm>


More information about the Users mailing list