[svn-commits] file: branch file/ari-dial-immediate r422400 - in /team/file/ari-dial-immedia...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 29 15:22:40 CDT 2014


Author: file
Date: Fri Aug 29 15:22:33 2014
New Revision: 422400

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=422400
Log:
Add the ability to mark an origination as immediate in ARI.

Immediate originations immediately execute the specified application or dialplan extension.

Modified:
    team/file/ari-dial-immediate/apps/app_originate.c
    team/file/ari-dial-immediate/apps/app_page.c
    team/file/ari-dial-immediate/funcs/func_periodic_hook.c
    team/file/ari-dial-immediate/include/asterisk/dial.h
    team/file/ari-dial-immediate/include/asterisk/pbx.h
    team/file/ari-dial-immediate/main/bridge_basic.c
    team/file/ari-dial-immediate/main/dial.c
    team/file/ari-dial-immediate/main/manager.c
    team/file/ari-dial-immediate/main/pbx.c
    team/file/ari-dial-immediate/pbx/pbx_spool.c
    team/file/ari-dial-immediate/res/ari/resource_channels.c
    team/file/ari-dial-immediate/res/ari/resource_channels.h
    team/file/ari-dial-immediate/res/res_ari_channels.c
    team/file/ari-dial-immediate/res/res_calendar.c
    team/file/ari-dial-immediate/res/res_clioriginate.c
    team/file/ari-dial-immediate/res/stasis/control.c
    team/file/ari-dial-immediate/rest-api/api-docs/channels.json

Modified: team/file/ari-dial-immediate/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/apps/app_originate.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/apps/app_originate.c (original)
+++ team/file/ari-dial-immediate/apps/app_originate.c Fri Aug 29 15:22:33 2014
@@ -179,14 +179,14 @@
 
 		ast_pbx_outgoing_exten(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, exten, priority, &outgoing_status, 1, NULL,
-				NULL, NULL, NULL, NULL, 0, NULL);
+				NULL, NULL, NULL, NULL, 0, NULL, 0);
 	} else if (!strcasecmp(args.type, "app")) {
 		ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
 				chantech, chandata, args.arg1, S_OR(args.arg2, ""));
 
 		ast_pbx_outgoing_app(chantech, cap_slin, chandata,
 				timeout * 1000, args.arg1, args.arg2, &outgoing_status, 1, NULL,
-				NULL, NULL, NULL, NULL, NULL);
+				NULL, NULL, NULL, NULL, NULL, 0);
 	} else {
 		ast_log(LOG_ERROR, "Incorrect type, it should be 'exten' or 'app': %s\n",
 				args.type);

Modified: team/file/ari-dial-immediate/apps/app_page.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/apps/app_page.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/apps/app_page.c (original)
+++ team/file/ari-dial-immediate/apps/app_page.c Fri Aug 29 15:22:33 2014
@@ -377,7 +377,7 @@
 		ast_dial_set_user_data(dial, &options);
 
 		/* Run this dial in async mode */
-		ast_dial_run(dial, chan, 1);
+		ast_dial_run(dial, chan, 1, 0);
 
 		/* Put in our dialing array */
 		dial_list[pos++] = dial;

Modified: team/file/ari-dial-immediate/funcs/func_periodic_hook.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/funcs/func_periodic_hook.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/funcs/func_periodic_hook.c (original)
+++ team/file/ari-dial-immediate/funcs/func_periodic_hook.c Fri Aug 29 15:22:33 2014
@@ -184,7 +184,7 @@
 
 	ast_pbx_outgoing_exten("Local", NULL, full_exten_name, 60,
 			arg->context, arg->exten, 1, NULL, 0, NULL, NULL, &chan_name_var,
-			NULL, NULL, 1, NULL);
+			NULL, NULL, 1, NULL, 0);
 
 	hook_thread_arg_destroy(arg);
 

Modified: team/file/ari-dial-immediate/include/asterisk/dial.h
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/include/asterisk/dial.h?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/include/asterisk/dial.h (original)
+++ team/file/ari-dial-immediate/include/asterisk/dial.h Fri Aug 29 15:22:33 2014
@@ -87,7 +87,7 @@
  * \note Dials channels in a dial structure.
  * \return Returns dial result code. (TRYING/INVALID/FAILED/ANSWERED/TIMEOUT/UNANSWERED).
  */
-enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async);
+enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async, int immediate);
 
 /*! \brief Return channel that answered
  * \note Returns the Asterisk channel that answered

Modified: team/file/ari-dial-immediate/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/include/asterisk/pbx.h?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/include/asterisk/pbx.h (original)
+++ team/file/ari-dial-immediate/include/asterisk/pbx.h Fri Aug 29 15:22:33 2014
@@ -1129,6 +1129,7 @@
  *        and reference bumped.
  * \param early_media If non-zero the channel "answers" when progress is indicated.
  * \param assignedids Optional. The uniqueid(s) to assign the channel(s) that are created.
+ * \param immediate Send the channel to the extension immediately without answering.
  *
  * \retval 0 on success
  * \retval -1 on failure
@@ -1137,7 +1138,7 @@
 	int timeout, const char *context, const char *exten, int priority, int *reason,
 	int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars,
 	const char *account, struct ast_channel **locked_channel, int early_media,
-	const struct ast_assigned_ids *assignedids);
+	const struct ast_assigned_ids *assignedids, int immediate);
 
 /*!
  * \brief Synchronously or asynchronously make an outbound call and execute an
@@ -1164,6 +1165,7 @@
  *        is returned.  Otherwise it is set to NULL.  This is returned both locked
  *        and reference bumped.
  * \param assignedids Optional. The uniqueid(s) to assign the channel(s) that are created.
+ * \param immediate Send the channel to the application immediately without answering.
  *
  * \retval 0 on success
  * \retval -1 on failure
@@ -1172,7 +1174,7 @@
 	int timeout, const char *app, const char *appdata, int *reason, int synchronous,
 	const char *cid_num, const char *cid_name, struct ast_variable *vars,
 	const char *account, struct ast_channel **locked_channel,
-	const struct ast_assigned_ids *assignedids);
+	const struct ast_assigned_ids *assignedids, int immediate);
 
 /*!
  * \brief Evaluate a condition

Modified: team/file/ari-dial-immediate/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/main/bridge_basic.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/main/bridge_basic.c (original)
+++ team/file/ari-dial-immediate/main/bridge_basic.c Fri Aug 29 15:22:33 2014
@@ -2407,7 +2407,7 @@
 	ao2_ref(props, +1);
 	ast_dial_set_user_data(props->dial, props);
 
-	if (ast_dial_run(props->dial, NULL, 1) == AST_DIAL_RESULT_FAILED) {
+	if (ast_dial_run(props->dial, NULL, 1, 0) == AST_DIAL_RESULT_FAILED) {
 		ao2_ref(props, -1);
 		return -1;
 	}

Modified: team/file/ari-dial-immediate/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/main/dial.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/main/dial.c (original)
+++ team/file/ari-dial-immediate/main/dial.c Fri Aug 29 15:22:33 2014
@@ -905,7 +905,7 @@
  * \note Dials channels in a dial structure.
  * \return Returns dial result code. (TRYING/INVALID/FAILED/ANSWERED/TIMEOUT/UNANSWERED).
  */
-enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
+enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async, int immediate)
 {
 	enum ast_dial_result res = AST_DIAL_RESULT_TRYING;
 
@@ -936,6 +936,9 @@
 			ast_dial_hangup(dial);
 			res = AST_DIAL_RESULT_FAILED;
 		}
+	} else if (immediate) {
+		set_state(dial, AST_DIAL_RESULT_ANSWERED);
+		res = AST_DIAL_RESULT_ANSWERED;
 	} else {
 		res = monitor_dial(dial, chan);
 	}

Modified: team/file/ari-dial-immediate/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/main/manager.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/main/manager.c (original)
+++ team/file/ari-dial-immediate/main/manager.c Fri Aug 29 15:22:33 2014
@@ -4572,13 +4572,13 @@
 			in->timeout, in->app, in->appdata, &reason, 1,
 			S_OR(in->cid_num, NULL),
 			S_OR(in->cid_name, NULL),
-			in->vars, in->account, &chan, &assignedids);
+			in->vars, in->account, &chan, &assignedids, 0);
 	} else {
 		res = ast_pbx_outgoing_exten(in->tech, in->cap, in->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->early_media, &assignedids);
+			in->vars, in->account, &chan, in->early_media, &assignedids, 0);
 	}
 	/* Any vars memory was passed to the ast_pbx_outgoing_xxx() calls. */
 	in->vars = NULL;
@@ -5027,11 +5027,11 @@
 			}
 		}
 	} else if (!ast_strlen_zero(app)) {
-		res = ast_pbx_outgoing_app(tech, cap, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL, assignedids.uniqueid ? &assignedids : NULL);
+		res = ast_pbx_outgoing_app(tech, cap, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL, assignedids.uniqueid ? &assignedids : NULL, 0);
 		/* 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, bridge_early, assignedids.uniqueid ? &assignedids : NULL);
+			res = ast_pbx_outgoing_exten(tech, cap, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL, bridge_early, assignedids.uniqueid ? &assignedids : NULL, 0);
 			/* Any vars memory was passed to ast_pbx_outgoing_exten(). */
 		} else {
 			astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");

Modified: team/file/ari-dial-immediate/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/main/pbx.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/main/pbx.c (original)
+++ team/file/ari-dial-immediate/main/pbx.c Fri Aug 29 15:22:33 2014
@@ -10186,6 +10186,8 @@
 	int priority;
 	/*! \brief Result of the dial operation when dialed is set */
 	int dial_res;
+	/*! \brief Whether to send the channel to the extension or application immediately */
+	int immediate;
 	/*! \brief Set when dialing is completed */
 	unsigned int dialed:1;
 	/*! \brief Set when execution is completed */
@@ -10213,7 +10215,7 @@
 	enum ast_dial_result res;
 
 	/* Notify anyone interested that dialing is complete */
-	res = ast_dial_run(outgoing->dial, NULL, 0);
+	res = ast_dial_run(outgoing->dial, NULL, 0, outgoing->immediate);
 	ao2_lock(outgoing);
 	outgoing->dial_res = res;
 	outgoing->dialed = 1;
@@ -10338,7 +10340,7 @@
 	const char *app, const char *appdata, int *reason, int synchronous,
 	const char *cid_num, const char *cid_name, struct ast_variable *vars,
 	const char *account, struct ast_channel **locked_channel, int early_media,
-	const struct ast_assigned_ids *assignedids)
+	const struct ast_assigned_ids *assignedids, int immediate)
 {
 	RAII_VAR(struct pbx_outgoing *, outgoing, NULL, ao2_cleanup);
 	struct ast_channel *dialed;
@@ -10443,6 +10445,8 @@
 		}
 	}
 
+	outgoing->immediate = immediate;
+
 	ao2_ref(outgoing, +1);
 	if (ast_pthread_create_detached(&thread, NULL, pbx_outgoing_exec, outgoing)) {
 		ast_log(LOG_WARNING, "Unable to spawn dialing thread for '%s/%s'\n", type, addr);
@@ -10499,7 +10503,7 @@
 	int timeout, const char *context, const char *exten, int priority, int *reason,
 	int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars,
 	const char *account, struct ast_channel **locked_channel, int early_media,
-	const struct ast_assigned_ids *assignedids)
+	const struct ast_assigned_ids *assignedids, int immediate)
 {
 	int res;
 	int my_reason;
@@ -10514,7 +10518,7 @@
 
 	res = pbx_outgoing_attempt(type, cap, addr, timeout, context, exten, priority,
 		NULL, NULL, reason, synchronous, cid_num, cid_name, vars, account, locked_channel,
-		early_media, assignedids);
+		early_media, assignedids, immediate);
 
 	if (res < 0 /* Call failed to get connected for some reason. */
 		&& 1 < synchronous
@@ -10553,7 +10557,7 @@
 	int timeout, const char *app, const char *appdata, int *reason, int synchronous,
 	const char *cid_num, const char *cid_name, struct ast_variable *vars,
 	const char *account, struct ast_channel **locked_channel,
-	const struct ast_assigned_ids *assignedids)
+	const struct ast_assigned_ids *assignedids, int immediate)
 {
 	if (reason) {
 		*reason = 0;
@@ -10567,7 +10571,7 @@
 
 	return pbx_outgoing_attempt(type, cap, addr, timeout, NULL, NULL, 0, app, appdata,
 		reason, synchronous, cid_num, cid_name, vars, account, locked_channel, 0,
-		assignedids);
+		assignedids, immediate);
 }
 
 /* this is the guts of destroying a context --

Modified: team/file/ari-dial-immediate/pbx/pbx_spool.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/pbx/pbx_spool.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/pbx/pbx_spool.c (original)
+++ team/file/ari-dial-immediate/pbx/pbx_spool.c Fri Aug 29 15:22:33 2014
@@ -376,14 +376,14 @@
 		ast_verb(3, "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
 		res = ast_pbx_outgoing_app(o->tech, o->capabilities, o->dest, o->waittime * 1000,
 			o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name,
-			o->vars, o->account, NULL, NULL);
+			o->vars, o->account, NULL, NULL, 0);
 		o->vars = NULL;
 	} else {
 		ast_verb(3, "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);
 		res = ast_pbx_outgoing_exten(o->tech, o->capabilities, o->dest,
 			o->waittime * 1000, o->context, o->exten, o->priority, &reason,
 			2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL,
-			ast_test_flag(&o->options, SPOOL_FLAG_EARLY_MEDIA), NULL);
+			ast_test_flag(&o->options, SPOOL_FLAG_EARLY_MEDIA), NULL, 0);
 		o->vars = NULL;
 	}
 	if (res) {

Modified: team/file/ari-dial-immediate/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/ari/resource_channels.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/ari/resource_channels.c (original)
+++ team/file/ari-dial-immediate/res/ari/resource_channels.c Fri Aug 29 15:22:33 2014
@@ -734,6 +734,7 @@
 	struct ast_variable *variables,
 	const char *args_channel_id,
 	const char *args_other_channel_id,
+	int args_immediate,
 	struct ast_ari_response *response)
 {
 	char *dialtech;
@@ -814,13 +815,13 @@
 		}
 
 		/* originate a channel, putting it into an application */
-		if (ast_pbx_outgoing_app(dialtech, cap, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, variables, NULL, &chan, &assignedids)) {
+		if (ast_pbx_outgoing_app(dialtech, cap, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, variables, NULL, &chan, &assignedids, args_immediate)) {
 			ast_ari_response_alloc_failed(response);
 			return;
 		}
 	} else if (!ast_strlen_zero(args_extension)) {
 		/* originate a channel, sending it to an extension */
-		if (ast_pbx_outgoing_exten(dialtech, cap, dialdevice, timeout, S_OR(args_context, "default"), args_extension, args_priority ? args_priority : 1, NULL, 0, cid_num, cid_name, variables, NULL, &chan, 0, &assignedids)) {
+		if (ast_pbx_outgoing_exten(dialtech, cap, dialdevice, timeout, S_OR(args_context, "default"), args_extension, args_priority ? args_priority : 1, NULL, 0, cid_num, cid_name, variables, NULL, &chan, 0, &assignedids, args_immediate)) {
 			ast_ari_response_alloc_failed(response);
 			return;
 		}
@@ -883,6 +884,7 @@
 		variables,
 		args->channel_id,
 		args->other_channel_id,
+		args->immediate,
 		response);
 }
 
@@ -919,6 +921,7 @@
 		variables,
 		args->channel_id,
 		args->other_channel_id,
+		args->immediate,
 		response);
 }
 

Modified: team/file/ari-dial-immediate/res/ari/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/ari/resource_channels.h?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/ari/resource_channels.h (original)
+++ team/file/ari-dial-immediate/res/ari/resource_channels.h Fri Aug 29 15:22:33 2014
@@ -74,6 +74,8 @@
 	const char *channel_id;
 	/*! The unique id to assign the second channel when using local channels. */
 	const char *other_channel_id;
+	/*! Whether to send the originated channel directly to the extension or application without the remote end having answered. */
+	int immediate;
 };
 /*!
  * \brief Body parsing function for /channels.
@@ -133,6 +135,8 @@
 	struct ast_json *variables;
 	/*! The unique id to assign the second channel when using local channels. */
 	const char *other_channel_id;
+	/*! Whether to send the originated channel directly to the extension or application without the remote end having answered. */
+	int immediate;
 };
 /*!
  * \brief Body parsing function for /channels/{channelId}.

Modified: team/file/ari-dial-immediate/res/res_ari_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/res_ari_channels.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/res_ari_channels.c (original)
+++ team/file/ari-dial-immediate/res/res_ari_channels.c Fri Aug 29 15:22:33 2014
@@ -148,6 +148,10 @@
 	if (field) {
 		args->other_channel_id = ast_json_string_get(field);
 	}
+	field = ast_json_object_get(body, "immediate");
+	if (field) {
+		args->immediate = ast_json_is_true(field);
+	}
 	return 0;
 }
 
@@ -201,6 +205,9 @@
 		} else
 		if (strcmp(i->name, "otherChannelId") == 0) {
 			args.other_channel_id = (i->value);
+		} else
+		if (strcmp(i->name, "immediate") == 0) {
+			args.immediate = ast_true(i->value);
 		} else
 		{}
 	}
@@ -354,6 +361,10 @@
 	if (field) {
 		args->other_channel_id = ast_json_string_get(field);
 	}
+	field = ast_json_object_get(body, "immediate");
+	if (field) {
+		args->immediate = ast_json_is_true(field);
+	}
 	return 0;
 }
 
@@ -404,6 +415,9 @@
 		} else
 		if (strcmp(i->name, "otherChannelId") == 0) {
 			args.other_channel_id = (i->value);
+		} else
+		if (strcmp(i->name, "immediate") == 0) {
+			args.immediate = ast_true(i->value);
 		} else
 		{}
 	}

Modified: team/file/ari-dial-immediate/res/res_calendar.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/res_calendar.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/res_calendar.c (original)
+++ team/file/ari-dial-immediate/res/res_calendar.c Fri Aug 29 15:22:33 2014
@@ -817,7 +817,7 @@
 	}
 
 	ast_verb(3, "Dialing %s for notification on calendar %s\n", event->owner->notify_channel, event->owner->name);
-	res = ast_dial_run(dial, chan, 0);
+	res = ast_dial_run(dial, chan, 0, 0);
 
 	if (res != AST_DIAL_RESULT_ANSWERED) {
 		ast_verb(3, "Notification call for %s was not completed\n", event->owner->name);

Modified: team/file/ari-dial-immediate/res/res_clioriginate.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/res_clioriginate.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/res_clioriginate.c (original)
+++ team/file/ari-dial-immediate/res/res_clioriginate.c Fri Aug 29 15:22:33 2014
@@ -74,7 +74,7 @@
 		return CLI_FAILURE;
 	}
 	ast_format_cap_append(cap, ast_format_slin, 0);
-	ast_pbx_outgoing_app(chantech, cap, chandata, TIMEOUT * 1000, app, appdata, &reason, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+	ast_pbx_outgoing_app(chantech, cap, chandata, TIMEOUT * 1000, app, appdata, &reason, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0);
 	ao2_ref(cap, -1);
 
 	return CLI_SUCCESS;
@@ -118,7 +118,7 @@
 		return CLI_FAILURE;
 	}
 	ast_format_cap_append(cap, ast_format_slin, 0);
-	ast_pbx_outgoing_exten(chantech, cap, chandata, TIMEOUT * 1000, context, exten, 1, &reason, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL);
+	ast_pbx_outgoing_exten(chantech, cap, chandata, TIMEOUT * 1000, context, exten, 1, &reason, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0);
 	ao2_ref(cap, -1);
 
 	return CLI_SUCCESS;

Modified: team/file/ari-dial-immediate/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/res/stasis/control.c?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/res/stasis/control.c (original)
+++ team/file/ari-dial-immediate/res/stasis/control.c Fri Aug 29 15:22:33 2014
@@ -272,89 +272,6 @@
 	return exec_command_on_condition(control, command_fn, data, data_destructor, NULL);
 }
 
-struct stasis_app_control_dial_data {
-	char endpoint[AST_CHANNEL_NAME];
-	int timeout;
-};
-
-static int app_control_dial(struct stasis_app_control *control,
-	struct ast_channel *chan, void *data)
-{
-	RAII_VAR(struct ast_dial *, dial, ast_dial_create(), ast_dial_destroy);
-	struct stasis_app_control_dial_data *dial_data = data;
-	enum ast_dial_result res;
-	char *tech, *resource;
-	struct ast_channel *new_chan;
-	RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
-
-	tech = dial_data->endpoint;
-	if (!(resource = strchr(tech, '/'))) {
-		return -1;
-	}
-	*resource++ = '\0';
-
-	if (!dial) {
-		ast_log(LOG_ERROR, "Failed to create dialing structure.\n");
-		return -1;
-	}
-
-	if (ast_dial_append(dial, tech, resource, NULL) < 0) {
-		ast_log(LOG_ERROR, "Failed to add %s/%s to dialing structure.\n", tech, resource);
-		return -1;
-	}
-
-	ast_dial_set_global_timeout(dial, dial_data->timeout);
-
-	res = ast_dial_run(dial, NULL, 0);
-	if (res != AST_DIAL_RESULT_ANSWERED || !(new_chan = ast_dial_answered_steal(dial))) {
-		return -1;
-	}
-
-	if (!(bridge = ast_bridge_basic_new())) {
-		ast_log(LOG_ERROR, "Failed to create basic bridge.\n");
-		return -1;
-	}
-
-	if (ast_bridge_impart(bridge, new_chan, NULL, NULL,
-		AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
-		ast_hangup(new_chan);
-	} else {
-		control_add_channel_to_bridge(control, chan, bridge);
-	}
-
-	return 0;
-}
-
-int stasis_app_control_dial(struct stasis_app_control *control, const char *endpoint, const char *exten, const char *context,
-			    int timeout)
-{
-	struct stasis_app_control_dial_data *dial_data;
-
-	if (!(dial_data = ast_calloc(1, sizeof(*dial_data)))) {
-		return -1;
-	}
-
-	if (!ast_strlen_zero(endpoint)) {
-		ast_copy_string(dial_data->endpoint, endpoint, sizeof(dial_data->endpoint));
-	} else if (!ast_strlen_zero(exten) && !ast_strlen_zero(context)) {
-		snprintf(dial_data->endpoint, sizeof(dial_data->endpoint), "Local/%s@%s", exten, context);
-	} else {
-		return -1;
-	}
-
-	if (timeout > 0) {
-		dial_data->timeout = timeout * 1000;
-	} else if (timeout == -1) {
-		dial_data->timeout = -1;
-	} else {
-		dial_data->timeout = 30000;
-	}
-
-	stasis_app_send_command_async(control, app_control_dial, dial_data, ast_free_ptr);
-
-	return 0;
-}
-
 int stasis_app_control_add_role(struct stasis_app_control *control, const char *role)
 {
 	return ast_channel_add_bridge_role(control->channel, role);

Modified: team/file/ari-dial-immediate/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/file/ari-dial-immediate/rest-api/api-docs/channels.json?view=diff&rev=422400&r1=422399&r2=422400
==============================================================================
--- team/file/ari-dial-immediate/rest-api/api-docs/channels.json (original)
+++ team/file/ari-dial-immediate/rest-api/api-docs/channels.json Fri Aug 29 15:22:33 2014
@@ -112,6 +112,15 @@
 							"required": false,
 							"allowMultiple": false,
 							"dataType": "string"
+						},
+						{
+							"name": "immediate",
+							"description": "Whether to send the originated channel directly to the extension or application without the remote end having answered.",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "boolean",
+							"defaultValue": false
 						}
 					],
 					"errorResponses": [
@@ -244,6 +253,15 @@
 							"required": false,
 							"allowMultiple": false,
 							"dataType": "string"
+						},
+						{
+							"name": "immediate",
+							"description": "Whether to send the originated channel directly to the extension or application without the remote end having answered.",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "boolean",
+							"defaultValue": false
 						}
 					],
 					"errorResponses": [




More information about the svn-commits mailing list