[asterisk-commits] mmichelson: branch group/ari-greedy-atxfer r419880 - /team/group/ari-greedy-a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 31 17:42:38 CDT 2014
Author: mmichelson
Date: Thu Jul 31 17:42:36 2014
New Revision: 419880
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=419880
Log:
Set up local channels in link-type attended transfers to enter stasis if necessary.
This actually caused attended transfers to work properly for me and to generate expected
Stasis messages for the local channel that entered the Stasis bridge.
Modified:
team/group/ari-greedy-atxfer/res/stasis/app.c
Modified: team/group/ari-greedy-atxfer/res/stasis/app.c
URL: http://svnview.digium.com/svn/asterisk/team/group/ari-greedy-atxfer/res/stasis/app.c?view=diff&rev=419880&r1=419879&r2=419880
==============================================================================
--- team/group/ari-greedy-atxfer/res/stasis/app.c (original)
+++ team/group/ari-greedy-atxfer/res/stasis/app.c Thu Jul 31 17:42:36 2014
@@ -668,6 +668,23 @@
(bridge && bridge_app_subscribed_involved(app, bridge))) {
stasis_publish(app->topic, message);
}
+}
+
+static void set_replacement_channel(struct ast_channel_snapshot *to_be_replaced,
+ struct ast_channel_snapshot *replacing)
+{
+ struct stasis_app_control *control = stasis_app_control_find_by_channel_id(
+ to_be_replaced->uniqueid);
+ struct ast_channel *chan = ast_channel_get_by_name(replacing->uniqueid);
+
+ if (control && chan) {
+ ast_channel_lock(chan);
+ app_set_replace_channel_app(chan, app_name(control_app(control)));
+ app_set_replace_channel_snapshot(chan, to_be_replaced);
+ ast_channel_unlock(chan);
+ }
+ ast_channel_cleanup(chan);
+ ao2_cleanup(control);
}
static void bridge_attended_transfer_handler(void *data, struct stasis_subscription *sub,
@@ -716,18 +733,15 @@
}
if (transfer_msg->replace_channel) {
- struct stasis_app_control *control = stasis_app_control_find_by_channel_id(
- transfer_msg->to_transferee.channel_snapshot->uniqueid);
- struct ast_channel *chan = ast_channel_get_by_name(transfer_msg->replace_channel->uniqueid);
-
- if (control && chan) {
- ast_channel_lock(chan);
- app_set_replace_channel_app(chan, app_name(control_app(control)));
- app_set_replace_channel_snapshot(chan, transfer_msg->to_transferee.channel_snapshot);
- ast_channel_unlock(chan);
- }
- ast_channel_cleanup(chan);
- ao2_cleanup(control);
+ set_replacement_channel(transfer_msg->to_transferee.channel_snapshot,
+ transfer_msg->replace_channel);
+ }
+
+ if (transfer_msg->dest_type == AST_ATTENDED_TRANSFER_DEST_LINK) {
+ set_replacement_channel(transfer_msg->to_transferee.channel_snapshot,
+ transfer_msg->dest.links[0]);
+ set_replacement_channel(transfer_msg->to_transfer_target.channel_snapshot,
+ transfer_msg->dest.links[1]);
}
}
More information about the asterisk-commits
mailing list