From: Brett Bryant Date: Mon, 21 Jul 2008 20:30:12 +0000 (+0000) Subject: Fix a bug in 1.4 branch with iax2 channels not being removed when a call was rejected... X-Git-Tag: 1.4.22-rc1~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2172cc71b109e0e707c06773029242ab4de901ba;p=thirdparty%2Fasterisk.git Fix a bug in 1.4 branch with iax2 channels not being removed when a call was rejected (from the calling box, not the box that denied the registration). Related to revisions 132466 in trunk, and 132467 in 1.6.0. Earlier I had accidently tested 1.4 with a backport from those revisions, so I didn't see this problem (oops). git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@132506 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 44e11eea37..157b5d22cf 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3406,17 +3406,15 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout) static int iax2_hangup(struct ast_channel *c) { unsigned short callno = PTR_TO_CALLNO(c->tech_pvt); - int alreadygone; struct iax_ie_data ied; memset(&ied, 0, sizeof(ied)); ast_mutex_lock(&iaxsl[callno]); if (callno && iaxs[callno]) { if (option_debug) ast_log(LOG_DEBUG, "We're hanging up %s now...\n", c->name); - alreadygone = ast_test_flag(iaxs[callno], IAX_ALREADYGONE); /* Send the hangup unless we have had a transmission error or are already gone */ iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause); - if (!iaxs[callno]->error && !alreadygone) { + if (!iaxs[callno]->error && !ast_test_flag(iaxs[callno], IAX_ALREADYGONE)) { send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1); if (!iaxs[callno]) { ast_mutex_unlock(&iaxsl[callno]); @@ -3426,7 +3424,7 @@ static int iax2_hangup(struct ast_channel *c) /* Explicitly predestroy it */ iax2_predestroy(callno); /* If we were already gone to begin with, destroy us now */ - if (alreadygone && iaxs[callno]) { + if (iaxs[callno]) { if (option_debug) ast_log(LOG_DEBUG, "Really destroying %s now...\n", c->name); iax2_destroy(callno);