[asterisk-dev] IAX2 do not pass hangupcause in 1.4.22 (bug)

Anton anton.vazir at gmail.com
Thu Oct 30 08:11:14 CDT 2008


So Below is the patch for given issue, giving a HANGUPCAUSE again, it's too simple to fall in any licensing issues:
Actually I reverted back a few places, which are responsible for a cause transmission, 
BUT it seems that this would close an unexpectred bug  

if (iaxs[callno]) - was not matched - so channel not destroyed.

--- chan_iax2.c-orig    2008-09-02 23:14:57.000000000 +0500
+++ chan_iax2.c 2008-10-30 21:05:15.000000000 +0500
@@ -3417,14 +3417,17 @@
 {
        unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
        struct iax_ie_data ied;
+       int alreadygone;
        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 && !ast_test_flag(iaxs[callno], IAX_ALREADYGONE)) {
+               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]);
@@ -3434,7 +3437,8 @@
                /* Explicitly predestroy it */
                iax2_predestroy(callno);
                /* If we were already gone to begin with, destroy us now */
-               if (iaxs[callno]) {
+               if (alreadygone && iaxs[callno]) {
+//             if (iaxs[callno]) {
                        if (option_debug)
                                ast_log(LOG_DEBUG, "Really destroying %s now...\n", c->name);
                        iax2_destroy(callno);


On Thursday 30 October 2008 15:45, Anton wrote:
> It would be very nice if someone of the developers take a
> look at this very annoying bug, looks there is only
> reporters comments. I can't properly pass a causecode to
> PSTN while this is the case, so a "stable" release of
> 1.4.22 and (seems) 1.6.0.1 is unusible for those of us
> who relay on HANGUPCAUSE
>
> http://bugs.digium.com/view.php?id=13645
>
> I personaly encounterd this with 1.4.22 after switchiing
> from 1.4.21.1
>
> _______________________________________________
> --Bandwidth and Colocation Provided by
> http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev



More information about the asterisk-dev mailing list