<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11453">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_confbridge: Attended transfer event fixup<br><br>When a channel already in a conference bridge is attended transfered<br>to another extension, or when an existing call is attended<br>transferred into a conference bridge, we now generate ConfbridgeJoin<br>and ConfbridgeLeave events for the entering and departing channels.<br><br>Change-Id: Id7709cfbceb26fbcb828b2d0d2a6b2fbeaf028e1<br>---<br>M apps/app_confbridge.c<br>M apps/confbridge/confbridge_manager.c<br>M apps/confbridge/include/confbridge.h<br>M include/asterisk/stasis_bridges.h<br>M main/stasis_bridges.c<br>5 files changed, 254 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c</span><br><span>index 6d141bd..7fe727e 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -587,6 +587,43 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void send_conf_stasis_snapshots(struct confbridge_conference *conference,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_snapshot *chan_snapshot, struct stasis_message_type *type,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *extras)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_bridge_snapshot *, bridge_snapshot, NULL, ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ json_object = ast_json_pack("{s: s}",</span><br><span style="color: hsl(120, 100%, 40%);">+ "conference", conference->name);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!json_object) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (extras) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_json_object_update(json_object, extras);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bridge_lock(conference->bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+ bridge_snapshot = ast_bridge_snapshot_create(conference->bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bridge_unlock(conference->bridge);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!bridge_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ msg = ast_bridge_blob_create_from_snapshots(type,</span><br><span style="color: hsl(120, 100%, 40%);">+ bridge_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ chan_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ json_object);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!msg) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ stasis_publish(ast_bridge_topic(conference->bridge), msg);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void send_conf_start_event(struct confbridge_conference *conference)</span><br><span> {</span><br><span> send_conf_stasis(conference, NULL, confbridge_start_type(), NULL, 0);</span><br><span>@@ -1479,6 +1516,126 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void confbridge_unlock_and_unref(void *obj)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct confbridge_conference *conference = obj;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!obj) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_unlock(conference);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(conference, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void confbridge_handle_atxfer(struct ast_attended_transfer_message *msg)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_snapshot *old_snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_snapshot *new_snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *confbr_name = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ char *comma;</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct confbridge_conference *, conference, NULL, confbridge_unlock_and_unref);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct confbridge_user *user = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ int found_user = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *json_object;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (msg->to_transferee.channel_snapshot</span><br><span style="color: hsl(120, 100%, 40%);">+ && strcmp(msg->to_transferee.channel_snapshot->dialplan->appl, "ConfBridge") == 0</span><br><span style="color: hsl(120, 100%, 40%);">+ && msg->target) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We're transferring a bridge to an extension */</span><br><span style="color: hsl(120, 100%, 40%);">+ old_snapshot = msg->to_transferee.channel_snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+ new_snapshot = msg->target;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (msg->to_transfer_target.channel_snapshot</span><br><span style="color: hsl(120, 100%, 40%);">+ && strcmp(msg->to_transfer_target.channel_snapshot->dialplan->appl, "ConfBridge") == 0</span><br><span style="color: hsl(120, 100%, 40%);">+ && msg->transferee) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We're transferring a call to a bridge */</span><br><span style="color: hsl(120, 100%, 40%);">+ old_snapshot = msg->to_transfer_target.channel_snapshot;</span><br><span style="color: hsl(120, 100%, 40%);">+ new_snapshot = msg->transferee;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Could not determine proper channels\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * old_snapshot->data should have the original parameters passed to</span><br><span style="color: hsl(120, 100%, 40%);">+ * the ConfBridge app:</span><br><span style="color: hsl(120, 100%, 40%);">+ * conference[,bridge_profile[,user_profile[,menu]]]</span><br><span style="color: hsl(120, 100%, 40%);">+ * We'll use "conference" to look up the bridge.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * We _could_ use old_snapshot->bridgeid to get the bridge but</span><br><span style="color: hsl(120, 100%, 40%);">+ * that would involve locking the conference_bridges container</span><br><span style="color: hsl(120, 100%, 40%);">+ * and iterating over it looking for a matching bridge.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_strlen_zero(old_snapshot->dialplan->data)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Channel '%s' didn't have app data set\n", old_snapshot->base->name);</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ confbr_name = ast_strdupa(old_snapshot->dialplan->data);</span><br><span style="color: hsl(120, 100%, 40%);">+ comma = strchr(confbr_name, ',');</span><br><span style="color: hsl(120, 100%, 40%);">+ if (comma) {</span><br><span style="color: hsl(120, 100%, 40%);">+ *comma = '\0';</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(1, "Confbr: %s Leaving: %s Joining: %s\n", confbr_name, old_snapshot->base->name, new_snapshot->base->name);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ conference = ao2_find(conference_bridges, confbr_name, OBJ_SEARCH_KEY);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!conference) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Conference bridge '%s' not found\n", confbr_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_lock(conference);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * We need to grab the user profile for the departing user in order to</span><br><span style="color: hsl(120, 100%, 40%);">+ * properly format the join/leave messages.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_TRAVERSE(&conference->active_list, user, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (strcasecmp(ast_channel_name(user->chan), old_snapshot->base->name) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ found_user = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * If we didn't find the user in the active list, try the waiting list.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!found_user && conference->waitingusers) {</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (strcasecmp(ast_channel_name(user->chan), old_snapshot->base->name) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ found_user = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!found_user) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Unable to find user profile for channel '%s' in bridge '%s'\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ old_snapshot->base->name, confbr_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * We're going to use the existing user profile to create the messages.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ json_object = ast_json_pack("{s: b}",</span><br><span style="color: hsl(120, 100%, 40%);">+ "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)</span><br><span style="color: hsl(120, 100%, 40%);">+ );</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!json_object) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ send_conf_stasis_snapshots(conference, old_snapshot, confbridge_leave_type(), json_object);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_json_unref(json_object);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ json_object = ast_json_pack("{s: b, s: b}",</span><br><span style="color: hsl(120, 100%, 40%);">+ "admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN),</span><br><span style="color: hsl(120, 100%, 40%);">+ "muted", user->muted);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!json_object) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ send_conf_stasis_snapshots(conference, new_snapshot, confbridge_join_type(), json_object);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_json_unref(json_object);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span> * \brief Join a conference bridge</span><br><span> *</span><br><span>diff --git a/apps/confbridge/confbridge_manager.c b/apps/confbridge/confbridge_manager.c</span><br><span>index b1819ca..06cb433 100644</span><br><span>--- a/apps/confbridge/confbridge_manager.c</span><br><span>+++ b/apps/confbridge/confbridge_manager.c</span><br><span>@@ -621,6 +621,26 @@</span><br><span> ast_free(extra_text);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void confbridge_atxfer_cb(void *data, struct stasis_subscription *sub,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct stasis_message *message)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_attended_transfer_message *msg = stasis_message_data(message);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (msg->result != AST_BRIDGE_TRANSFER_SUCCESS) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This callback will get called for ALL attended transfers</span><br><span style="color: hsl(120, 100%, 40%);">+ * so we need to make sure this transfer belongs to</span><br><span style="color: hsl(120, 100%, 40%);">+ * a conference bridge before trying to handle it.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (msg->dest_type == AST_ATTENDED_TRANSFER_DEST_APP</span><br><span style="color: hsl(120, 100%, 40%);">+ && strcmp(msg->dest.app, "ConfBridge") == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ confbridge_handle_atxfer(msg);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void confbridge_start_record_cb(void *data, struct stasis_subscription *sub,</span><br><span> struct stasis_message *message)</span><br><span> {</span><br><span>@@ -740,6 +760,13 @@</span><br><span> return -1;</span><br><span> }</span><br><span> if (stasis_message_router_add(bridge_state_router,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_attended_transfer_type(),</span><br><span style="color: hsl(120, 100%, 40%);">+ confbridge_atxfer_cb,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ manager_confbridge_shutdown();</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (stasis_message_router_add(bridge_state_router,</span><br><span> confbridge_leave_type(),</span><br><span> confbridge_leave_cb,</span><br><span> NULL)) {</span><br><span>diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h</span><br><span>index 237431e..f932da8 100644</span><br><span>--- a/apps/confbridge/include/confbridge.h</span><br><span>+++ b/apps/confbridge/include/confbridge.h</span><br><span>@@ -28,6 +28,7 @@</span><br><span> #include "asterisk/channel.h"</span><br><span> #include "asterisk/bridge.h"</span><br><span> #include "asterisk/bridge_features.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/stasis_bridges.h"</span><br><span> #include "conf_state.h"</span><br><span> </span><br><span> /*! Maximum length of a conference bridge name */</span><br><span>@@ -714,4 +715,14 @@</span><br><span> void conf_send_event_to_participants(struct confbridge_conference *conference,</span><br><span> struct ast_channel *chan, struct stasis_message *msg);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Create join/leave events for attended transfers</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 13.28</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.5</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param msg The attended transfer stasis message</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void confbridge_handle_atxfer(struct ast_attended_transfer_message *msg);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #endif</span><br><span>diff --git a/include/asterisk/stasis_bridges.h b/include/asterisk/stasis_bridges.h</span><br><span>index 4d80955..3d6d2b2 100644</span><br><span>--- a/include/asterisk/stasis_bridges.h</span><br><span>+++ b/include/asterisk/stasis_bridges.h</span><br><span>@@ -167,6 +167,29 @@</span><br><span> struct ast_json *blob);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 13.28</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.5</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Creates a \ref ast_bridge_blob message from snapshots.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * The \a blob JSON object requires a \c "type" field describing the blob. It</span><br><span style="color: hsl(120, 100%, 40%);">+ * should also be treated as immutable and not modified after it is put into the</span><br><span style="color: hsl(120, 100%, 40%);">+ * message.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \pre bridge is locked.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \pre No channels are locked.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param bridge_snapshot Bridge snapshot</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param channel_snapshot Channel snapshot</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param blob JSON object representing the data.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return \ref ast_bridge_blob message.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return \c NULL on error</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message *ast_bridge_blob_create_from_snapshots(struct stasis_message_type *type,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_bridge_snapshot *bridge_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_snapshot *chan_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *blob);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \since 12</span><br><span> * \brief Publish a bridge channel enter event</span><br><span> *</span><br><span>diff --git a/main/stasis_bridges.c b/main/stasis_bridges.c</span><br><span>index 31d3eac..9238adc 100644</span><br><span>--- a/main/stasis_bridges.c</span><br><span>+++ b/main/stasis_bridges.c</span><br><span>@@ -543,6 +543,42 @@</span><br><span> return msg;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct stasis_message *ast_bridge_blob_create_from_snapshots(</span><br><span style="color: hsl(120, 100%, 40%);">+ struct stasis_message_type *message_type,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_bridge_snapshot *bridge_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_channel_snapshot *chan_snapshot,</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_json *blob)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_bridge_blob *obj;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct stasis_message *msg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!message_type) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ obj = ao2_alloc(sizeof(*obj), bridge_blob_dtor);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!obj) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (bridge_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ obj->bridge = ao2_bump(bridge_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (chan_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ obj->channel = ao2_bump(chan_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (blob) {</span><br><span style="color: hsl(120, 100%, 40%);">+ obj->blob = ast_json_ref(blob);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ msg = stasis_message_create(message_type, obj);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(obj, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return msg;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> void ast_bridge_publish_enter(struct ast_bridge *bridge, struct ast_channel *chan,</span><br><span> struct ast_channel *swap)</span><br><span> {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11453">change 11453</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11453"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Id7709cfbceb26fbcb828b2d0d2a6b2fbeaf028e1 </div>
<div style="display:none"> Gerrit-Change-Number: 11453 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>