]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only attempt early bridging if the options given to Dial() permit it.
authorJoshua Colp <jcolp@digium.com>
Mon, 1 Oct 2007 13:49:36 +0000 (13:49 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 1 Oct 2007 13:49:36 +0000 (13:49 +0000)
(closes issue #10861)
Reported by: peekyb

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@84158 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c

index a06598c8d5d7289e4503621b955e5739dc68f315..8e554a750052fc80db67b59e2072d1607cdb2cbe 100644 (file)
@@ -291,6 +291,8 @@ AST_APP_OPTIONS(dial_exec_options, {
        AST_APP_OPTION('W', OPT_CALLER_MONITOR),
 });
 
+#define CAN_EARLY_BRIDGE(flags) (!ast_test_flag(flags, OPT_CALLEE_HANGUP) && !ast_test_flag(flags, OPT_CALLER_HANGUP) && !ast_test_flag(flags, OPT_CALLEE_TRANSFER) && !ast_test_flag(flags, OPT_CALLER_TRANSFER) && !ast_test_flag(flags, OPT_CALLEE_MONITOR) && !ast_test_flag(flags, OPT_CALLER_MONITOR) && !ast_test_flag(flags, OPT_CALLEE_PARK) && !ast_test_flag(flags, OPT_CALLER_PARK))
+
 /* We define a custom "local user" structure because we
    use it not only for keeping track of what is in use but
    also for keeping track of who we're dialing. */
@@ -584,7 +586,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                                                ast_copy_string(c->dialcontext, "", sizeof(c->dialcontext));
                                                ast_copy_string(c->exten, "", sizeof(c->exten));
                                                /* Setup RTP early bridge if appropriate */
-                                               ast_rtp_early_bridge(in, peer);
+                                               if (CAN_EARLY_BRIDGE(peerflags))
+                                                       ast_rtp_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;
@@ -612,7 +615,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                                        if (option_verbose > 2)
                                                ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", c->name);
                                        /* Setup early media if appropriate */
-                                       if (single)
+                                       if (single && CAN_EARLY_BRIDGE(peerflags))
                                                ast_rtp_early_bridge(in, c);
                                        if (!(*sentringing) && !ast_test_flag(outgoing, OPT_MUSICBACK)) {
                                                ast_indicate(in, AST_CONTROL_RINGING);
@@ -623,7 +626,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                                        if (option_verbose > 2)
                                                ast_verbose (VERBOSE_PREFIX_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_rtp_early_bridge(in, c);
                                        if (!ast_test_flag(outgoing, OPT_RINGBACK))
                                                ast_indicate(in, AST_CONTROL_PROGRESS);
@@ -636,7 +639,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                                case AST_CONTROL_PROCEEDING:
                                        if (option_verbose > 2)
                                                ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
-                                       if (single)
+                                       if (single && CAN_EARLY_BRIDGE(peerflags))
                                                ast_rtp_early_bridge(in, c);
                                        if (!ast_test_flag(outgoing, OPT_RINGBACK))
                                                ast_indicate(in, AST_CONTROL_PROCEEDING);