<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
you remove header Route and insert header Record-Route, is it what
you wanted to do? Maybe removing same Record-Route header, but be
careful in the case you have more than one proxy in the chain of
signaling.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 22/03/15 18:32, Slava Bendersky
wrote:<br>
</div>
<blockquote
cite="mid:1059090455.41156985.1427045553077.JavaMail.zimbra@skillsearch.ca"
type="cite">
<div style="font-family: lucida console,sans-serif; font-size:
12pt; color: #000000">
<div>Hello Daniel,<br>
</div>
<div>I end up insert routes like this. And right now on client
side I see only public ip route and private side only private
ip routes.<br data-mce-bogus="1">
</div>
<div><br data-mce-bogus="1">
</div>
<div>route[ROUTE_HDR_ORG] {<br>
# Getting record routes<br>
if(is_present_hf("Route")) {<br>
xlog("L_INFO", "[$rm], Inbound connection from
<$si>\n");<br>
if(is_method("NOTIFY")) {<br>
if(is_ip_rfc1918($si)) {<br>
xlog("L_INFO", "[$rm], Present
Route: $(route_uri{uri.host})\n");<br>
remove_hf("Route");<br>
insert_hf("Record-Route:
<"sip" + $sel(cfg_get.kamailio.bindpublicip) + ":"
$sel(cfg_get.kamailio.bindpublicport);transport=tcp;lr=on;ftag=$ft;nat=yes>\r\n");<br>
$fs = "tcp" + ":"
+ $sel(cfg_get.kamailio.bindpublicip) + ":" +
$sel(cfg_get.kamailio.bindpublicport);<br>
} else {<br>
xlog("L_INFO", "[$rm], Present
Route: $(route_uri{uri.host})\n");<br>
remove_hf("Route");<br>
insert_hf("Record-Route:
<"sip" + ":" $sel(cfg_get.kamailio.bindip) + ":"
+ $sel(cfg_get.kamailio.bindport);lr=on;ftag=$ft;nat=yes>\r\n");<br>
$fs = "udp" + ":" +
$sel(cfg_get.kamailio.bindip) + ":" +
$sel(cfg_get.kamailio.bindport);<br>
}<br>
}<br>
}<br>
}<br>
</div>
<div><br data-mce-bogus="1">
</div>
<div>And for initial SUBSCRIBE INVITE</div>
<div><br data-mce-bogus="1">
</div>
<div> if (is_method("INVITE|SUBSCRIBE")) {<br>
remove_hf("Route");<br>
insert_hf("Record-Route: <"sip" + ":" +
$sel(cfg_get.kamailio.bindip) + ":" +
$sel(cfg_get.kamailio.bindport);lr=on;ftag=$ft;nat=yes>\r\n");<br>
#record_route();<br>
}<br>
<br data-mce-bogus="1">
</div>
<div><br>
</div>
<div>Slava.<br data-mce-bogus="1">
</div>
<div><br data-mce-bogus="1">
</div>
<hr id="zwchr" data-marker="__DIVIDER__">
<div data-marker="__HEADERS__"><b>From: </b>"Daniel-Constantin
Mierla" <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
<b>To: </b>"Slava Bendersky" <a class="moz-txt-link-rfc2396E" href="mailto:volga629@networklab.ca"><volga629@networklab.ca></a>,
"sr-users" <a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a><br>
<b>Sent: </b>Wednesday, March 18, 2015 4:15:28 AM<br>
<b>Subject: </b>Re: [SR-Users] remove_hf_value<br>
</div>
<br>
<div data-marker="__QUOTED_TEXT__">Hello,<br>
<br>
but the INVITE request goes out with 2 Record Route headers,
if you get them in the 200ok.<br>
<br>
Not sure how it is going to work overall, you will have to
manually set local sockets for requests within dialog, because
you are doing also trasport layer gatewaying (tcp-udp).<br>
<br>
Anyhow, as a solution, maybe you should just not be using
record_route() function and just add the header with
insert_hf() for the invite, remove the Record-Route header for
200ok with remove_hf() and insert a new one again with
insert_hf()<br>
<br>
If you know the local address (IP/port/transport) you want to
put in the Record-Route, you can build the header as:<br>
<br>
insert_hf("Record-Route:
<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="sip:_LOCAL_IP_:_LOCAL_PORT_;transport=_LOCAL_TRANSPORT_;lr=on;ftag=$ft;nat=yes"
target="_blank"><sip:_LOCAL_IP_:_LOCAL_PORT_;transport=_LOCAL_TRANSPORT_;lr=on;ftag=$ft;nat=yes></a>\r\n");<br>
<br>
Requests within the dialog can be handled with loose_route(),
but again, you have to do more in config for selecting the
local socket to send to next hop. <br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 16/03/15 13:35, Slava
Bendersky wrote:<br>
</div>
<blockquote
cite="mid:1447933310.38506486.1426509342053.JavaMail.zimbra@skillsearch.ca">
<div style="font-family: lucida console,sans-serif;
font-size: 12pt; color: #000000">
<div>Hello Daniel,<br>
</div>
<div>I want do clean up on routes from first SUBSCRIBE,
that when traffic goes to public side of kamailio will
be only public route and when traffic is internal the
Record-Route will stay internal only. In SDP I see like
this.<br>
</div>
<div>I tired double routes set 0 in rr, but didn't clean
enough. <br>
</div>
<div><br>
</div>
<div><--- Transmitting (NAT) to 10.18.130.46:5060
---><br>
SIP/2.0 200 OK<br>
Via: SIP/2.0/UDP
10.18.130.46;branch=z9hG4bKf852.e0223f39c2bbad8366fdf1b7cb22b336.0;i=8;received=10.18.130.46;rport=5060<br>
Via: SIP/2.0/TCP
192.168.88.252:5062;received=client_pub_ipbranch=z9hG4bK0bbe1f7d27257bba9;rport=5062<br>
Record-Route: <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="sip:10.18.130.46;r2=on;lr=on;ftag=a185d974ec;nat=yes"
target="_blank"><sip:10.18.130.46;r2=on;lr=on;ftag=a185d974ec;nat=yes></a>
<span style="color: rgb(255, 0, 0);">On public side
remote this Record-Route</span><br>
Record-Route: <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="sip:kamailio_pub_ip:5084;transport=tcp;r2=on;lr=on;ftag=a185d974ec;nat=yes"
target="_blank"><sip:kamailio_pub_ip:5084;transport=tcp;r2=on;lr=on;ftag=a185d974ec;nat=yes></a>
<span style="color: rgb(255, 0, 0);">On private side
remote this Record-Route</span><br>
From: "Slava Bendersky" <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:sips:10101@networklab.ca" target="_blank"><sips:10101@networklab.ca></a>;tag=a185d974ec<br>
To: <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:sips:10101@networklab.ca" target="_blank"><sips:10101@networklab.ca></a>;tag=as00757d3e<br>
Call-ID: b08adb1ad1804a83<br>
CSeq: 236711034 SUBSCRIBE<br>
Server: FPBX-2.11.0(11.15.1)<br>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE<br>
Supported: replaces, timer<br>
Expires: 3600<br>
Contact: <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="sip:10101@10.18.130.50:5060" target="_blank"><sip:10101@10.18.130.50:5060></a>;expires=3600<br>
Content-Length: 0</div>
<div><br>
</div>
<div><br>
</div>
<div>Slava.<br>
</div>
<div><br>
</div>
<hr id="zwchr">
<div><b>From: </b>"Daniel-Constantin Mierla" <a
moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:miconda@gmail.com" target="_blank"><miconda@gmail.com></a><br>
<b>To: </b>"sr-users" <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:sr-users@lists.sip-router.org"
target="_blank"><sr-users@lists.sip-router.org></a><br>
<b>Sent: </b>Monday, March 16, 2015 7:01:54 AM<br>
<b>Subject: </b>Re: [SR-Users] remove_hf_value<br>
</div>
<br>
<div>Hello,<br>
<br>
can you give an example of incoming header and how you
want to be after modification?<br>
<br>
It is not clear for me what end result you want/expect.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 14/03/15 06:41, Slava
Bendersky wrote:<br>
</div>
<blockquote
cite="mid:636239858.37562445.1426311666124.JavaMail.zimbra@skillsearch.ca">
<div style="font-family: lucida console,sans-serif;
font-size: 12pt; color: #000000">
<div>Hello Everyone,<br>
</div>
<div>Here updated version. Trying remove
Record-Route after the coma.<br>
</div>
<div>My log shows <br>
</div>
<div><br>
</div>
<div>Mar 14 01:25:21 canlvprx01
/usr/sbin/kamailio[751]: INFO: <script>:
[SUBSCRIBE], Inbound connection from <Client
Public IP><br>
Mar 14 01:25:21 canlvprx01
/usr/sbin/kamailio[751]: ERROR: <script>:
<null><br>
Mar 14 01:25:21 canlvprx01
/usr/sbin/kamailio[751]: INFO: <script>:
[SUBSCRIBE], Route for removal: '<null>'<br>
</div>
<div><br>
</div>
<div>route snippet.<br>
</div>
<div><br>
</div>
<div>route[ROUTE_HDR_ORG] {<br>
# Getting record routes<br>
if(is_present_hf("Route")) {<br>
xlog("L_INFO", "[$rm], Inbound
connection from <$si>\n");<br>
if(is_method("SUBSCRIBE")) {<br>
if(is_ip_rfc1918($si)) {<br>
xlog(<a
moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:$sel%28@hf_value.Record_Route[-1]%29"
target="_blank">"$sel(@hf_value.Record_Route[-1])"</a>);<br>
xlog("L_INFO",
"[$rm], Route for removal:
'$sel(@hf_value.Record_Route[-1])'\n");<br>
remove_hf_value("Record-Route[-1]");<br>
} else {<br>
xlog(<a
moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:$sel%28@hf_value.Record_Route[1]%29"
target="_blank">"$sel(@hf_value.Record_Route[1])"</a>);<br>
xlog("L_INFO",
"[$rm], Route for removal:
'$sel(@hf_value.Record_Route[1])'\n");<br>
remove_hf_value("Record-Route[1]");<br>
}<br>
}<br>
}<br>
return;<br>
}<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Slava,<br>
</div>
<hr id="zwchr">
<div><b>From: </b>"Slava Bendersky" <a
moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:volga629@networklab.ca"
target="_blank"><volga629@networklab.ca></a><br>
<b>To: </b>"sr-users" <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:sr-users@lists.sip-router.org"
target="_blank"><sr-users@lists.sip-router.org></a><br>
<b>Sent: </b>Friday, March 13, 2015 1:00:44 PM<br>
<b>Subject: </b>[SR-Users] remove_hf_value<br>
</div>
<div><br>
</div>
<div>
<div style="font-family: lucida
console,sans-serif; font-size: 12pt; color:
#000000">
<div>Hello Everyone,<br>
</div>
<div>I am trying adjust Record-Route, but can't
match headers value<br>
</div>
<br>
<div>And I am call route(ROUTE_HDR_ORG); right
after route(WITHINDLG);<br>
</div>
<br>
<div>route[ROUTE_HDR_ORG] {<br>
# Getting record routes<br>
if(is_present_hf("Record-Route")) {<br>
if(is_method("SUBSCRIBE")) {<br>
xlog(<a
moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="mailto:$sel%28@hf_value.Record_Route[1]%29"
target="_blank">"$sel(@hf_value.Record_Route[1])"</a>);<br>
xlog("L_INFO", "[$rm],
Route for removal:
'$sel(@hf_value.Record_Route[1])'\n");<br>
remove_hf_value("Record-Route[1]");<br>
}<br>
}<br>
return;<br>
}<br>
</div>
<br>
<div>Any help Thank you,<br>
</div>
<div>Slava.<br>
</div>
</div>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list<br>
<a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature">--
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a>
</pre>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list<br>
<a moz-do-not-send="true"
class="moz-txt-link-abbreviated"
href="mailto:sr-users@lists.sip-router.org"
target="_blank">sr-users@lists.sip-router.org</a><br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature">--
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a>
</pre>
<br>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
</body>
</html>