[Users] How to configure acc modue

Madhusudan.Jarhad at lntinfotech.com Madhusudan.Jarhad at lntinfotech.com
Wed Oct 18 11:28:04 CEST 2006


Dear All,
Here is very basic question from me.
I have installed openser 1.1.0. I want to record the CDR / Accounts of 
calles and messages being processed. I have acc module in my opense.cfg 
and parameter setting is as follows

# ----------------- SETTING MODULE-SPECIFIC PARAMETERS ---------------

## - - - - - - - - - - XLOG PARAMETERS - - - - - - - - - - - - - - -
modparam("xlog", "force_color", 0)

# - - - - - - - - - USRLOC PARAMS - - - - - - - - - - - - - - - - - -

#modparam("usrloc", "db_mode",   1)

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url", 
"mysql://openser:openserrw@localhost/openser")


# - - - - - - AUTH PARAMS - - - - - - - - - - - -
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
#modparam("alias_db", "user_column", "username")
modparam("auth_db", "password_column", "password")

##  - - - - - AUTH RADIUS - - - - -
#modparam("auth_radius", "radius_config", 
"/usr/local/etc/radiusclient-ng/radiusclient.conf")
#modparam("auth_radius", "service_type", 15)

##  - - - - - RR MODULE PARAMETERS - - - - -
# add value to ;lr param to make some broken UAs happy
 modparam("rr", "enable_full_lr", 1)
 modparam("rr", "append_fromtag", 1)
 modparam("rr", "enable_double_rr", 1)
 modparam("rr", "add_username", 1)

## - - - - -  ACCOUNTING PARAMETERS  - - - - - - - -
modparam("acc", "detect_direction", 1)
modparam("acc", "failed_transaction_flag", 1)
modparam("acc", "report_cancels",1)
modparam("acc", "report_ack", 1)
modparam("acc", "early_media", 1)
modparam("acc", "detect_direction", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 1)
#modparam("acc", "log_extra", "ua=$hdr(User-Agent);uuid=$avp(i:123)")
modparam("acc", "service_type", 15) # user 16 to set to Radius
modparam("acc", "db_flag", 2)
modparam("acc", "db_missed_flag", 3)
modparam("acc", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("acc", "db_table_acc", "acc")
modparam("acc", "db_table_missed_calls", "missed_calls")
modparam("acc", "db_missed_flag", 3)
modparam("acc", "acc_sip_method_column", "sip_method")
modparam("acc", "acc_from_uri_column", "from_uri")
modparam("acc", "acc_fromtag_column", "fromtag")
modparam("acc", "acc_to_uri_column", "to_uri")
modparam("acc", "acc_totag_column", "totag")
#modparam("acc", "acc_cseqno_column", "cseq_no")
modparam("acc", "acc_sip_callid_column", "sip_callid")
modparam("acc", "acc_time_column", "time")
# for mysql-based accouting, use the names of the columns
# for RADIUS-based accouting, use the names of the RADIUS AVPs
#modparam("acc", 
"multi_leg_info","RAD_LEG_SRC=$avp(src);RAD_LEG_SRC=$avp(dst)")

#modparam("acc", "multi_leg_info","leg_src=$avp(src);leg_dst=$avp(dst)")
#modparam("avpops", "avp_aliases", "uuid=I:50")
modparam("acc", "radius_config", 
"/usr/local/etc/radiusclient-ng/radiusclient.conf")
#modparam("acc", "radius_config", "/etc/openser/radius/client.conf")
#modparam("acc", "radius_flag", 2)
#modparam("acc", "diameter_missed_flag", 3)

#modparam("acc", "radius_extra",       "Sip-RPid=$avp(s:rpid) 
Source-IP=$si; Source-Port=$sp"
#                                        Canonical-URI=$avp($can_uri); \
# Billing-Party=$avp($billing_party); \
# Divert-Reason=$avp(s:divert_reason); \
#                                       X-RTP-Stat=$avp(s:rtp_statistics); 
\
#                                       From-Header=$hdr(from); \
#                                       User-Agent=$hdr(user-agent); \
#                                       Contact=$hdr(contact); \
#                                       Event=$hdr(event)")

## - - - - - - JABBER SERVER CONFIGURATION - - - - - - - - -
modparam("jabber", "jdomain", "jabber.sipserver.com=*")
modparam("jabber", "db_url", 
"mysql://openser:openserrw@localhost/openser")

modparam("jabber", "jdomain", "sipx.vshodc.lntinfotech.com")


## - - - - - - - - - - - SIPTRACE MODULES PARAMETERS - - - - - - - - -
modparam("siptrace", "trace_flag", 0)
modparam("siptrace", "db_url", 
"mysql://openser:openserrw@localhost/openser")
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "table", "sip_trace")
modparam("siptrace", "duplicate_uri", "sip:172.17.85.51:5888")



# -------------------------  request routing logic -------------------

# main routing logic

route{

## ADDED BY MADHUSUDAN
#    avp_write("caller_id", $avp(name); #"$uuid");
#    avp_printf("i:20", "$avp($uuid): $fu");
#    xdbg("$Cbgi:20$Cxx [$avp(i:20)] $Cbrcseq$Cxx=[$hdr(cseq)]\n");
# setflag(1); /* set for accounting (the same value as in log_flag!)*/
# t_relay();      /* enter stateful mode now */

##


        sip_trace();
#       xlog("L_ERR", "time [$Tf] method <$rm> r-uri <$ru> 2nd via 
<$hdr(via[1])>\n");
#       setflag(1); /* set for accounting (the same value as in 
log_flag!)*/
#       t_relay();      /* enter stateful mode now */

#       if (t_newtran()) {
#               log("UAS logic");
#               t_reply("999","hello");
#       } else sl_reply_error();

################
        if (t_local_replied("all")) {
                log ("no reply received\n");
        }

        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        };

        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                exit;
        };

        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        if (!method=="REGISTER")
                record_route();

        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
        };

        if (!uri==myself) {
                # mark routing logic in request
                append_hf("P-hint: outbound\r\n");
                # if you have some interdomain connections via TLS
                #if(uri=~"@tls_domain1.net") {
                #       t_relay("tls:domain1.net");
                #       exit;
                #} else if(uri=~"@tls_domain2.net") {
                #       t_relay("tls:domain2.net");
                #       exit;
                #}
                route(1);
        };

        # if the request is for other domain use UsrLoc
        # (in case, it does not work, use the following command
        # with proper names and addresses in it)
        if (uri==myself) {

                if (method=="REGISTER") {

                        # Uncomment this if you want to use digest 
authentication
                        #if (!www_authorize("openser.org", "subscriber")) 
{
                        #       www_challenge("openser.org", "0");
                        #       exit;
                        #};

                        save("location");
                        exit;
                };

                lookup("aliases");
                if (!uri==myself) {
                        append_hf("P-hint: outbound alias\r\n");
                        route(1);
                };

                # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        exit;
                };
                append_hf("P-hint: usrloc applied\r\n");
        };

        route(1);
}


route[1] {
        # send it out now; use stateful forwarding as it works reliably
        # even for UDP2TCP
        if (!t_relay()) {
                sl_reply_error();
        };

        exit;
}


onreply_route[1] {
        if (t_check_status("1[0-9][0-9]")) {
                setflag(1);
                log("provisional reply received\n");
                if (t_check_status("183"))
                        drop;
        }
        if (t_was_cancelled()) {
            log("transaction was cancelled by UAC\n");
        }

}

###################################################################
My need is to get the CDRs for events and volume  like MESSAGES and 
download/file transfer respectively.
Please help

______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20061018/5b66dc94/attachment.htm 


More information about the Users mailing list