[Asterisk-code-review] res/res pjsip nat Fix logic for REINVITES (asterisk[13])
Torrey Searle
asteriskteam at digium.com
Wed Oct 24 07:40:28 CDT 2018
Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/10531
Change subject: res/res_pjsip_nat Fix logic for REINVITES
......................................................................
res/res_pjsip_nat Fix logic for REINVITES
The presence of Record-Route in re-invites is optional, this it is
important to make sure the dialog doesn't have a routset before
rewriting the contact header.
ASTERISK-28129 #close
Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc
---
M res/res_pjsip_nat.c
1 file changed, 21 insertions(+), 8 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/10531/1
diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c
index 370004a..a98d5f9 100644
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -49,6 +49,7 @@
{
pjsip_rr_hdr *rr = NULL;
pjsip_sip_uri *uri;
+ int res = -1;
if (rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG) {
pjsip_hdr *iter;
@@ -65,16 +66,28 @@
if (rr) {
uri = pjsip_uri_get_uri(&rr->name_addr);
rewrite_uri(rdata, uri);
- 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);
- }
-
- return 0;
+ res = 0;
}
- return -1;
+ 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);
+ res = 0;
+ }
+
+ if (!dlg && !rr) {
+ /**
+ * Even if this message doesn't have any route headers
+ * the dialog may, so wait until a later invocation that
+ * has a dialog reference to make sure there isn't a
+ * previously saved routset in the dialog before deciding
+ * the contact needs to be modified
+ */
+ res = 0;
+ }
+
+ return res;
}
static int rewrite_contact(pjsip_rx_data *rdata, pjsip_dialog *dlg)
--
To view, visit https://gerrit.asterisk.org/10531
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc
Gerrit-Change-Number: 10531
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181024/0e20bdc1/attachment.html>
More information about the asterisk-code-review
mailing list