Restore Dial, Queue, and FollowMe 'I' option support.
[asterisk/asterisk.git] / apps / confbridge / conf_chan_announce.c
index 46e074b..952ef98 100644 (file)
@@ -32,7 +32,7 @@
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #include "asterisk/channel.h"
-#include "asterisk/bridging.h"
+#include "asterisk/bridge.h"
 #include "asterisk/core_unreal.h"
 #include "include/confbridge.h"
 
@@ -134,6 +134,7 @@ static struct ast_channel_tech announce_tech = {
        .send_text = ast_unreal_sendtext,
        .queryoption = ast_unreal_queryoption,
        .setoption = ast_unreal_setoption,
+       .properties = AST_CHAN_TP_INTERNAL,
 };
 
 struct ast_channel_tech *conf_announce_get_tech(void)
@@ -158,9 +159,6 @@ void conf_announce_channel_depart(struct ast_channel *chan)
        }
        ast_clear_flag(&p->base, AST_UNREAL_CARETAKER_THREAD);
        chan = p->base.chan;
-       if (chan) {
-               ast_channel_ref(chan);
-       }
        ao2_unlock(p);
        ao2_ref(p, -1);
        if (chan) {
@@ -172,8 +170,8 @@ void conf_announce_channel_depart(struct ast_channel *chan)
 int conf_announce_channel_push(struct ast_channel *ast)
 {
        struct ast_bridge_features *features;
+       struct ast_channel *chan;
        RAII_VAR(struct announce_pvt *, p, NULL, ao2_cleanup);
-       RAII_VAR(struct ast_channel *, chan, NULL, ast_channel_unref);
 
        {
                SCOPED_CHANNELLOCK(lock, ast);
@@ -192,12 +190,16 @@ int conf_announce_channel_push(struct ast_channel *ast)
 
        features = ast_bridge_features_new();
        if (!features) {
+               ast_channel_unref(chan);
                return -1;
        }
        ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
 
        /* Impart the output channel into the bridge */
-       if (ast_bridge_impart(p->bridge, chan, NULL, features, 0)) {
+       if (ast_bridge_impart(p->bridge, chan, NULL, features,
+               AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
+               ast_bridge_features_destroy(features);
+               ast_channel_unref(chan);
                return -1;
        }
        ao2_lock(p);