[Kamailio-Devel] [ openser-Feature Requests-1703003 ] allow INTEGER radius avp for acc module

SourceForge.net noreply at sourceforge.net
Sat Aug 30 20:08:59 CEST 2008


Feature Requests item #1703003, was opened at 2007-04-18 10:23
Message generated for change (Comment added) made by osas
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743023&aid=1703003&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver devel
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ovidiu Sas (osas)
Assigned to: Nobody/Anonymous (nobody)
Summary: allow INTEGER radius avp for acc module

Initial Comment:
This is an offshot of:
http://openser.org/pipermail/devel/2007-April/006990.html
http://openser.org/pipermail/devel/2007-April/007134.html

==

I was trying to add an extra attribute to radius accounting packets,
specifically the "Acct-Session-Time" attribute.  The type for this
attribute is integer:

ATTRIBUTE       Acct-Session-Time       46      integer


By inspecting the radius accounting packets that are sent by openser
to the radius server, it looks like the value passed inside is a
string:

for a call duration of 813s the attribute looks like:
2e 06 00 33 31 38

2e -> 46:Acct-Session-Time
06 -> length
00
33 -> ascii: 3
31 -> ascii: 1
38 -> ascii: 8

Is it possible to insert integer attributes as an avp from the acc module?
Is this a bug (the module should be able to insert integer attributes)?
Or the design is to pass _only_ string attributes?


Snippets from the config file:

modparam("acc", "radius_config",
"/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_flag", 1)
modparam("acc", "radius_extra", "Acct-Session-Time=$avp(i:921)")


#the accounting section:

        if (is_method("BYE")) {
                xlog("L_INFO", "dialog_status:$DLG_status
duration=$DLG_lifetime\n");
                $avp(i:921) = $DLG_lifetime{s.int};
        } else {
                $avp(i:921) = 0;
        }
        setflag(1);

----------------------------------------------------------------------

>Comment By: Ovidiu Sas (osas)
Date: 2008-08-30 14:08

Message:
Logged In: YES 
user_id=1395524
Originator: YES

Hello Juha,

I haven't looked into this one in a long time.
It should be pretty easy to reproduce just by loading the dialog module
and inserting the config snippet that I provided.
When I get a chance, I will take a look at it and try to reproduce it, but
AFAIK this issue came up several times on the mailing list and on the irc,
so it is still present.

Regards,
Ovidiu Sas

----------------------------------------------------------------------

Comment By: Juha Heinanen (juhe)
Date: 2008-08-30 12:45

Message:
Logged In: YES 
user_id=1332122
Originator: NO

ovidiu,

i took a look at this and it appears that currently there is no way to add
integer valued extra attribute to acc radius query.  the piece of code that
processes extra attributes is this

		if(value.flags&PV_VAL_NULL) {
			/* convert <null> to empty to have consistency */
			val_arr[n].s = 0;
			val_arr[n].len = 0;
		} else {
			/* set the value into the acc buffer */
			if (value.rs.s+value.rs.len==static_detector) {
				val_arr[n].s = int_buf + r*INT2STR_MAX_LEN;
				val_arr[n].len = value.rs.len;
				memcpy(val_arr[n].s, value.rs.s, value.rs.len);
				r++;
			} else {
				val_arr[n] = value.rs;
			}
		}

as you, it does not test if value would be PV_VAL_INT.  even if it would
test it, there is currently no way to indicate in val_arr, whose elements
are of type str, that a value is integer.

in your example

modparam("acc", "radius_extra", "Acct-Session-Time=$avp(i:921)")

is value of $avp(i:921) integer?  if so, i don't understand how you could
get its value as string in Acct-Session-Time attribute.

-- juha



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743023&aid=1703003&group_id=139143



More information about the Devel mailing list