[Users] Auth_Radius, AVP_Radius, AVOPOS Hex Value Bug
Lenir
lenirsantiago at yahoo.com
Tue Nov 8 07:51:09 CET 2005
Hello list,
I'm using openser 1.0 and I'm using auth_radius and avp_radius to retrieve
all my user's preferences via AVPs. Everything works very well except, that
I cannot retrieve AVPs with value of i:0xhex. I'm trying to implement the
ACL example in http://www.voice-system.ro/docs/avpops/ar01s08.html
In my radius config I have the following:
UserName Attribute op Value
Sipuser SIP-AVP = #102#0x08
In my openser.cfg I have the following:
...
if (uri=~"^sip:[0-9]{10}@") {
# Send to PSTN Gateway
xlog("L_N", " DOMESTIC CALL: from $fU to $rU\n");
if (avp_check("i:102", "and/i:0x01")) {
route(4); #NAT Test
route(5); #PSTN Route
} else {
xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
check $fU's ACL\n");
sl_send_reply("503", "Service Unavailable");
};
return;
};
...
This is the debug message that I get from openser:
0(25052) ERROR:auth_radius:extract_avp: invalid AVP numrical value '0x08'
# ------------------------------------------------------------------------
So I tried to cheat, by copying i:102 to a temporary AVP i:302 with the N
flag to convert the string to numerical value, like so:
UserName Attribute op Value
Sipuser SIP-AVP = #102:0x08
Openser.cfg:
if (uri=~"^sip:[0-9]{10}@") {
# Send to PSTN Gateway
if (avp_copy("i:102","i:302/n") && avp_check("i:302", "and/i:0x01"))
{
route(4); #NAT Test
route(5); #PSTN Route
} else {
xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
check $fU's ACL\n");
sl_send_reply("503", "Service Unavailable");
};
return;
};
This is the debug message that I get from openser:
0(25135) ERROR:avpops:copy_avp: cannot convert str to int
# ------------------------------------------------------------------------
And finally, I tried to force it by having the value as string, but try to
use the ANDing op, like so:
UserName Attribute op Value
Sipuser SIP-AVP = #102:0x08
Openser.cfg:
...
if (uri=~"^sip:[0-9]{10}@") {
# Send to PSTN Gateway
if (avp_check("i:102", "and/i:0x01")) {
route(4); #NAT Test
route(5); #PSTN Route
} else {
xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
check $fU's ACL\n");
sl_send_reply("503", "Service Unavailable");
};
return;
};
...
This is the debug message that I get from openser:
0(25140) ERROR:avpops:check_avp: value types don't match
# ------------------------------------------------------------------------
It seems to me that the problem lies in auth_radius by not allowing
extraction of AVPs with numerical values in hex. If we can get that work
work, I think the rest should work fine without any alterations.
Thanks for your help in advance!
Lenir
More information about the sr-users
mailing list