Merge "pbx: Reduce verbosity while loading extensions"
[asterisk/asterisk.git] / main / bridge_after.c
index 3d1d2f3..69c8f98 100644 (file)
@@ -32,8 +32,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/logger.h"
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
@@ -295,23 +293,23 @@ int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb
        return 0;
 }
 
-const char *reason_strings[] = {
-       [AST_BRIDGE_AFTER_CB_REASON_DESTROY] = "Channel destroyed (hungup)",
-       [AST_BRIDGE_AFTER_CB_REASON_REPLACED] = "Callback was replaced",
-       [AST_BRIDGE_AFTER_CB_REASON_MASQUERADE] = "Channel masqueraded",
-       [AST_BRIDGE_AFTER_CB_REASON_DEPART] = "Channel was departed from bridge",
-       [AST_BRIDGE_AFTER_CB_REASON_REMOVED] = "Callback was removed",
-};
-
 const char *ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason)
 {
-       if (reason < AST_BRIDGE_AFTER_CB_REASON_DESTROY
-               || AST_BRIDGE_AFTER_CB_REASON_REMOVED < reason
-               || !reason_strings[reason]) {
-               return "Unknown";
-       }
-
-       return reason_strings[reason];
+       switch (reason) {
+       case AST_BRIDGE_AFTER_CB_REASON_DESTROY:
+               return "Channel destroyed (hungup)";
+       case AST_BRIDGE_AFTER_CB_REASON_REPLACED:
+               return "Callback was replaced";
+       case AST_BRIDGE_AFTER_CB_REASON_MASQUERADE:
+               return "Channel masqueraded";
+       case AST_BRIDGE_AFTER_CB_REASON_DEPART:
+               return "Channel was departed from bridge";
+       case AST_BRIDGE_AFTER_CB_REASON_REMOVED:
+               return "Callback was removed";
+       case AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED:
+               return "Channel failed joining the bridge";
+       }
+       return "Unknown";
 }
 
 struct after_bridge_goto_ds {
@@ -345,6 +343,7 @@ static void after_bridge_goto_destroy(void *data)
        ast_free((char *) after_bridge->parseable_goto);
        ast_free((char *) after_bridge->context);
        ast_free((char *) after_bridge->exten);
+       ast_free((char *) after_bridge);
 }
 
 /*!
@@ -451,6 +450,11 @@ int ast_bridge_setup_after_goto(struct ast_channel *chan)
        struct after_bridge_goto_ds *after_bridge;
        int goto_failed = -1;
 
+       /* We are going to be leaving the bridging system now;
+        * clear any pending unbridge flags
+        */
+       ast_channel_set_unbridged(chan, 0);
+
        /* Determine if we are going to setup a dialplan location and where. */
        if (ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO) {
                /* An async goto has already setup a location. */
@@ -478,7 +482,7 @@ int ast_bridge_setup_after_goto(struct ast_channel *chan)
                }
        } else if (!ast_check_hangup(chan)) {
                /* Clear the outgoing flag */
-               ast_clear_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
+               ast_channel_clear_flag(chan, AST_FLAG_OUTGOING);
 
                if (after_bridge->specific) {
                        goto_failed = ast_explicit_goto(chan, after_bridge->context,