[OpenSIPS-Users] put value of header field into AVP

Brett Nemeroff brett at nemeroff.com
Fri Jun 12 16:56:58 CEST 2009


Yeah you can do this. You should really review the wiki for such questions,
it's all there :)
Try the select transformation:
http://www.opensips.org/Resources/DocsCoreTran15#toc6


$var(x) = "12,34,56";
$(var(x){s.select,1,,}) => "34" ;



So you can:
$avp(s:parseablestring)='1.2.3.4_9.8.7.6';
$avp(s:gateway)=$(avp(s:parseablestring){s.select,1,_});

now $avp(s:gateway) = 9.8.7.6; # Note: 0 is the first field, not 1

And yes, very cool. :)

-Brett

On Fri, Jun 12, 2009 at 9:38 AM, Uwe Kastens <kiste at kiste.org> wrote:

> Hi,
>
> Thanks, this is very cool.
>
> Is there a way to split one avp without perl in a handfull of differnt
> avps or is better to work with different header files?
>
> Maybe some more background to that question. My pstn gw should send some
> information for later usage in routing etc.pp. (main number and ddi
> number,  in which place should the number with ddi be sent to the UA).
> So I was wondering if I use one header and split the variables on the
> opensips or let the pstn gw insert more than one header field (if
> needed). ATM I would prefer to work with different headers.
>
> BR
>
> Uwe
>
>
> Jeff Pyle schrieb:
> > Generically, avp(s:oneavp) = $hdr(SIP-Header)
> >
> > String translations also work here, such as:
> >  $avp(s:oneavp) = $(hdr(P-Charge-Info){uri.user})
> >
> >
> >
> > - Jeff
> >
> >
> >
> > On 6/12/09 9:49 AM, "Uwe Kastens" <kiste at kiste.org> wrote:
> >
> >> Hi,
> >>
> >> How can I put the value of a header field in one AVP?
> >>
> >> BR
> >>
> >> Uwe
> >
> >
>
>
> --
>
> kiste lat: 54.322684, lon: 10.13586
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090612/682ec3ce/attachment.htm 


More information about the Users mailing list