aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-09 11:44:50 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-09 11:44:50 +0000
commit3da3803c07ac5061123a9ef505c6506f07a58540 (patch)
treed57b0a40dccb81bbcb68b1d0c7e720f6a331ffbb /apps/app_dial.c
parentfaf703671d6bee04df9dc3841c30e37efe1c1c80 (diff)
Make SIP early media work more efficiently without so many reinvites
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@26019 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 6dddb855b..7d97187e3 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -482,7 +482,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
ast_clear_flag(o, DIAL_STILLGOING);
HANDLE_CAUSE(cause, in);
} else {
- ast_rtp_make_compatible(c, in);
+ ast_rtp_make_compatible(c, in, single);
if (c->cid.cid_num)
free(c->cid.cid_num);
c->cid.cid_num = NULL;
@@ -550,6 +550,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
DIAL_NOFORWARDHTML);
+ /* Setup early media if appropriate */
+ ast_rtp_early_media(in, peer);
}
/* If call has been answered, then the eventual hangup is likely to be normal hangup */
in->hangupcause = AST_CAUSE_NORMAL_CLEARING;
@@ -576,6 +578,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
case AST_CONTROL_RINGING:
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s is ringing\n", c->name);
+ /* Setup early media if appropriate */
+ if (single)
+ ast_rtp_early_media(in, c);
if (!(*sentringing) && !ast_test_flag(outgoing, OPT_MUSICBACK)) {
ast_indicate(in, AST_CONTROL_RINGING);
(*sentringing)++;
@@ -584,6 +589,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
case AST_CONTROL_PROGRESS:
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)
+ ast_rtp_early_media(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROGRESS);
break;
@@ -595,6 +603,8 @@ 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)
+ ast_rtp_early_media(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROCEEDING);
break;
@@ -1056,7 +1066,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
}
/* Setup outgoing SDP to match incoming one */
- ast_rtp_make_compatible(tmp->chan, chan);
+ ast_rtp_make_compatible(tmp->chan, chan, !outgoing && !rest);
/* Inherit specially named variables from parent channel */
ast_channel_inherit_variables(chan, tmp->chan);
@@ -1550,6 +1560,7 @@ out:
sentringing = 0;
ast_indicate(chan, -1);
}
+ ast_rtp_early_media(chan, NULL);
hanguptree(outgoing, NULL);
pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
if (option_debug)