summaryrefslogtreecommitdiff
path: root/res/res_pjsip.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2016-02-10 15:16:46 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2016-02-10 16:27:00 -0600
commitc1bf014ea08cf66835a6f000e2bd6c7da588da6b (patch)
treee0736cef93c96c7163a37d3a4affc6ff912ae05c /res/res_pjsip.c
parent0e25e4a924b252014694b7218630995ab1733f16 (diff)
res_pjsip: Handle pjsip_dlg_create_uas deprecation
Pjproject has deprecated pjsip_dlg_create_uas in 2.5 and replaced it with pjsip_dlg_create_uas_and_inc_lock which, as the name implies, automatically increments the lock on the returned dialog. To account for this, configure.ac now detects the presence of pjsip_dlg_create_uas_and_inc_lock and res_pjsip.c has an #ifdef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK to decide whether to use the original call or the new one. If the new one was used, the ref count is decremented before returning. ASTERISK-25751 #close Reported-by Josh Colp Change-Id: I1be776b94761df03bd0693bc7795a75682615ca8
Diffstat (limited to 'res/res_pjsip.c')
-rw-r--r--res/res_pjsip.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index c94f6a9eb..cd23a2e7a 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -2713,7 +2713,11 @@ pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint,
(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
(type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
+#ifdef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK
+ *status = pjsip_dlg_create_uas_and_inc_lock(pjsip_ua_instance(), rdata, &contact, &dlg);
+#else
*status = pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, &contact, &dlg);
+#endif
if (*status != PJ_SUCCESS) {
char err[PJ_ERR_MSG_SIZE];
@@ -2726,6 +2730,9 @@ pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint,
dlg->sess_count++;
pjsip_dlg_set_transport(dlg, &selector);
dlg->sess_count--;
+#ifdef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK
+ pjsip_dlg_dec_lock(dlg);
+#endif
return dlg;
}