mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -637,11 +637,17 @@ static struct ast_channel *chan_pjsip_new(struct ast_sip_session *session, int s
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user