summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_dial.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index ce763653f..87b3dcc4f 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -313,6 +313,8 @@ AST_APP_OPTIONS(dial_exec_options, {
AST_APP_OPTION('W', OPT_CALLER_MONITOR),
});
+#define CAN_EARLY_BRIDGE(flags) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP) && !ast_test_flag64(flags, OPT_CALLER_HANGUP) && !ast_test_flag64(flags, OPT_CALLEE_TRANSFER) && !ast_test_flag64(flags, OPT_CALLER_TRANSFER) && !ast_test_flag64(flags, OPT_CALLEE_MONITOR) && !ast_test_flag64(flags, OPT_CALLER_MONITOR) && !ast_test_flag64(flags, OPT_CALLEE_PARK) && !ast_test_flag64(flags, OPT_CALLER_PARK))
+
/*
* The list of active channels
*/
@@ -660,8 +662,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
DIAL_NOFORWARDHTML);
ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
ast_copy_string(c->exten, "", sizeof(c->exten));
- /* Setup early bridge if appropriate */
- ast_channel_early_bridge(in, peer);
+ if (CAN_EARLY_BRIDGE(peerflags))
+ /* Setup early bridge if appropriate */
+ ast_channel_early_bridge(in, peer);
}
/* If call has been answered, then the eventual hangup is likely to be normal hangup */
in->hangupcause = AST_CAUSE_NORMAL_CLEARING;
@@ -686,7 +689,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
case AST_CONTROL_RINGING:
ast_verb(3, "%s is ringing\n", c->name);
/* Setup early media if appropriate */
- if (single)
+ if (single && CAN_EARLY_BRIDGE(peerflags))
ast_channel_early_bridge(in, c);
if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK)) {
ast_indicate(in, AST_CONTROL_RINGING);
@@ -696,7 +699,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
case AST_CONTROL_PROGRESS:
ast_verb(3, "%s is making progress passing it to %s\n", c->name, in->name);
/* Setup early media if appropriate */
- if (single)
+ if (single && CAN_EARLY_BRIDGE(peerflags))
ast_channel_early_bridge(in, c);
if (!ast_test_flag64(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROGRESS);
@@ -707,7 +710,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
break;
case AST_CONTROL_PROCEEDING:
ast_verb(3, "%s is proceeding passing it to %s\n", c->name, in->name);
- if (single)
+ if (single && CAN_EARLY_BRIDGE(peerflags))
ast_channel_early_bridge(in, c);
if (!ast_test_flag64(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROCEEDING);