summaryrefslogtreecommitdiff
path: root/apps/app_page.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-12-09 22:17:14 +0000
committerJonathan Rose <jrose@digium.com>2013-12-09 22:17:14 +0000
commitf6e92c35df357a7f107a0f459089427c4d755af6 (patch)
tree3cf828b3607809c81a5485457a6ed15e4e7314cc /apps/app_page.c
parentc91d4d12de43324cc4a0a318f525935ecfecef54 (diff)
app_page: Add predial handlers for app_page.
(closes issue AFS-14) Review: https://reviewboard.asterisk.org/r/3045/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403576 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_page.c')
-rw-r--r--apps/app_page.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/apps/app_page.c b/apps/app_page.c
index 8e7d1d2bd..31e75e445 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -65,6 +65,27 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
</parameter>
<parameter name="options">
<optionlist>
+ <option name="b" argsep="^">
+ <para>Before initiating an outgoing call, Gosub to the specified
+ location using the newly created channel. The Gosub will be
+ executed for each destination channel.</para>
+ <argument name="context" required="false" />
+ <argument name="exten" required="false" />
+ <argument name="priority" required="true" hasparams="optional" argsep="^">
+ <argument name="arg1" multiple="true" required="true" />
+ <argument name="argN" />
+ </argument>
+ </option>
+ <option name="B" argsep="^">
+ <para>Before initiating the outgoing call(s), Gosub to the specified
+ location using the current channel.</para>
+ <argument name="context" required="false" />
+ <argument name="exten" required="false" />
+ <argument name="priority" required="true" hasparams="optional" argsep="^">
+ <argument name="arg1" multiple="true" required="true" />
+ <argument name="argN" />
+ </argument>
+ </option>
<option name="d">
<para>Full duplex audio</para>
</option>
@@ -118,14 +139,20 @@ enum page_opt_flags {
PAGE_IGNORE_FORWARDS = (1 << 4),
PAGE_ANNOUNCE = (1 << 5),
PAGE_NOCALLERANNOUNCE = (1 << 6),
+ PAGE_PREDIAL_CALLEE = (1 << 7),
+ PAGE_PREDIAL_CALLER = (1 << 8),
};
enum {
OPT_ARG_ANNOUNCE = 0,
- OPT_ARG_ARRAY_SIZE = 1,
+ OPT_ARG_PREDIAL_CALLEE = 1,
+ OPT_ARG_PREDIAL_CALLER = 2,
+ OPT_ARG_ARRAY_SIZE = 3,
};
AST_APP_OPTIONS(page_opts, {
+ AST_APP_OPTION_ARG('b', PAGE_PREDIAL_CALLEE, OPT_ARG_PREDIAL_CALLEE),
+ AST_APP_OPTION_ARG('B', PAGE_PREDIAL_CALLER, OPT_ARG_PREDIAL_CALLER),
AST_APP_OPTION('d', PAGE_DUPLEX),
AST_APP_OPTION('q', PAGE_QUIET),
AST_APP_OPTION('r', PAGE_RECORD),
@@ -283,6 +310,12 @@ static int page_exec(struct ast_channel *chan, const char *data)
return -1;
}
+ if (ast_test_flag(&options.flags, PAGE_PREDIAL_CALLER)
+ && !ast_strlen_zero(options.opts[OPT_ARG_PREDIAL_CALLER])) {
+ ast_replace_subargument_delimiter(options.opts[OPT_ARG_PREDIAL_CALLER]);
+ ast_app_exec_sub(NULL, chan, options.opts[OPT_ARG_PREDIAL_CALLER], 0);
+ }
+
/* Go through parsing/calling each device */
while ((tech = strsep(&args.devices, "&"))) {
int state = 0;
@@ -327,6 +360,11 @@ static int page_exec(struct ast_channel *chan, const char *data)
/* Set ANSWER_EXEC as global option */
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, confbridgeopts);
+ if (ast_test_flag(&options.flags, PAGE_PREDIAL_CALLEE)
+ && !ast_strlen_zero(options.opts[OPT_ARG_PREDIAL_CALLEE])) {
+ ast_dial_option_global_enable(dial, AST_DIAL_OPTION_PREDIAL, options.opts[OPT_ARG_PREDIAL_CALLEE]);
+ }
+
if (timeout) {
ast_dial_set_global_timeout(dial, timeout * 1000);
}