[Serusers] Radius Accounting Message Format.

Ricardo Martinez rmartinez at redvoiss.net
Wed Sep 1 23:04:57 CEST 2004


Hi.
	I succesfully install the auth and acc modules for SER.  I'm trying
to keep track for the duration of a "local" (or between two registered user
agents in SER) call.  I understand that for a PSTN or Gateway call the
Accounting record is placed by the terminating gateway, but i'm interesting,
as i mentioned, in the local calls.  I copy two accounting records from my
RADIUS server for a local call, as you can see i don't have any parameter
indicating the duration of the call or even timstamps.  Do i have to set
anything else in my ser.cfg file?.  I'm also attaching my ser.cfg.

Code:       Accounting-Request
Attributes:
	Acct-Status-Type = Start
	Service-Type = Sip-Session
	Sip-Response-Code = 200
	Sip-Method = 1
	User-Name = "5552408196 at xx.xx.xx.246"
	Calling-Station-Id = "sip:5552408196 at xx.xx.xx.246"
	Called-Station-Id = "sip:005622408196 at xx.xx.xx.246"
	Sip-Translated-Req-ID = "sip:005622408196 at xx.xx.xx.50:5060"
	Acct-Session-Id =
"95e15442-5f12-fae4-805e-0002a400f1e9 at xx.xx.xx.242"
	Sip-To-Tag = "4a419534a4"
	Sip-From-Tag = "9542fa5ea4"
	Sip-Cseq = "33"
	NAS-IP-Address = 127.0.0.1
	NAS-Port = 5060
	Acct-Delay-Time = 0

Code:       Accounting-Request
Attributes:
	Acct-Status-Type = Stop
	Service-Type = Sip-Session
	Sip-Response-Code = 200
	Sip-Method = 8
	User-Name = "5552408196 at xx.xx.xx.246"
	Calling-Station-Id = "sip:5552408196 at xx.xx.xx..246"
	Called-Station-Id = "sip:005622408196 at xx.xx.xx.xx.246"
	Sip-Translated-Req-ID = "sip:005622408196 at xx.xx.xx.50"
	Acct-Session-Id =
"95e15442-5f12-fae4-805e-0002a400f1e9 at xx.xx.xx.xx.242"
	Sip-To-Tag = "4a419534a4"
	Sip-From-Tag = "9542fa5ea4"
	Sip-Cseq = "34"
	NAS-IP-Address = 127.0.0.1
	NAS-Port = 5060
	Acct-Delay-Time = 0


#
# $Id: ser.cfg,v 1.21.2.2 2003/10/13 22:53:06 jiri Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

debug=0         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes        # (cmd line: -E)

#Uncomment these lines to enter debugging mode 
#fork=no
#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/textops.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"

# ----------------- setting module-specific parameters ---------------

# ----------------- 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/radiuscl
ient.conf")
modparam("auth_radius","service_type",15)
modparam("acc","radius_config","/usr/local/etc/radiusclient/radiusclient.con
f")
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)

#group radius
modparam("group_radius","radius_config","/usr/local/etc/radiusclient/radiusc
lient.conf")
modparam("group_radius", "use_domain", 1)
 


# -------------------------  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 (len_gt( 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
        if (!method=="REGISTER") record_route();

        if (method=="BYE") setflag(1);

        # 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);
                break;
        };

        if (!uri==myself) {
                # mark routing logic in request
                append_hf("P-hint: outbound\r\n"); 
                route(1);
                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)
        if (uri==myself) {

                if (method=="REGISTER") {


                        # Challenge/Response 
                        if ( !radius_www_authorize("")) {
                                www_challenge("", "1");
                                break;
                        };

                        # Si es un Request Autenticado, Update Contact
Database ahora (Ricardo Martinez)
                        if (!save("location")) {
                                sl_reply_error();
                        };
                        break;
                };

        };
        #Proceso el trafico local hacia la PSTN (Ricardo Martinez)

        #Busco el Username Canonico? (Ricardo Martinez)
        lookup("aliases");

        #Chequeamos los destinos 00562 es enviado al gateway
        if (uri=~"^sip:00562[0-9]{7}@.*") {
                route(3);
                break;
        };


        #Llamadas SIP locales
        #Off-line o usuarios que no existen (Ricardo Martinez)
        if (!lookup("location")) {
                route(4);
                break;
        };


        #Flag para el modulo de acc para reportar "Missed Calls" al syslog
(Ricardo Martinez)
        setflag(3);

        #Do it ? (Ricardo Martinez)
        append_hf("P-hint: USRLOC\r\n");
        if (!t_relay()) {
                sl_reply_error();
                break;
        };

} /* end of initial routing logic */

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


#------- Route 3 : Trafico de Internet hacia la PSTN -------------------

route[3] {

        # Agregamos record route para todas las llamadas.
        record_route();

        #Autentificamos al usuario
        #PRONTO

        if (method=="INVITE") {
                setflag(1);
                # Aca en la eventualidad van los chequeos de Saldo y
llamadas LD, LDI, Local, etc
        };

        rewritehostport("XX.XX.XX.XX:5060");
        append_hf("P-hint: GATEWAY\r\n");

        if (!t_relay()) {
                sl_reply_error();
                break;
        };



}


#------ Route 4 : Llamadas a usuarios Off-line ------------------------

route[4] {

        if (!t_newtran()) {
                sl_reply_error();
        };

        if (!t_reply("404", "Not Found")) {
                sl_reply_error();
        };
        break;
}



Any ideas?
Thanks in advance.

Ricardo Martinez.-




More information about the sr-users mailing list