diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8a3580ba07..99e39f4da5 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6876,6 +6876,11 @@ static int sip_answer(struct ast_channel *ast) int res = 0; struct sip_pvt *p = ast->tech_pvt; + if (!p) { + ast_debug(1, "Asked to answer channel %s without tech pvt; ignoring\n", + ast->name); + return res; + } sip_pvt_lock(p); if (ast->_state != AST_STATE_UP) { try_suggested_sip_codec(p); @@ -7045,6 +7050,12 @@ static int sip_senddigit_begin(struct ast_channel *ast, char digit) struct sip_pvt *p = ast->tech_pvt; int res = 0; + if (!p) { + ast_debug(1, "Asked to begin DTMF digit on channel %s with no pvt; ignoring\n", + ast->name); + return res; + } + sip_pvt_lock(p); switch (ast_test_flag(&p->flags[0], SIP_DTMF)) { case SIP_DTMF_INBAND: @@ -7069,6 +7080,12 @@ static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int d struct sip_pvt *p = ast->tech_pvt; int res = 0; + if (!p) { + ast_debug(1, "Asked to end DTMF digit on channel %s with no pvt; ignoring\n", + ast->name); + return res; + } + sip_pvt_lock(p); switch (ast_test_flag(&p->flags[0], SIP_DTMF)) { case SIP_DTMF_INFO: @@ -7094,6 +7111,12 @@ static int sip_transfer(struct ast_channel *ast, const char *dest) struct sip_pvt *p = ast->tech_pvt; int res; + if (!p) { + ast_debug(1, "Asked to transfer channel %s with no pvt; ignoring\n", + ast->name); + return -1; + } + if (dest == NULL) /* functions below do not take a NULL */ dest = ""; sip_pvt_lock(p); @@ -7242,6 +7265,12 @@ static int sip_indicate(struct ast_channel *ast, int condition, const void *data struct sip_pvt *p = ast->tech_pvt; int res = 0; + if (!p) { + ast_debug(1, "Asked to indicate condition on channel %s with no pvt; ignoring\n", + ast->name); + return res; + } + sip_pvt_lock(p); switch(condition) { case AST_CONTROL_RINGING: