put value of header field into AVP

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

put value of header field into AVP

Uwe Kastens
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: put value of header field into AVP

Brett Nemeroff
It's been a while since I needed this but try:
$avp(s:foovalue) = $hdr(X-Foo-Value);



On Fri, Jun 12, 2009 at 8:49 AM, Uwe Kastens <[hidden email]> 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: put value of header field into AVP

Jeff Pyle
In reply to this post by Uwe Kastens
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" <[hidden email]> wrote:

> Hi,
>
> How can I put the value of a header field in one AVP?
>
> BR
>
> Uwe


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: put value of header field into AVP

Uwe Kastens
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" <[hidden email]> 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: put value of header field into AVP

Brett Nemeroff
Yeah you can do this. You should really review the wiki for such questions, it's all there :)

Try the select transformation:


$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 <[hidden email]> 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" <[hidden email]> 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: put value of header field into AVP

Uwe Kastens
Hi Brett,

> Yeah you can do this. You should really review the wiki for such
> questions, it's all there :)

Believe it or not, I searched a long time - but rather at the wrong place.

>
> Try the select transformation:
> http://www.opensips.org/Resources/DocsCoreTran15#toc6
>
>
> $var(x) = "12,34,56";
> $(var(x){s.select,1,,}) => "34" ;
>

Exactly what I wanted to have ....

Thanks a lot
BR

uwe
--

kiste lat: 54.322684, lon: 10.13586

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users