[Serusers] Accounting for 480 or 404 codes using "radius_does_uri_exist"

Rafael J. Risco G.V rafael_rgv at yahoo.com
Mon Aug 2 23:55:14 CEST 2004


Hello  
At this time I am able to save Logs for the following Sip-Response-Codes with radius accounting module: 
- 486 Busy,
- 487 Request cancelled by the caller and
- 408 Request timeout (No callee response).
 
But now I would like to log other missed calls with codes 480 or 404 (Temporarily unavailable or Not Existing user) returned if lookup fails using "radius_does_uri_exist" function, please if its posible send me some examples to do it.  

Thank You
Rafael
 
PS: cfg file and some radius logs:
[root at gkproxy01 127.0.0.1]# more /usr/local/etc/ser/ser.cfg
#
# $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
# ----------- global configuration parameters ------------------------
# debug=3         # debug level (cmd line: -dddddddddd)
# fork=yes
# log_stderror=no        # (cmd line: -E)
#/* Uncomment these lines to enter debugging mode 
debug=20
fork=yes
log_stderror=yes
#*/
check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
#loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
# loadmodule "/usr/local/lib/ser/modules/uri.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
# loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
loadmodule "/usr/local/lib/ser/modules/group_radius.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
# load the NAT Helper Module
# loadmodule "/usr/local/lib/ser/modules/nathelper.so"
# ----------------- setting module-specific parameters ---------------
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# modparam("acc","log_level",1)
modparam("auth_radius","radius_config","/usr/local/etc/radiusclient/radiusclient.conf")
modparam("auth_radius","service_type",15)
modparam("acc","radius_config","/usr/local/etc/radiusclient/radiusclient.conf")
modparam("acc", "service_type", 15)
modparam("acc", "radius_flag", 1)
modparam("acc", "radius_missed_flag", 3)
modparam("acc", "failed_transactions", 1)
modparam("acc", "report_ack", 0)
# -------------------------  request routing logic -------------------
# main routing logic
route{
        # 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");
                break;
        };
        if ( msg:len > max_len ) {
                sl_send_reply("513", "Message too big");
                break;
        };
        # 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
        record_route();
        # loose-route processing
        if (loose_route()) {
                t_relay();
                break;
        };

        # 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)
        # set for accounting:
     
                if (method=="INVITE") {
                log(1, "INVITE\n");
                setflag(1); /* set for accounting (the same value as in log_flag!) */
                };
                if (method=="BYE" || method=="CANCEL") {
                log (1, "BYE or CANCEL\n");
                setflag(1);
                };
        if (uri==myself) {
                if (method=="REGISTER") {
                        log(1, "REGISTER: Authenticating user\n");
                       if (!radius_www_authorize("")) {
                                log(1, "REGISTER: challenging user\n");
                                www_challenge("", "0");
                                break;
                        };
                        save("location");
                        break;
                };
        # Prefix 9 to AS5350-PSTN:
        if (uri =~"^sip:9[0-9]*@") {
        log(1, "forward to PSTN\n");
        rewritehostport("200.110.2.145:5060");
        #forward( 200.110.2.145, 5060 );
        t_relay_to_udp("200.110.2.145","5060");
        break;
        };

               # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        break;
                };
        };

        # forward to current uri now; use stateful forwarding; that
        # works reliably even if we forward from TCP to UDP
        if (!t_relay()) {
                sl_reply_error();
                break;
        };
}
 
 
 
Radius Log File:
Mon Aug  2 15:57:11 2004
        Acct-Status-Type = Failed
        Service-Type = IAPP-Register
        Sip-Response-Code = 487
        Sip-Method = Invite
        User-Name = "6603000 at 200.110.2.131"
        Calling-Station-Id = "sip:6603000 at 200.110.2.131"
        Called-Station-Id = "sip:6604000 at 200.110.2.131"
        Sip-Translated-Request-URI = "sip:6604000 at 200.110.6.58"
        Acct-Session-Id = "7d5d8400-a74c-8b11-820d-0002a40055b2 at 10.0.0.236"
        Sip-To-Tag = "n/a"
        Sip-From-Tag = "7d008b0da4"
        Sip-CSeq = "137"
        NAS-IP-Address = 127.0.0.1
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 127.0.0.1
        Acct-Unique-Session-Id = "fec6c176c6abce27"
        Timestamp = 1091480231
Mon Aug  2 15:57:33 2004
        Acct-Status-Type = Failed
        Service-Type = IAPP-Register
        Sip-Response-Code = 486
        Sip-Method = Invite
        User-Name = "6603000 at 200.110.2.131"
        Calling-Station-Id = "sip:6603000 at 200.110.2.131"
        Called-Station-Id = "sip:6604000 at 200.110.2.131"
        Sip-Translated-Request-URI = "sip:6604000 at 200.110.6.58"
        Acct-Session-Id = "985d8400-4a12-351e-8210-0002a40055b2 at 10.0.0.236"
        Sip-To-Tag = "61408ca7a4"
        Sip-From-Tag = "98003510a4"
        Sip-CSeq = "138"
        NAS-IP-Address = 127.0.0.1
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 127.0.0.1
        Acct-Unique-Session-Id = "9d2bb0985c4518a4"
        Timestamp = 1091480253
Mon Aug  2 16:00:08 2004
        Acct-Status-Type = Failed
        Service-Type = IAPP-Register
        Sip-Response-Code = 408
        Sip-Method = Invite
        User-Name = "6603000 at 200.110.2.131"
        Calling-Station-Id = "sip:6603000 at 200.110.2.131"
        Called-Station-Id = "sip:6604000 at 200.110.2.131"
        Sip-Translated-Request-URI = "sip:6604000 at 200.110.6.58"
        Acct-Session-Id = "035e8400-fc20-e27c-8213-0002a40055b2 at 10.0.0.236"
        Sip-To-Tag = "de40b2aaa4"
        Sip-From-Tag = "0300e213a4"
        Sip-CSeq = "139"
        NAS-IP-Address = 127.0.0.1
        NAS-Port = 5060
        Acct-Delay-Time = 0
        Client-IP-Address = 127.0.0.1
        Acct-Unique-Session-Id = "e9e00ae9aa66422a"
        Timestamp = 1091480408
 



---------------------------------
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.
Visíta Yahoo! Noticias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20040802/c8ac3a2d/attachment.htm>


More information about the sr-users mailing list