[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r391669 - /team/mmichelson/tran...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 13 11:07:10 CDT 2013
Author: mmichelson
Date: Thu Jun 13 11:07:08 2013
New Revision: 391669
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391669
Log:
This patch allows for the BlindTransfer and AttendedTransfer manager events to be sent.
Thanks to David Lee for creating the patch.
Modified:
team/mmichelson/transfer_stasis/main/manager_bridging.c
Modified: team/mmichelson/transfer_stasis/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/manager_bridging.c?view=diff&rev=391669&r1=391668&r2=391669
==============================================================================
--- team/mmichelson/transfer_stasis/main/manager_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/manager_bridging.c Thu Jun 13 11:07:08 2013
@@ -108,6 +108,11 @@
</manager>
***/
+/*! \brief The \ref stasis subscription returned by the forwarding of the channel topic
+ * to the manager topic
+ */
+static struct stasis_subscription *topic_forwarder;
+
struct ast_str *ast_manager_build_bridge_state_string(
const struct ast_bridge_snapshot *snapshot,
const char *suffix)
@@ -409,10 +414,16 @@
return 0;
}
-static void manager_bridging_shutdown(void)
+static void manager_bridging_cleanup(void)
{
stasis_message_router_unsubscribe(bridge_state_router);
bridge_state_router = NULL;
+ stasis_unsubscribe(topic_forwarder);
+ topic_forwarder = NULL;
+}
+
+static void manager_bridging_shutdown(void)
+{
ast_manager_unregister("BridgeList");
ast_manager_unregister("BridgeInfo");
}
@@ -420,6 +431,8 @@
int manager_bridging_init(void)
{
int ret = 0;
+ struct stasis_topic *manager_topic;
+ struct stasis_topic *bridge_topic;
if (bridge_state_router) {
/* Already initialized */
@@ -427,10 +440,29 @@
}
ast_register_atexit(manager_bridging_shutdown);
-
- bridge_state_router = stasis_message_router_create(
- stasis_caching_get_topic(ast_bridge_topic_all_cached()));
-
+ ast_register_cleanup(manager_bridging_cleanup);
+
+ manager_topic = ast_manager_get_topic();
+ if (!manager_topic) {
+ return -1;
+ }
+
+ bridge_topic = stasis_caching_get_topic(ast_bridge_topic_all_cached());
+ if (!bridge_topic) {
+ return -1;
+ }
+
+ topic_forwarder = stasis_forward_all(bridge_topic, manager_topic);
+ if (!topic_forwarder) {
+ return -1;
+ }
+
+ /* BUGBUG - This should really route off of the manager_router, but
+ * can't b/c manager_channels is already routing the
+ * stasis_cache_update_type() messages. Having a separate router can
+ * cause some message ordering issues with bridge and channel messages.
+ */
+ bridge_state_router = stasis_message_router_create(bridge_topic);
if (!bridge_state_router) {
return -1;
}
More information about the asterisk-commits
mailing list