[asterisk-commits] qwell: branch qwell/ari_channel_variables r392851 - in /team/qwell/ari_channe...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 25 09:46:20 CDT 2013
Author: qwell
Date: Tue Jun 25 09:46:18 2013
New Revision: 392851
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392851
Log:
Address review feedback.
Modified:
team/qwell/ari_channel_variables/include/asterisk/stasis_app.h
team/qwell/ari_channel_variables/res/stasis/control.c
team/qwell/ari_channel_variables/res/stasis_http/resource_channels.h
team/qwell/ari_channel_variables/rest-api/api-docs/channels.json
Modified: team/qwell/ari_channel_variables/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/include/asterisk/stasis_app.h?view=diff&rev=392851&r1=392850&r2=392851
==============================================================================
--- team/qwell/ari_channel_variables/include/asterisk/stasis_app.h (original)
+++ team/qwell/ari_channel_variables/include/asterisk/stasis_app.h Tue Jun 25 09:46:18 2013
@@ -156,8 +156,8 @@
/*!
* \brief Get the value of a variable on the channel associated with this control.
* \param control Control for \c res_stasis.
- * \param variable The name of the variable
- * \return The value of the variable.
+ * \param variable The name of the variable.
+ * \return The value of the variable. The returned variable must be freed.
*/
char *stasis_app_control_get_channel_var(struct stasis_app_control *control, const char *variable);
Modified: team/qwell/ari_channel_variables/res/stasis/control.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/res/stasis/control.c?view=diff&rev=392851&r1=392850&r2=392851
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis/control.c (original)
+++ team/qwell/ari_channel_variables/res/stasis/control.c Tue Jun 25 09:46:18 2013
@@ -107,24 +107,35 @@
char *stasis_app_control_get_channel_var(struct stasis_app_control *control, const char *variable)
{
- const char *value;
+ char *value;
+
+ ast_channel_lock(control->channel);
if (variable[strlen(variable) - 1] == ')') {
char workspace[1024];
ast_func_read(control->channel, (char *)variable, workspace, sizeof(workspace));
- value = workspace;
+ value = ast_strdup(workspace);
} else {
- value = pbx_builtin_getvar_helper(control->channel, variable);
- }
-
- return ast_strdup(value);
+ value = ast_strdup(pbx_builtin_getvar_helper(control->channel, variable));
+ }
+
+ ast_channel_unlock(control->channel);
+
+ return value;
}
int stasis_app_control_set_channel_var(struct stasis_app_control *control, const char *variable, const char *value)
{
- return pbx_builtin_setvar_helper(control->channel, variable, value);
+ int ret;
+ ast_channel_lock(control->channel);
+
+ ret = pbx_builtin_setvar_helper(control->channel, variable, value);
+
+ ast_channel_unlock(control->channel);
+
+ return ret;
}
struct ast_channel_snapshot *stasis_app_control_get_snapshot(
Modified: team/qwell/ari_channel_variables/res/stasis_http/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/res/stasis_http/resource_channels.h?view=diff&rev=392851&r1=392850&r2=392851
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis_http/resource_channels.h (original)
+++ team/qwell/ari_channel_variables/res/stasis_http/resource_channels.h Tue Jun 25 09:46:18 2013
@@ -258,11 +258,11 @@
struct ast_get_channel_var_args {
/*! \brief Channel's id */
const char *channel_id;
- /*! \brief The variable to get */
+ /*! \brief The channel variable or function to get */
const char *variable;
};
/*!
- * \brief Get the value of a channel variable.
+ * \brief Get the value of a channel variable or function.
*
* \param headers HTTP headers
* \param args Swagger parameters
@@ -273,13 +273,13 @@
struct ast_set_channel_var_args {
/*! \brief Channel's id */
const char *channel_id;
- /*! \brief The variable to set */
+ /*! \brief The channel variable or function to set */
const char *variable;
/*! \brief The value to set the variable to */
const char *value;
};
/*!
- * \brief Set the value of a channel variable.
+ * \brief Set the value of a channel variable or function.
*
* \param headers HTTP headers
* \param args Swagger parameters
Modified: team/qwell/ari_channel_variables/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/rest-api/api-docs/channels.json?view=diff&rev=392851&r1=392850&r2=392851
==============================================================================
--- team/qwell/ari_channel_variables/rest-api/api-docs/channels.json (original)
+++ team/qwell/ari_channel_variables/rest-api/api-docs/channels.json Tue Jun 25 09:46:18 2013
@@ -591,7 +591,7 @@
"operations": [
{
"httpMethod": "GET",
- "summary": "Get the value of a channel variable.",
+ "summary": "Get the value of a channel variable or function.",
"nickname": "getChannelVar",
"responseClass": "ChannelVariable",
"parameters": [
@@ -605,7 +605,7 @@
},
{
"name": "variable",
- "description": "The variable to get",
+ "description": "The channel variable or function to get",
"paramType": "query",
"required": true,
"allowMultiple": false,
@@ -625,7 +625,7 @@
},
{
"httpMethod": "POST",
- "summary": "Set the value of a channel variable.",
+ "summary": "Set the value of a channel variable or function.",
"nickname": "setChannelVar",
"responseClass": "void",
"parameters": [
@@ -639,7 +639,7 @@
},
{
"name": "variable",
- "description": "The variable to set",
+ "description": "The channel variable or function to set",
"paramType": "query",
"required": true,
"allowMultiple": false,
More information about the asterisk-commits
mailing list