res_pjsip: Fix known compact header issues
authorJoshua Elson <joshelson@gmail.com>
Sun, 1 Jan 2017 01:56:09 +0000 (18:56 -0700)
committerJoshua Elson <joshelson@gmail.com>
Sun, 1 Jan 2017 02:00:46 +0000 (20:00 -0600)
ASTERISK-26684 #close

Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a

res/res_pjsip.c
res/res_pjsip_diversion.c
res/res_pjsip_refer.c

index 6df9b70..a7dd09e 100644 (file)
@@ -3246,8 +3246,9 @@ static int create_out_of_dialog_request(const pjsip_method *method, struct ast_s
                pjsip_contact_hdr *contact_hdr;
                pjsip_sip_uri *contact_uri;
                static const pj_str_t HCONTACT = { "Contact", 7 };
+               static const pj_str_t HCONTACTSHORT = { "m", 1 };
 
-               contact_hdr = pjsip_msg_find_hdr_by_name((*tdata)->msg, &HCONTACT, NULL);
+               contact_hdr = pjsip_msg_find_hdr_by_names((*tdata)->msg, &HCONTACT, &HCONTACTSHORT, NULL);
                if (contact_hdr) {
                        contact_uri = pjsip_uri_get_uri(contact_hdr->uri);
                        pj_strdup2(pool, &contact_uri->user, endpoint->contact_user);
index 301d9fc..efb5489 100644 (file)
@@ -277,6 +277,7 @@ static int diversion_incoming_request(struct ast_sip_session *session, pjsip_rx_
 static void diversion_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
 {
        static const pj_str_t contact_name = { "Contact", 7 };
+       static const pj_str_t contact_name_s = { "m", 1 };
 
        pjsip_status_line status = rdata->msg_info.msg->line.status;
        pjsip_fromto_hdr *div_hdr;
@@ -292,7 +293,7 @@ static void diversion_incoming_response(struct ast_sip_session *session, pjsip_r
                div_hdr = PJSIP_MSG_TO_HDR(rdata->msg_info.msg);
        }
 
-       contact_hdr = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &contact_name, NULL);
+       contact_hdr = pjsip_msg_find_hdr_by_names(rdata->msg_info.msg, &contact_name, &contact_name_s, NULL);
 
        set_redirecting(session, div_hdr, contact_hdr ? (pjsip_name_addr*)contact_hdr->uri :
                        (pjsip_name_addr*)PJSIP_MSG_FROM_HDR(rdata->msg_info.msg)->uri);
index c1dee82..107a3e7 100644 (file)
@@ -573,6 +573,7 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
        pjsip_generic_string_hdr *referred_by;
 
        static const pj_str_t str_referred_by = { "Referred-By", 11 };
+       static const pj_str_t str_referred_by_s = { "b", 1 };
 
        pbx_builtin_setvar_helper(chan, "SIPTRANSFER", "yes");
 
@@ -651,8 +652,8 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
 
        pbx_builtin_setvar_helper(chan, "SIPREFERRINGCONTEXT", S_OR(refer->context, NULL));
 
-       referred_by = pjsip_msg_find_hdr_by_name(refer->rdata->msg_info.msg,
-               &str_referred_by, NULL);
+       referred_by = pjsip_msg_find_hdr_by_names(refer->rdata->msg_info.msg,
+               &str_referred_by, &str_referred_by_s, NULL);
        if (referred_by) {
                size_t uri_size = pj_strlen(&referred_by->hvalue) + 1;
                char *uri = ast_alloca(uri_size);