[Asterisk-code-review] app originate: Add async option. (asterisk[master])

Russell Bryant asteriskteam at digium.com
Wed Mar 21 14:55:34 CDT 2018


Russell Bryant has uploaded this change for review. ( https://gerrit.asterisk.org/8623


Change subject: app_originate: Add async option.
......................................................................

app_originate: Add async option.

Add an option to make app_originate not wait for the created channel
to answer.

Change-Id: I7fc2facd77079abc6321f44e8bcd4e39298de2ae
Requested-by: Frederic Steinfels <fst at highdefinition.ch>
Signed-off-by: Russell Bryant <russell at russellbryant.net>
---
M apps/app_originate.c
1 file changed, 10 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/8623/1

diff --git a/apps/app_originate.c b/apps/app_originate.c
index 30fa565..107be84 100644
--- a/apps/app_originate.c
+++ b/apps/app_originate.c
@@ -74,6 +74,10 @@
 			</parameter>
 			<parameter name="options" required="false">
 				<optionlist>
+				<option name="a">
+					<para>Originate asynchronously.  In other words, continue in the dialplan
+					without waiting for the originated channel to answer.</para>
+				</option>
 				<option name="b" argsep="^">
 					<para>Before originating the outgoing call, Gosub to the specified
 					location using the newly created channel.</para>
@@ -123,6 +127,7 @@
 enum {
 	OPT_PREDIAL_CALLEE =    (1 << 0),
 	OPT_PREDIAL_CALLER =    (1 << 1),
+	OPT_ASYNC =             (1 << 2),
 };
 
 enum {
@@ -133,6 +138,7 @@
 };
 
 AST_APP_OPTIONS(originate_exec_options, BEGIN_OPTIONS
+	AST_APP_OPTION('a', OPT_ASYNC),
 	AST_APP_OPTION_ARG('b', OPT_PREDIAL_CALLEE, OPT_ARG_PREDIAL_CALLEE),
 	AST_APP_OPTION_ARG('B', OPT_PREDIAL_CALLER, OPT_ARG_PREDIAL_CALLER),
 END_OPTIONS );
@@ -250,7 +256,8 @@
 
 		res = ast_pbx_outgoing_exten_predial(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, exten, priority, &outgoing_status,
-				AST_OUTGOING_WAIT, NULL, NULL, NULL, NULL, NULL, 0, NULL,
+				ast_test_flag64(&opts, OPT_ASYNC) ? AST_OUTGOING_NO_WAIT : AST_OUTGOING_WAIT,
+				NULL, NULL, NULL, NULL, NULL, 0, NULL,
 				predial_callee);
 	} else {
 		ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
@@ -258,7 +265,8 @@
 
 		res = ast_pbx_outgoing_app_predial(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, args.arg2, &outgoing_status,
-				AST_OUTGOING_WAIT, NULL, NULL, NULL, NULL, NULL, NULL,
+				ast_test_flag64(&opts, OPT_ASYNC) ? AST_OUTGOING_NO_WAIT : AST_OUTGOING_WAIT,
+				NULL, NULL, NULL, NULL, NULL, NULL,
 				predial_callee);
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/8623
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fc2facd77079abc6321f44e8bcd4e39298de2ae
Gerrit-Change-Number: 8623
Gerrit-PatchSet: 1
Gerrit-Owner: Russell Bryant <russell at russellbryant.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180321/f9b4a09e/attachment.html>


More information about the asterisk-code-review mailing list