[Users] Cisco-like Radius accounting

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Nov 2 15:05:13 CET 2006


Hi Dimo,

you can upload your example on the wiki page for an easy sharing....

thanks and regards,
bogdan

Dimo wrote:

> Hi,
> I have a radius accounting configuration I would like to share, if
> someone needs. Please can I get your feedback guys if this can be done
> in a better way. Just share your thoughts if you have done something
> similar.
> I need to account to my RADIUS the source IP (of the calling UA), the
> destination IP (called UA/gw) and the type of the leg - originating or
> terminating depending on whether the call is from the UA or to the UA.
> To do this I decided to use the cisco vendor-specific radius AVPs
> which have similar fields but for h323 calls.
> In my dictionary file of radiusclient-ng i added this according to the
> cisco specification:
> VENDOR Cisco                                9
> ATTRIBUTE Cisco-AVPair                  1       string  Cisco
> ATTRIBUTE H323-remote-address      23      string  Cisco
> ATTRIBUTE H323-call-origin              26      string  Cisco
>
> and in my openser.cfg i have:
> modparam("acc", "radius_extra", "Cisco-AVPair=$avp(s:c_src_ip);
> H323-remote-address=$avp(s:c_dst_ip);
> H323-call-origin=$avp(s:c_origin); Cisco-AVPair=$avp(s:c_call_id)")
>
> Now in my config i fill in the values of the c_src_ip, c_dst_ip,
> c_origin, and c_call_id avps according to the direction of the call.
> Here is how i do it for the originating leg, terminating is similar:
>
> route[14] { #ACCOUNT ORIGINATING
> if (is_direction("downstream")) {
>        avp_printf("$avp(s:c_src_ip)", "call-origin-endpt=$si");
>        avp_printf("$avp(s:c_dst_ip)", "$ru");
>        avp_subst("$avp(s:c_dst_ip)", 
> "/sip:.*@(.*)/h323-remote-address=\1/g");
>        avp_subst("$avp(s:c_dst_ip)", "/(.*):.*/\1/g");
>        avp_printf("$avp(s:c_origin)", "h323-call-origin=originate");
>        avp_printf("$avp(s:c_call_id)", "call-id=$ci");
>        }
> if (is_direction("upstream")) {
>        avp_printf("$avp(s:c_src_ip)", "$ru");
>        avp_subst("$avp(s:c_src_ip)", 
> "/sip:.*@(.*)/call-origin-endpt=\1/g");
>        avp_subst("$avp(s:c_src_ip)", "/(.*):.*/\1/g");
>        avp_printf("$avp(s:c_dst_ip)", "h323-remote-address=$si");
>        avp_printf("$avp(s:c_origin)", "h323-call-origin=originate");
>        avp_printf("$avp(s:c_call_id)", "call-id=$ci");
>        }
>
> setflag(2);
> }
>
>
> Now as you can see i take one of the IP addresses from the request-uri
> (and strip it with avp_subst), which I am not sure if always contains
> IP. Is there a better way - i can call this route after
> rewritehostport or lookup so the destination IP will hopefully be in
> the r-uri of the message, but maybe there is a better way of getting
> it?
> Any input/ideas will be greatly appreciated.
>
> Best,
> Dimo
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>





More information about the Users mailing list