summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-10-27 13:07:02 +0000
committerJoshua Colp <jcolp@digium.com>2016-10-27 08:30:27 -0500
commit82ef2bb69db5921351a3c0cad86084275782c6a2 (patch)
tree8b7fa380d17280b38297ba736e1fbe8d5b40537a /res
parent893afdac1ac5b89c2aafda1cb472a57ec81b7d39 (diff)
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
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip_caller_id.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 16b19ec2b..7948d33be 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -523,8 +523,11 @@ static void add_pai_header(const struct ast_sip_session *session, pjsip_tx_data
}
}
- 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 @@ static void add_rpid_header(const struct ast_sip_session *session, pjsip_tx_data
}
}
- 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) {