[asterisk-commits] res pjsip nat: Adjust when contact should be rewritten. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 29 11:57:00 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: res_pjsip_nat: Adjust when contact should be rewritten.
......................................................................


res_pjsip_nat: Adjust when contact should be rewritten.

A previous change made the contact only get rewritten if the dialog's
route set was not marked frozen. Unfortunately, while the intent of this
is correct, the dialog's route set actually gets marked as frozen
earlier than expected, especially for UAS dialogs.

Instead, the idea is that the contact needs to not be rewritten if there
is a pre-existing route set on the dialog. This is now accomplished by
checking the dialog's route set list instead of checking if the route
set is frozen.

Doing this causes some broken tests to begin passing again.

ASTERISK-25196
Reported by Mark Michelson

Change-Id: I525ab251fd40a52ede327a52a2810a56deb0529e
---
M res/res_pjsip_nat.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c
index e47dd54..c32b71d 100644
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -63,7 +63,7 @@
 	if (rr) {
 		uri = pjsip_uri_get_uri(&rr->name_addr);
 		rewrite_uri(rdata, uri);
-		if (dlg && dlg->route_set.next && !dlg->route_set_frozen) {
+		if (dlg && !pj_list_empty(&dlg->route_set) && !dlg->route_set_frozen) {
 			pjsip_routing_hdr *route = dlg->route_set.next;
 			uri = pjsip_uri_get_uri(&route->name_addr);
 			rewrite_uri(rdata, uri);
@@ -85,7 +85,7 @@
 
 		rewrite_uri(rdata, uri);
 
-		if (dlg && !dlg->route_set_frozen && (!dlg->remote.contact
+		if (dlg && pj_list_empty(&dlg->route_set) && (!dlg->remote.contact
 			|| pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI, dlg->remote.contact->uri, contact->uri))) {
 			dlg->remote.contact = (pjsip_contact_hdr*)pjsip_hdr_clone(dlg->pool, contact);
 			dlg->target = dlg->remote.contact->uri;

-- 
To view, visit https://gerrit.asterisk.org/736
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I525ab251fd40a52ede327a52a2810a56deb0529e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list