[asterisk-commits] res pjsip caller id: Fix crash on session timers UPDATE on i... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 27 15:15:35 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4204 )

Change subject: res_pjsip_caller_id: Fix crash on session timers UPDATE on inbound calls.
......................................................................


res_pjsip_caller_id: Fix crash on session timers UPDATE on inbound calls.

The res_pjsip_caller_id module wrongly assumed that a
saved From header would always exist on sessions. This
is true until an inbound call is received and a session
timer causes an UPDATE to be sent. In this case there will
be no saved From header and a crash will occur. This change
makes it fall back to the From header of the outgoing request
if no saved From header is present.

ASTERISK-26307 #close

Change-Id: Iccc3bc8d243b5ede9b81abf960292930c908d4fa
---
M res/res_pjsip_caller_id.c
1 file changed, 10 insertions(+), 4 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified



diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 16b19ec..7948d33 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -523,8 +523,11 @@
 		}
 	}
 
-	base = tdata->msg->type == PJSIP_REQUEST_MSG ? session->saved_from_hdr :
-		PJSIP_MSG_TO_HDR(tdata->msg);
+	if (tdata->msg->type == PJSIP_REQUEST_MSG) {
+		base = session->saved_from_hdr ? session->saved_from_hdr : PJSIP_MSG_FROM_HDR(tdata->msg);
+	} else {
+		base = PJSIP_MSG_TO_HDR(tdata->msg);
+	}
 
 	pai_hdr = create_new_id_hdr(&pj_pai_name, base, tdata, id);
 	if (!pai_hdr) {
@@ -629,8 +632,11 @@
 		}
 	}
 
-	base = tdata->msg->type == PJSIP_REQUEST_MSG ? session->saved_from_hdr :
-		PJSIP_MSG_TO_HDR(tdata->msg);
+	if (tdata->msg->type == PJSIP_REQUEST_MSG) {
+		base = session->saved_from_hdr ? session->saved_from_hdr : PJSIP_MSG_FROM_HDR(tdata->msg);
+	} else {
+		base = PJSIP_MSG_TO_HDR(tdata->msg);
+	}
 
 	rpid_hdr = create_new_id_hdr(&pj_rpid_name, base, tdata, id);
 	if (!rpid_hdr) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iccc3bc8d243b5ede9b81abf960292930c908d4fa
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list