|
@@ -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) {
|