mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
Merge "chan_pjsip.c: Check for channel and session to not be NULL in hangup" into 16
This commit is contained in:
@@ -2342,7 +2342,14 @@ static int hangup(void *data)
|
|||||||
struct hangup_data *h_data = data;
|
struct hangup_data *h_data = data;
|
||||||
struct ast_channel *ast = h_data->chan;
|
struct ast_channel *ast = h_data->chan;
|
||||||
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
|
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);
|
||||||
|
/*
|
||||||
|
* Before cleaning we have to ensure that channel or its session is not NULL
|
||||||
|
* we have seen rare case when taskprocessor calls hangup but channel is NULL
|
||||||
|
* due to SIP session timeout and answer happening at the same time
|
||||||
|
*/
|
||||||
|
if (channel) {
|
||||||
struct ast_sip_session *session = channel->session;
|
struct ast_sip_session *session = channel->session;
|
||||||
|
if (session) {
|
||||||
int cause = h_data->cause;
|
int cause = h_data->cause;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2353,7 +2360,9 @@ static int hangup(void *data)
|
|||||||
ast_sip_session_terminate(ao2_bump(session), cause);
|
ast_sip_session_terminate(ao2_bump(session), cause);
|
||||||
clear_session_and_channel(session, ast);
|
clear_session_and_channel(session, ast);
|
||||||
ao2_cleanup(session);
|
ao2_cleanup(session);
|
||||||
|
}
|
||||||
ao2_cleanup(channel);
|
ao2_cleanup(channel);
|
||||||
|
}
|
||||||
ao2_cleanup(h_data);
|
ao2_cleanup(h_data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user