diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6e2116c0ab..b3e7d9da6e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7253,6 +7253,11 @@ static int sip_answer(struct ast_channel *ast) int res = 0; struct sip_pvt *p = ast_channel_tech_pvt(ast); + if (!p) { + ast_debug(1, "Asked to answer channel %s without tech pvt; ignoring\n", + ast_channel_name(ast)); + return res; + } sip_pvt_lock(p); if (ast_channel_state(ast) != AST_STATE_UP) { try_suggested_sip_codec(p); @@ -7422,6 +7427,12 @@ static int sip_senddigit_begin(struct ast_channel *ast, char digit) struct sip_pvt *p = ast_channel_tech_pvt(ast); int res = 0; + if (!p) { + ast_debug(1, "Asked to begin DTMF digit on channel %s with no pvt; ignoring\n", + ast_channel_name(ast)); + return res; + } + sip_pvt_lock(p); switch (ast_test_flag(&p->flags[0], SIP_DTMF)) { case SIP_DTMF_INBAND: @@ -7446,6 +7457,12 @@ static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int d struct sip_pvt *p = ast_channel_tech_pvt(ast); int res = 0; + if (!p) { + ast_debug(1, "Asked to end DTMF digit on channel %s with no pvt; ignoring\n", + ast_channel_name(ast)); + return res; + } + sip_pvt_lock(p); switch (ast_test_flag(&p->flags[0], SIP_DTMF)) { case SIP_DTMF_INFO: @@ -7471,6 +7488,12 @@ static int sip_transfer(struct ast_channel *ast, const char *dest) struct sip_pvt *p = ast_channel_tech_pvt(ast); int res; + if (!p) { + ast_debug(1, "Asked to transfer channel %s with no pvt; ignoring\n", + ast_channel_name(ast)); + return -1; + } + if (dest == NULL) /* functions below do not take a NULL */ dest = ""; sip_pvt_lock(p); @@ -7666,6 +7689,12 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data struct sip_pvt *p = ast_channel_tech_pvt(ast); int res = 0; + if (!p) { + ast_debug(1, "Asked to indicate condition on channel %s with no pvt; ignoring\n", + ast_channel_name(ast)); + return res; + } + sip_pvt_lock(p); switch(condition) { case AST_CONTROL_RINGING: