]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a bug in 1.4 branch with iax2 channels not being removed when a call was rejected...
authorBrett Bryant <bbryant@digium.com>
Mon, 21 Jul 2008 20:30:12 +0000 (20:30 +0000)
committerBrett Bryant <bbryant@digium.com>
Mon, 21 Jul 2008 20:30:12 +0000 (20:30 +0000)
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

channels/chan_iax2.c

index 44e11eea37c0b4e2c164481ddf2d27e13cf31562..157b5d22cfa703efc04262c09aeeb4bdb801df72 100644 (file)
@@ -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);