summaryrefslogtreecommitdiff
path: root/main/manager.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2012-08-08 22:39:40 +0000
committerMark Michelson <mmichelson@digium.com>2012-08-08 22:39:40 +0000
commiteb9e645a27d0aa4ea300912c22c764b238bc4e47 (patch)
tree49b34c7ea6006b34278d2a16afb705111f922fa3 /main/manager.c
parentee849b461f034f2f19d800542cc3d563b17872a7 (diff)
Allow support for early media on AMI originates and call files.
This is based on the work done by Olle Johansson on review board. The idea is that the channel specified in an AMI originate or call file is typically not connected to the outgoing extension until the channel has been answered. With this change, an EarlyMedia header can be specified for AMI originates and an early_media option can be specified in call files. With this option set, once early media is received on a channel, it will be connected with the outgoing extension. (closes issue ASTERISK-18644) Reported by Olle Johansson Review: https://reviewboard.asterisk.org/r/1472 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370951 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c
index 12aa851c7..e1bf19f68 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -465,6 +465,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<parameter name="Account">
<para>Account code.</para>
</parameter>
+ <parameter name="EarlyMedia">
+ <para>Set to <literal>true</literal> to force call bridge on early media..</para>
+ </parameter>
<parameter name="Async">
<para>Set to <literal>true</literal> for fast origination.</para>
</parameter>
@@ -3915,6 +3918,7 @@ action_command_cleanup:
struct fast_originate_helper {
int timeout;
struct ast_format_cap *cap; /*!< Codecs used for a call */
+ int early_media;
AST_DECLARE_STRING_FIELDS (
AST_STRING_FIELD(tech);
/*! data can contain a channel name, extension number, username, password, etc. */
@@ -3966,7 +3970,7 @@ static void *fast_originate(void *data)
in->timeout, in->context, in->exten, in->priority, &reason, 1,
S_OR(in->cid_num, NULL),
S_OR(in->cid_name, NULL),
- in->vars, in->account, &chan);
+ in->vars, in->account, &chan, in->early_media);
}
/* Any vars memory was passed to the ast_pbx_outgoing_xxx() calls. */
in->vars = NULL;
@@ -4245,6 +4249,7 @@ static int action_originate(struct mansession *s, const struct message *m)
const char *async = astman_get_header(m, "Async");
const char *id = astman_get_header(m, "ActionID");
const char *codecs = astman_get_header(m, "Codecs");
+ const char *early_media = astman_get_header(m, "Earlymedia");
struct ast_variable *vars = NULL;
char *tech, *data;
char *l = NULL, *n = NULL;
@@ -4257,6 +4262,7 @@ static int action_originate(struct mansession *s, const struct message *m)
struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
struct ast_format tmp_fmt;
pthread_t th;
+ int bridge_early = 0;
if (!cap) {
astman_send_error(s, m, "Internal Error. Memory allocation failure.");
@@ -4359,6 +4365,9 @@ static int action_originate(struct mansession *s, const struct message *m)
}
}
+ /* For originate async - we can bridge in early media stage */
+ bridge_early = ast_true(early_media);
+
if (ast_true(async)) {
struct fast_originate_helper *fast;
@@ -4384,6 +4393,7 @@ static int action_originate(struct mansession *s, const struct message *m)
fast->cap = cap;
cap = NULL; /* transfered originate helper the capabilities structure. It is now responsible for freeing it. */
fast->timeout = to;
+ fast->early_media = bridge_early;
fast->priority = pi;
if (ast_pthread_create_detached(&th, NULL, fast_originate, fast)) {
destroy_fast_originate_helper(fast);
@@ -4397,7 +4407,7 @@ static int action_originate(struct mansession *s, const struct message *m)
/* Any vars memory was passed to ast_pbx_outgoing_app(). */
} else {
if (exten && context && pi) {
- res = ast_pbx_outgoing_exten(tech, cap, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
+ res = ast_pbx_outgoing_exten(tech, cap, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL, bridge_early);
/* Any vars memory was passed to ast_pbx_outgoing_exten(). */
} else {
astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");