Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the *x-route-tag* value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060;* x-route-tag="tgrp:TANDEM-KOR"*
On 11/30/2010 01:58 PM, alex pappas wrote:
Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the *x-route-tag* value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060 http://10.0.0.15:5060;*x-route-tag="tgrp:TANDEM-KOR"*
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
Cheers, Marius
On 11/30/10 4:07 PM, marius zbihlei wrote:
On 11/30/2010 01:58 PM, alex pappas wrote:
Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the *x-route-tag* value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060 http://10.0.0.15:5060;*x-route-tag="tgrp:TANDEM-KOR"*
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
just as alternative, in this case it should works also with selects variables, you can try:
$sel(via.params[x-route-tag])
Cheers, Daniel
Daniel hi,
When I'm trying the bellow I get the following error:
Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [select.c:149]: parse_select: invalid index, no closing ] Dec 1 10:06:17 opensips1 kamailio: ERROR: pv [pv_select.c:45]: invalid select name [@via.params[x-route-tag]] Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [pvapi.c:550]: pvar "sel" has an invalid name param [@via.params[x-route-tag]] Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [pvapi.c:705]: wrong char [)/41] in [$sel(@via.params[x-route-tag])] at [29 (5)] Dec 1 10:06:17 opensips1 kamailio: : <core> [cfg.y:3328]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 705, column 23-52: unknown script pseudo variable $sel(@via.params[x-route-tag])
I also added an @ before the via
if (search("x-route-tag")) { $avp(s:xroutetag) = $sel(*@*via.params[x-route-tag]); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
Thank you Alex
On Tue, Nov 30, 2010 at 10:47 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
On 11/30/10 4:07 PM, marius zbihlei wrote:
On 11/30/2010 01:58 PM, alex pappas wrote:
Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the *x-route-tag* value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060;* x-route-tag="tgrp:TANDEM-KOR"*
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
just as alternative, in this case it should works also with selects variables, you can try:
$sel(via.params[x-route-tag])
Cheers, Daniel
-- Daniel-Constantin Mierla Kamailio (OpenSER) Advanced Training Jan 24-26, 2011, Irvine, CA, USAhttp://www.asipto.com
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello
I think you should try:
$sel(@via[1].params[x-route-tag])
Marius ________________________________________ From: alex pappas [rebel.pappas@gmail.com] Sent: Wednesday, December 01, 2010 9:09 AM To: Daniel-Constantin Mierla Cc: Marius Zbihlei; sr-users@lists.sip-router.org Subject: Re: [SR-Users] VIA header x-route-tag
Daniel hi,
When I'm trying the bellow I get the following error:
Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [select.c:149]: parse_select: invalid index, no closing ] Dec 1 10:06:17 opensips1 kamailio: ERROR: pv [pv_select.c:45]: invalid select name [@via.params[x-route-tag]] Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [pvapi.c:550]: pvar "sel" has an invalid name param [@via.params[x-route-tag]] Dec 1 10:06:17 opensips1 kamailio: ERROR: <core> [pvapi.c:705]: wrong char [)/41] in [$sel(@via.params[x-route-tag])] at [29 (5)] Dec 1 10:06:17 opensips1 kamailio: : <core> [cfg.y:3328]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 705, column 23-52: unknown script pseudo variable $sel(@via.params[x-route-tag])
I also added an @ before the via
if (search("x-route-tag")) { $avp(s:xroutetag) = $sel(@via.params[x-route-tag]); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
Thank you Alex
On Tue, Nov 30, 2010 at 10:47 PM, Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com> wrote:
On 11/30/10 4:07 PM, marius zbihlei wrote: On 11/30/2010 01:58 PM, alex pappas wrote: Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the x-route-tag value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060http://10.0.0.15:5060;x-route-tag="tgrp:TANDEM-KOR"
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
just as alternative, in this case it should works also with selects variables, you can try:
$sel(via.params[x-route-tag])
Cheers, Daniel
-- Daniel-Constantin Mierla Kamailio (OpenSER) Advanced Training Jan 24-26, 2011, Irvine, CA, USA http://www.asipto.com
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
On 12/1/10 9:34 AM, Marius Zbihlei wrote:
Hello
I think you should try:
$sel(@via[1].params[x-route-tag])
indeed, selects need a bit of care regarding documentation -- they come from SER and I added pseudo-variable class $sel(selectid) to be able to use them whenever a PV can be used.
The list of selects and some description can be found at: http://sip-router.org/docbook/sip-router/branch/master/select_list/select_li...
Regarding this case, what I found working is:
$sel(via[1].params["x-route-tag"])
Even it works without a index for via, my tests resulted in an error (probably a bug somewhere, since was looking for via header 2345191). I will try too look more into it.
Cheers, Daniel
Thank you Daniel,
That works great.
Cheers Alex
On Wed, Dec 1, 2010 at 12:23 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Hello,
On 12/1/10 9:34 AM, Marius Zbihlei wrote:
Hello
I think you should try:
$sel(@via[1].params[x-route-tag])
indeed, selects need a bit of care regarding documentation -- they come from SER and I added pseudo-variable class $sel(selectid) to be able to use them whenever a PV can be used.
The list of selects and some description can be found at:
http://sip-router.org/docbook/sip-router/branch/master/select_list/select_li...
Regarding this case, what I found working is:
$sel(via[1].params["x-route-tag"])
Even it works without a index for via, my tests resulted in an error (probably a bug somewhere, since was looking for via header 2345191). I will try too look more into it.
Cheers, Daniel
-- Daniel-Constantin Mierla Kamailio (OpenSER) Advanced Training Jan 24-26, 2011, Irvine, CA, USA http://www.asipto.com
Marius hi,
Thank you for your replay. With the regular expression you provided me I get "*SIP/2.0/UDP 172.16.0.13:5060;tgrp:TNDEM-ACR*"
Can I isolate only *tgrp:TNDEM-ACR ?
*Thank you Alex * * On Tue, Nov 30, 2010 at 5:07 PM, marius zbihlei marius.zbihlei@1and1.rowrote:
On 11/30/2010 01:58 PM, alex pappas wrote:
Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the *x-route-tag* value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060;* x-route-tag="tgrp:TANDEM-KOR"*
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
Cheers, Marius
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello Alex,
Can't test it right now, but it should work better with this :
$var(s:xroutetag) = $(hdr(Via){re.subst,/^.*;x-route-tag="(.*)"/\1/})
You want to substitute (only affects $var) the whole via header with the regex found between () and referenced by \1. Keep in mind that Daniel's solution is more elegant and should work for you.
Marius
________________________________________ From: alex pappas [rebel.pappas@gmail.com] Sent: Wednesday, December 01, 2010 9:15 AM To: Marius Zbihlei Cc: sr-users@lists.sip-router.org Subject: Re: [SR-Users] VIA header x-route-tag
Marius hi,
Thank you for your replay. With the regular expression you provided me I get "SIP/2.0/UDP 172.16.0.13:5060;tgrp:TNDEM-ACR"
Can I isolate only tgrp:TNDEM-ACR ?
Thank you Alex
On Tue, Nov 30, 2010 at 5:07 PM, marius zbihlei <marius.zbihlei@1and1.romailto:marius.zbihlei@1and1.ro> wrote: On 11/30/2010 01:58 PM, alex pappas wrote: Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the x-route-tag value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060http://10.0.0.15:5060;x-route-tag="tgrp:TANDEM-KOR"
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
Cheers, Marius
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Marius hi,
I got the value I needed with:
$avp(s:xroutetag) = $(hdr(Via){re.subst,/^SIP(.*)x-route-tag="tgrp:(.*)(")/\2/});
You are right about Daniels way so I will continue trying in that.
Thanks for your time
Alex
On Wed, Dec 1, 2010 at 10:26 AM, Marius Zbihlei Marius.Zbihlei@1and1.rowrote:
Hello Alex,
Can't test it right now, but it should work better with this :
$var(s:xroutetag) = $(hdr(Via){re.subst,/^.*;x-route-tag="(.*)"/\1/})
You want to substitute (only affects $var) the whole via header with the regex found between () and referenced by \1. Keep in mind that Daniel's solution is more elegant and should work for you.
Marius
From: alex pappas [rebel.pappas@gmail.com] Sent: Wednesday, December 01, 2010 9:15 AM To: Marius Zbihlei Cc: sr-users@lists.sip-router.org Subject: Re: [SR-Users] VIA header x-route-tag
Marius hi,
Thank you for your replay. With the regular expression you provided me I get "SIP/2.0/UDP 172.16.0.13:5060;tgrp:TNDEM-ACR"
Can I isolate only tgrp:TNDEM-ACR ?
Thank you Alex
On Tue, Nov 30, 2010 at 5:07 PM, marius zbihlei <marius.zbihlei@1and1.ro mailto:marius.zbihlei@1and1.ro> wrote: On 11/30/2010 01:58 PM, alex pappas wrote: Dear All,
We have some cisco gw that they send to the Kamailio in the first invite and inside the VIA header an x-route-tag="The Gateway that the call entered".
I'm trying to add this to the acc module in order to have it recorded but without sucess. My config is this:
if (search("x-route-tag")) { avp(s:xroutetag) = $sel(@via); xlog("----- We have a x-route-tag in the SIP msg avp: $avp(s:xroutetag) -----"); };
I'm trying to add the VIA header to an avp so I could manipulate the string but i cannot implement this.
Does anyone can suggest a way to add the x-route-tag value to an AVP?
Thank you in advance
Alex
sample VIA header: Via: SIP/2.0/UDP 10.0.0.15:5060<http://10.0.0.15:5060
;x-route-tag="tgrp:TANDEM-KOR"
Hello,
You can use transformations http://kamailio.org/dokuwiki/doku.php/transformations:3.1.x . This should to the trick: (careful on needed modules)
$var(s:xroutetag) = $(hdr(Via){re.subst,/x-route-tag="(.*)"/\1/});
Cheers, Marius
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users