summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-03-25 16:57:41 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-03-25 16:57:41 +0000
commitc1c8300e27060033cab536e0782b8d508bcfbdd5 (patch)
tree8f11f996705f0dd26daf5fa616da94bdd52e5365 /res/res_pjsip.c
parenta4890eddfb4f98029c046f490e03e2ae9170dee7 (diff)
res_pjsip: Fix contact authenticate_qualify endpoint lookup when qualifing a contact.
* Fixed bad use of ao2_find() in on_endpoint(). * Replaced use of find_endpoints() with find_an_endpoint() since only the first found endpoint is ever needed. * Fixed qualify_contact_cb() to update the contact with the aor authenticate_qualify setting. Otherwise, permanent contacts in the aor type sections would have a config line order dependancy. * Fixed off nominal path contact ref leak in qualify_contact(). The comment saying the unref is not needed was wrong. * Fixed off nominal path use of the endpoint parameter if it is NULL in send_out_of_dialog_request(). * Added missing off nominal path unref of pjsip tdata in send_out_of_dialog_request(). * Fixed off nominal path failing to call the callback in send_request_cb() when the request is challenged for authentication. * Eliminated silly RAII_VAR() use in qualify_contact_cb(). * Updated ast_sip_send_request() doxygen to better reflect reality. (closes issue ASTERISK-23254) Reported by: rmudgett Review: https://reviewboard.asterisk.org/r/3381/ ........ Merged revisions 411141 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 69e6b668d..3ef203f85 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -1850,10 +1850,11 @@ static void send_request_cb(void *token, pjsip_event *e)
}
AST_RWLIST_UNLOCK(&supplements);
- if ((tsx->status_code == 401 || tsx->status_code == 407) && req_data->endpoint) {
- if (!ast_sip_create_request_with_auth(&req_data->endpoint->outbound_auths, challenge, tsx, &tdata)) {
- pjsip_endpt_send_request(ast_sip_get_pjsip_endpoint(), tdata, -1, req_data->token, req_data->callback);
- }
+ if ((tsx->status_code == 401 || tsx->status_code == 407)
+ && req_data->endpoint
+ && !ast_sip_create_request_with_auth(&req_data->endpoint->outbound_auths, challenge, tsx, &tdata)
+ && pjsip_endpt_send_request(ast_sip_get_pjsip_endpoint(), tdata, -1, req_data->token, req_data->callback)
+ == PJ_SUCCESS) {
return;
}
@@ -1870,6 +1871,7 @@ static int send_out_of_dialog_request(pjsip_tx_data *tdata, struct ast_sip_endpo
struct ast_sip_contact *contact = ast_sip_mod_data_get(tdata->mod_data, supplement_module.id, MOD_DATA_CONTACT);
if (!req_data) {
+ pjsip_tx_data_dec_ref(tdata);
return -1;
}
@@ -1888,7 +1890,7 @@ static int send_out_of_dialog_request(pjsip_tx_data *tdata, struct ast_sip_endpo
ast_log(LOG_ERROR, "Error attempting to send outbound %.*s request to endpoint %s\n",
(int) pj_strlen(&tdata->msg->line.req.method.name),
pj_strbuf(&tdata->msg->line.req.method.name),
- ast_sorcery_object_get_id(endpoint));
+ endpoint ? ast_sorcery_object_get_id(endpoint) : "<unknown>");
ao2_cleanup(req_data);
return -1;
}