From 7cabdde1ce94e0c67b144a0bcde7785d97ebd680 Mon Sep 17 00:00:00 2001 From: Mark Spencer <markster@digium.com> Date: Fri, 11 Apr 2003 18:22:21 +0000 Subject: [PATCH] Fix zombie *8# channels in SIP git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@832 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 917f3fc27c..3ae3c6ad2d 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4229,20 +4229,29 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc if (strcmp(p->exten, ast_pickup_ext())) { if (ast_pbx_start(c)) { ast_log(LOG_WARNING, "Failed to start PBX :(\n"); + /* Unlock locks so ast_hangup can do its magic */ ast_pthread_mutex_unlock(&c->lock); + ast_pthread_mutex_unlock(&p->lock); ast_hangup(c); + ast_pthread_mutex_lock(&p->lock); transmit_response_reliable(p, "503 Unavailable", req); c = NULL; } } else if (ast_pickup_call(c)) { - ast_log(LOG_WARNING, "Nothing to pick up\n"); + ast_log(LOG_NOTICE, "Nothing to pick up\n"); transmit_response_reliable(p, "503 Unavailable", req); p->alreadygone = 1; + /* Unlock locks so ast_hangup can do its magic */ ast_pthread_mutex_unlock(&c->lock); + ast_pthread_mutex_unlock(&p->lock); ast_hangup(c); + ast_pthread_mutex_lock(&p->lock); + c = NULL; } else { ast_pthread_mutex_unlock(&c->lock); + ast_pthread_mutex_unlock(&p->lock); ast_hangup(c); + ast_pthread_mutex_lock(&p->lock); c = NULL; } break; @@ -4414,7 +4423,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc return -1; } if (!p->lastinvite && !strlen(p->randdata)) - sip_destroy(p); + p->needdestroy = 1; } else if (!strcasecmp(cmd, "SIP/2.0")) { while(*e && (*e < 33)) e++; if (sscanf(e, "%i %n", &respid, &len) != 1) { -- GitLab