From 2a371cd80bfb88552d2f42545718da2489e1a5ba Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Fri, 13 Sep 2013 22:19:23 +0000 Subject: Restore Dial, Queue, and FollowMe 'I' option support. The Dial, Queue, and FollowMe applications need to inhibit the bridging initial connected line exchange in order to support the 'I' option. * Replaced the pass_reference flag on ast_bridge_join() with a flags parameter to pass other flags defined by enum ast_bridge_join_flags. * Replaced the independent flag on ast_bridge_impart() with a flags parameter to pass other flags defined by enum ast_bridge_impart_flags. * Since the Dial, Queue, and FollowMe applications are now the only callers of ast_bridge_call() and ast_bridge_call_with_flags(), changed the calling contract to require the initial COLP exchange to already have been done by the caller. * Made all callers of ast_bridge_impart() check the return value. It is important. As a precaution, I also made the compiler complain now if it is not checked. * Did some cleanup in parking_tests.c as a result of checking the ast_bridge_impart() return value. An independent, but associated change is: * Reduce stack usage in ast_indicate_data() and add a dropping redundant connected line verbose message. (closes issue ASTERISK-22072) Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/2845/ ........ Merged revisions 399136 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399138 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/stasis/control.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'res/stasis/control.c') diff --git a/res/stasis/control.c b/res/stasis/control.c index 8530abd9f..2c3a10980 100644 --- a/res/stasis/control.c +++ b/res/stasis/control.c @@ -117,7 +117,6 @@ static struct stasis_app_command *exec_command( command_fn = command_fn ? : noop_cb; command = command_create(command_fn, data); - if (!command) { return NULL; } @@ -166,7 +165,6 @@ static void *app_control_dial(struct stasis_app_control *control, ast_dial_set_global_timeout(dial, dial_data->timeout); res = ast_dial_run(dial, NULL, 0); - if (res != AST_DIAL_RESULT_ANSWERED || !(new_chan = ast_dial_answered_steal(dial))) { return NULL; } @@ -176,8 +174,12 @@ static void *app_control_dial(struct stasis_app_control *control, return NULL; } - ast_bridge_impart(bridge, new_chan, NULL, NULL, 1); - stasis_app_control_add_channel_to_bridge(control, bridge); + if (ast_bridge_impart(bridge, new_chan, NULL, NULL, + AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { + ast_hangup(new_chan); + } else { + stasis_app_control_add_channel_to_bridge(control, bridge); + } return NULL; } @@ -566,8 +568,7 @@ static void *app_control_add_channel_to_bridge( chan, NULL, /* swap channel */ NULL, /* features */ - 0); /* independent - false allows us to ast_bridge_depart() */ - + AST_BRIDGE_IMPART_CHAN_DEPARTABLE); if (res != 0) { ast_log(LOG_ERROR, "Error adding channel to bridge\n"); ast_channel_pbx_set(chan, control->pbx); -- cgit v1.2.3