Module: sip-router
Branch: tma0/iptrtpproxy-v2
Commit: a0fdc9b781cf8d7368a5a67912929f612a8e9c33
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a0fdc9b…
Author: Tomas Mandys <tomas.mandys(a)iptel.org>
Committer: Tomas Mandys <tomas.mandys(a)iptel.org>
Date: Tue Aug 2 23:42:24 2011 +0200
- do not apply NAT contact fix of UAS when not usrloc forwarded
---
etc/sip-router-oob.cfg | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/etc/sip-router-oob.cfg b/etc/sip-router-oob.cfg
index 3c7d694..0521dc6 100644
--- a/etc/sip-router-oob.cfg
+++ b/etc/sip-router-oob.cfg
@@ -359,7 +359,9 @@ flags
FLAG_NAT_REG : 14, # the UAC behind NAT, stored in location record
FLAG_INIT_DLG : 15, # init INVITE dialog
FLAG_REVERSE_DIR : 16, # set if request goes callee -> caller direction, requires
rr.append_fromtag=1
- FLAG_ACC_MISSED : 17; # the missed call will be recorded by ACC
+ FLAG_ACC_MISSED : 17, # the missed call will be recorded by ACC
+ FLAG_USRLOC_FWD : 18, # usrloc based forward
+ FLAG_NEXT_ROUTE : 19; # there is a route remaining
avpflags
dialog_cookie; # attribute will be stored in Route headers
@@ -853,6 +855,19 @@ route[UAS_NAT_DETECTION]
break;
}
+ # prevent contact overwriting when a proxy between ser and UAS.
+ # We get it from record-route but it's rather difficult or
+ # do it only for UAS which is registered in usrloc database and has no
+ # proxy on path.
+ # Note: destination forced by $fwd_always_target is not NAT detected and contact left
untouched!
+ if (isflagset(FLAG_INIT_DLG) && !isflagset(FLAG_USRLOC_FWD)) {
+ break;
+ }
+ # for in-dialog requests we get it easily because it provides loose_route()
+ if (!isflagset(FLAG_INIT_DLG) && isflagset(FLAG_NEXT_ROUTE)) {
+ break;
+ }
+
# Prevent that we over-write the Contact with the IP of our proxy when
# the reply loops through ourself.
if (src_ip == myself) {
@@ -931,6 +946,9 @@ route[PROCESS_ROUTES]
if (!defined $dialog_id) {
$dialog_id = $t.dialog_id; # there is only 1 dialog_id
}
+ if (@rr.next_route != "") {
+ setflag("FLAG_NEXT_ROUTE");
+ }
xlog("L_DEBUG", "\n%mb\n\ndialogid
-/from/to=%$dialog_id/%$f.dialog_id/%$t.dialog_id");
if (method == "INVITE" || method == "UPDATE" || method ==
"ACK" || method == "BYE") {
if (!defined $dialog_id) {