summaryrefslogtreecommitdiff
path: root/res/stasis
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2016-07-11 19:07:20 -0600
committerGeorge Joseph <gjoseph@digium.com>2016-07-12 11:16:44 -0600
commit886f2cab232e1dca65a90036aef39eda27443f4e (patch)
treebab3056afea4daaca8e58c0eac384a3b9b0a1e44 /res/stasis
parent44f16af7cc9a6bc5203106a81b595997cb31c4fd (diff)
rest_api/channels: Fix multiple issues with create and dial
* We weren't properly subscribing to the channel and it's originator on create. * We weren't doing a publish_dial after calling ast_call on dial. * We weren't calling depart_bridge when a channel left the dial bridge. The first 2 issues were causing events to not be generated and the third was actually causing channels to not get properly destroyed when hung up. Together these 3 issues were causing the new rest_apichannels/create_dial_bridge tests to fail. As a result of the fixes, the cdr state machine had to be slightly tweaked to allow bridge leave events without asserting and the tests themselves had to be updated to account for the channels now cleaning themselves up. Change-Id: Ibf23abf5a62de76e82afb4461af5099c961b97d8
Diffstat (limited to 'res/stasis')
-rw-r--r--res/stasis/control.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/res/stasis/control.c b/res/stasis/control.c
index b255477bf..219a2c6cd 100644
--- a/res/stasis/control.c
+++ b/res/stasis/control.c
@@ -881,6 +881,9 @@ end:
return ret_bridge;
}
+static int bridge_channel_depart(struct stasis_app_control *control,
+ struct ast_channel *chan, void *data);
+
/*!
* \brief after bridge callback for the dial bridge
*
@@ -890,6 +893,15 @@ end:
static void dial_bridge_after_cb(struct ast_channel *chan, void *data)
{
struct stasis_app_control *control = data;
+ struct ast_bridge_channel *bridge_channel;
+
+ ast_channel_lock(chan);
+ bridge_channel = ast_channel_get_bridge_channel(chan);
+ ast_channel_unlock(chan);
+
+ ast_debug(3, "Channel: <%s> Reason: %d\n", ast_channel_name(control->channel), ast_channel_hangupcause(chan));
+
+ stasis_app_send_command_async(control, bridge_channel_depart, bridge_channel, __ao2_cleanup);
control->bridge = NULL;
}
@@ -898,6 +910,7 @@ static void dial_bridge_after_cb_failed(enum ast_bridge_after_cb_reason reason,
{
struct stasis_app_control *control = data;
+ ast_debug(3, "Channel: <%s> Reason: %d\n", ast_channel_name(control->channel), reason);
dial_bridge_after_cb(control->channel, data);
}
@@ -1443,6 +1456,8 @@ static int app_control_dial(struct stasis_app_control *control,
return -1;
}
+ ast_channel_publish_dial(NULL, chan, args->dialstring, NULL);
+
return 0;
}