Hangup affected channel in error paths of bridge_call_thread().
[asterisk/asterisk.git] / main / features.c
index aea0d1e..9a09058 100644 (file)
@@ -967,17 +967,23 @@ static void *bridge_call_thread(void *data)
                if (!ast_check_hangup(tobj->peer)) {
                        ast_log(LOG_VERBOSE, "putting peer %s into PBX again\n", ast_channel_name(tobj->peer));
                        res = ast_pbx_start(tobj->peer);
                if (!ast_check_hangup(tobj->peer)) {
                        ast_log(LOG_VERBOSE, "putting peer %s into PBX again\n", ast_channel_name(tobj->peer));
                        res = ast_pbx_start(tobj->peer);
-                       if (res != AST_PBX_SUCCESS)
+                       if (res != AST_PBX_SUCCESS) {
                                ast_log(LOG_WARNING, "FAILED continuing PBX on peer %s\n", ast_channel_name(tobj->peer));
                                ast_log(LOG_WARNING, "FAILED continuing PBX on peer %s\n", ast_channel_name(tobj->peer));
-               } else
+                               ast_hangup(tobj->peer);
+                       }
+               } else {
                        ast_hangup(tobj->peer);
                        ast_hangup(tobj->peer);
+               }
                if (!ast_check_hangup(tobj->chan)) {
                        ast_log(LOG_VERBOSE, "putting chan %s into PBX again\n", ast_channel_name(tobj->chan));
                        res = ast_pbx_start(tobj->chan);
                if (!ast_check_hangup(tobj->chan)) {
                        ast_log(LOG_VERBOSE, "putting chan %s into PBX again\n", ast_channel_name(tobj->chan));
                        res = ast_pbx_start(tobj->chan);
-                       if (res != AST_PBX_SUCCESS)
+                       if (res != AST_PBX_SUCCESS) {
                                ast_log(LOG_WARNING, "FAILED continuing PBX on chan %s\n", ast_channel_name(tobj->chan));
                                ast_log(LOG_WARNING, "FAILED continuing PBX on chan %s\n", ast_channel_name(tobj->chan));
-               } else
+                               ast_hangup(tobj->chan);
+                       }
+               } else {
                        ast_hangup(tobj->chan);
                        ast_hangup(tobj->chan);
+               }
        } else {
                ast_hangup(tobj->chan);
                ast_hangup(tobj->peer);
        } else {
                ast_hangup(tobj->chan);
                ast_hangup(tobj->peer);