[asterisk-commits] file: trunk r397515 - /trunk/channels/chan_pjsip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 23 08:58:10 CDT 2013
Author: file
Date: Fri Aug 23 08:58:08 2013
New Revision: 397515
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397515
Log:
Fix crash when answering after a transport error occurs.
If a response to an initial incoming INVITE results in a transport error
the INVITE transaction is removed from the INVITE session. Any attempts
to answer the INVITE session after this results in a crash as it requires
the INVITE transaction to exist. This change explicitly locks the dialog
and checks to ensure that the INVITE transaction exists before answering.
(closes issue AST-1203)
Reported by: John Bigelow
Modified:
trunk/channels/chan_pjsip.c
Modified: trunk/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_pjsip.c?view=diff&rev=397515&r1=397514&r2=397515
==============================================================================
--- trunk/channels/chan_pjsip.c (original)
+++ trunk/channels/chan_pjsip.c Fri Aug 23 08:58:08 2013
@@ -637,11 +637,17 @@
static int answer(void *data)
{
- pj_status_t status;
+ pj_status_t status = PJ_SUCCESS;
pjsip_tx_data *packet;
struct ast_sip_session *session = data;
- if ((status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet)) == PJ_SUCCESS) {
+ pjsip_dlg_inc_lock(session->inv_session->dlg);
+ if (session->inv_session->invite_tsx) {
+ status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet);
+ }
+ pjsip_dlg_dec_lock(session->inv_session->dlg);
+
+ if (status == PJ_SUCCESS && packet) {
ast_sip_session_send_response(session, packet);
}
More information about the asterisk-commits
mailing list