[RADIATOR] Some information lost during Diameter to Radius conversion

Arthur kasjas at hot.ee
Mon Mar 31 02:30:34 CDT 2014


30.03.2014 22:27, Heikki Vatiainen kirjutas:
> On 03/30/2014 11:47 AM, Arthur wrote:
>
>> It seems that some tuning needed. I've the following hook code:
>> sub
>> {
>>      my $d=${$_[0]};
>>      my $r=${$_[1]};
>>      my $si = $d->get(873, 10415);
>>      my $sub_id = $si->get(443, 0);
>> It produced an error:
>> ERR: Error in PostDiaToRadiusConversionHook():
>> Can't call method "get" without a package or object reference at (eval
>> 44) line 6.
> Oops, sorry for that. Try get_attr instead of get.
>
> I created my code snippet from memory and used get() which returns the
> undecoded value. With get_attr you should get decoded values. For
> grouped attributes these returns object references than can be again
> used with get_attr to get the grouped attributes.
>

Thanks, I got it.

Now I have the next question. My Diameter request contains multiple with 
the same name AVP-s. For instance:

Service-Information: VM.,
    IMS-Information: VM.,
       SDP-Session-Description: VM., v=0
       SDP-Session-Description: VM., o=- 640284584 403958478 IN IP4 
94.50.86.245
       SDP-Session-Description: VM., s=-
       SDP-Session-Description: VM., c=IN IP4 94.50.120.5
       SDP-Session-Description: VM., t=0 0

I have tried to add the following code to my hook for enumerating all 
entries and making fake attributes like 'SDP-Session-Description-n':

     my $ims_info = $si->get_attr(876, 10415); # IMS-Information (grouped)
     my $nn;
     if (my @avpair = $ims_info->get_attr(842, 10415)) {      # 
SDP-Session-Description
        $nn = 0;
        foreach my $avpair (@avpair) {
            $nn = $nn + 1;
            $r->add_attr("SDP-Session-Description-".$nn, $avpair);
        }
        $r->add_attr('SDP-Session-Description-Count', $nn);
     }

but I got only the first one:

   SDP-Session-Description-1 = v=0
   SDP-Session-Description-Count = 1


How it possible to expand my output with all values?
Thanks in advance.

br,
Arthur



More information about the radiator mailing list