]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
PJSIP: Handle headers in a list appropriately
authorKinsey Moore <kmoore@digium.com>
Tue, 21 Jan 2014 17:14:24 +0000 (17:14 +0000)
committerKinsey Moore <kmoore@digium.com>
Tue, 21 Jan 2014 17:14:24 +0000 (17:14 +0000)
The PJSIP header parsing function (pjsip_parse_hdr) can generate more
than one header instance from a single header field. These header
instances exist as a list attached to the returned header and must be
handled appropriately when they are added to a message or else only the
first header instance will be used. This changes the linked list
functions used in outbound proxy code to merge the lists properly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@406020 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip.c
res/res_pjsip_outbound_registration.c

index 8d1d1216a87a295202b6cc9b0906fbcd8eaffd27..06e5b7284da1fd8b03aafbf1d4ee71644c47c814 100644 (file)
@@ -1539,7 +1539,7 @@ pjsip_dialog *ast_sip_create_dialog_uac(const struct ast_sip_endpoint *endpoint,
                        pjsip_dlg_terminate(dlg);
                        return NULL;
                }
-               pj_list_push_back(&route_set, route);
+               pj_list_insert_nodes_before(&route_set, route);
 
                pjsip_dlg_set_route_set(dlg, &route_set);
        }
@@ -1901,7 +1901,7 @@ int ast_sip_set_outbound_proxy(pjsip_tx_data *tdata, const char *proxy)
                return -1;
        }
 
-       pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)route);
+       pj_list_insert_nodes_before(&tdata->msg->hdr, (pjsip_hdr*)route);
 
        return 0;
 }
index 88a12714a7049c60209151b06e4872e4b38f4159..dfd31f1d4ae030a65841e0d45a998db067f35aab 100644 (file)
@@ -779,7 +779,7 @@ static int sip_outbound_registration_regc_alloc(void *data)
                if (!(route = pjsip_parse_hdr(pjsip_regc_get_pool(registration->state->client_state->client), &ROUTE_HNAME, tmp.ptr, tmp.slen, NULL))) {
                        return -1;
                }
-               pj_list_push_back(&route_set, route);
+               pj_list_insert_nodes_before(&route_set, route);
 
                pjsip_regc_set_route_set(registration->state->client_state->client, &route_set);
        }