[asterisk-commits] qwell: branch qwell/ari_continue_location r392863 - in /team/qwell/ari_contin...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 25 14:02:25 CDT 2013
Author: qwell
Date: Tue Jun 25 14:02:23 2013
New Revision: 392863
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392863
Log:
Allow setting a context, extension, and/or priority when continuing in dialplan.
Modified:
team/qwell/ari_continue_location/include/asterisk/stasis_app.h
team/qwell/ari_continue_location/res/res_stasis_http_channels.c
team/qwell/ari_continue_location/res/stasis/control.c
team/qwell/ari_continue_location/res/stasis_http/resource_channels.c
team/qwell/ari_continue_location/res/stasis_http/resource_channels.h
team/qwell/ari_continue_location/rest-api/api-docs/channels.json
Modified: team/qwell/ari_continue_location/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/include/asterisk/stasis_app.h?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/include/asterisk/stasis_app.h (original)
+++ team/qwell/ari_continue_location/include/asterisk/stasis_app.h Tue Jun 25 14:02:23 2013
@@ -142,8 +142,11 @@
* If the channel is no longer in \c res_stasis, this function does nothing.
*
* \param control Control for \c res_stasis
- */
-void stasis_app_control_continue(struct stasis_app_control *control);
+ *
+ * \return 0 for success
+ * \return -1 for error.
+ */
+int stasis_app_control_continue(struct stasis_app_control *control, const char *context, const char *extension, int priority);
/*!
* \brief Answer the channel associated with this control.
Modified: team/qwell/ari_continue_location/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/res/res_stasis_http_channels.c?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/res/res_stasis_http_channels.c (original)
+++ team/qwell/ari_continue_location/res/res_stasis_http_channels.c Tue Jun 25 14:02:23 2013
@@ -191,6 +191,18 @@
struct ast_continue_in_dialplan_args args = {};
struct ast_variable *i;
+ for (i = get_params; i; i = i->next) {
+ if (strcmp(i->name, "context") == 0) {
+ args.context = (i->value);
+ } else
+ if (strcmp(i->name, "extension") == 0) {
+ args.extension = (i->value);
+ } else
+ if (strcmp(i->name, "priority") == 0) {
+ args.priority = atoi(i->value);
+ } else
+ {}
+ }
for (i = path_vars; i; i = i->next) {
if (strcmp(i->name, "channelId") == 0) {
args.channel_id = (i->value);
Modified: team/qwell/ari_continue_location/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/res/stasis/control.c?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/res/stasis/control.c (original)
+++ team/qwell/ari_continue_location/res/stasis/control.c Tue Jun 25 14:02:23 2013
@@ -33,6 +33,7 @@
#include "control.h"
#include "asterisk/bridging.h"
#include "asterisk/bridging_features.h"
+#include "asterisk/pbx.h"
struct stasis_app_control {
/*! Queue of commands to dispatch on the channel */
@@ -91,17 +92,39 @@
return control->is_done;
}
+struct stasis_app_control_continue_data {
+ char context[AST_MAX_CONTEXT];
+ char extension[AST_MAX_EXTENSION];
+ int priority;
+};
+
static void *app_control_continue(struct stasis_app_control *control,
struct ast_channel *chan, void *data)
{
+ RAII_VAR(struct stasis_app_control_continue_data *, continue_data, data, ast_free);
+
/* Called from stasis_app_exec thread; no lock needed */
+ ast_explicit_goto(control->channel, continue_data->context, continue_data->extension, continue_data->priority);
+
control->is_done = 1;
+
return NULL;
}
-void stasis_app_control_continue(struct stasis_app_control *control)
-{
- stasis_app_send_command_async(control, app_control_continue, NULL);
+int stasis_app_control_continue(struct stasis_app_control *control, const char *context, const char *extension, int priority)
+{
+ struct stasis_app_control_continue_data *continue_data;
+
+ if (!(continue_data = ast_calloc(1, sizeof(*continue_data)))) {
+ return -1;
+ }
+ ast_copy_string(continue_data->context, S_OR(context, ""), sizeof(continue_data->context));
+ ast_copy_string(continue_data->extension, S_OR(extension, ""), sizeof(continue_data->extension));
+ continue_data->priority = priority;
+
+ stasis_app_send_command_async(control, app_control_continue, continue_data);
+
+ return 0;
}
struct ast_channel_snapshot *stasis_app_control_get_snapshot(
Modified: team/qwell/ari_continue_location/res/stasis_http/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/res/stasis_http/resource_channels.c?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/res/stasis_http/resource_channels.c (original)
+++ team/qwell/ari_continue_location/res/stasis_http/resource_channels.c Tue Jun 25 14:02:23 2013
@@ -97,7 +97,11 @@
return;
}
- stasis_app_control_continue(control);
+ if (stasis_app_control_continue(control, args->context, args->extension, args->priority)) {
+ stasis_http_response_alloc_failed(response);
+ return;
+ }
+
stasis_http_response_no_content(response);
}
Modified: team/qwell/ari_continue_location/res/stasis_http/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/res/stasis_http/resource_channels.h?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/res/stasis_http/resource_channels.h (original)
+++ team/qwell/ari_continue_location/res/stasis_http/resource_channels.h Tue Jun 25 14:02:23 2013
@@ -124,6 +124,12 @@
struct ast_continue_in_dialplan_args {
/*! \brief Channel's id */
const char *channel_id;
+ /*! \brief The context to continue to. */
+ const char *context;
+ /*! \brief The extension to continue to. */
+ const char *extension;
+ /*! \brief The priority to continue to. */
+ int priority;
};
/*!
* \brief Exit application; continue execution in the dialplan.
Modified: team/qwell/ari_continue_location/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_continue_location/rest-api/api-docs/channels.json?view=diff&rev=392863&r1=392862&r2=392863
==============================================================================
--- team/qwell/ari_continue_location/rest-api/api-docs/channels.json (original)
+++ team/qwell/ari_continue_location/rest-api/api-docs/channels.json Tue Jun 25 14:02:23 2013
@@ -207,6 +207,30 @@
"required": true,
"allowMultiple": false,
"dataType": "string"
+ },
+ {
+ "name": "context",
+ "description": "The context to continue to.",
+ "paramType": "query",
+ "required": false,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "extension",
+ "description": "The extension to continue to.",
+ "paramType": "query",
+ "required": false,
+ "allowMultiple": false,
+ "dataType": "string"
+ },
+ {
+ "name": "priority",
+ "description": "The priority to continue to.",
+ "paramType": "query",
+ "required": false,
+ "allowMultiple": false,
+ "dataType": "int"
}
],
"errorResponses": [
More information about the asterisk-commits
mailing list