[asterisk-commits] qwell: branch qwell/ari_channel_variables r393491 - in /team/qwell/ari_channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 2 16:09:26 CDT 2013


Author: qwell
Date: Tue Jul  2 16:09:24 2013
New Revision: 393491

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393491
Log:
Switch to using ast_str_retrieve_variable, because builtin variables apparently need to be gotten differently.

Modified:
    team/qwell/ari_channel_variables/res/stasis/control.c
    team/qwell/ari_channel_variables/res/stasis_http/resource_asterisk.c

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=393491&r1=393490&r2=393491
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis/control.c (original)
+++ team/qwell/ari_channel_variables/res/stasis/control.c Tue Jul  2 16:09:24 2013
@@ -210,24 +210,24 @@
 char *stasis_app_control_get_channel_var(struct stasis_app_control *control, const char *variable)
 {
 	SCOPED_CHANNELLOCK(lockvar, control->channel);
-	char *value = NULL;
+
+	RAII_VAR(struct ast_str *, tmp, ast_str_create(32), ast_free);
+
+	if (!tmp) {
+		return NULL;
+	}
 
 	if (variable[strlen(variable) - 1] == ')') {
-		RAII_VAR(struct ast_str *, tmp, ast_str_create(32), ast_free);
-
-		if (!tmp) {
-			return NULL;
-		}
-
 		if (ast_func_read2(control->channel, variable, &tmp, 0)) {
 			return NULL;
 		}
-		value = ast_strdup(ast_str_buffer(tmp));
 	} else {
-		value = ast_strdup(pbx_builtin_getvar_helper(control->channel, variable));
-	}
-
-	return value;
+		if (!ast_str_retrieve_variable(&tmp, 0, control->channel, NULL, variable)) {
+			return NULL;
+		}
+	}
+
+	return ast_strdup(ast_str_buffer(tmp));
 }
 
 int stasis_app_control_set_channel_var(struct stasis_app_control *control, const char *variable, const char *value)

Modified: team/qwell/ari_channel_variables/res/stasis_http/resource_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_variables/res/stasis_http/resource_asterisk.c?view=diff&rev=393491&r1=393490&r2=393491
==============================================================================
--- team/qwell/ari_channel_variables/res/stasis_http/resource_asterisk.c (original)
+++ team/qwell/ari_channel_variables/res/stasis_http/resource_asterisk.c Tue Jul  2 16:09:24 2013
@@ -42,11 +42,18 @@
 void stasis_http_get_global_var(struct ast_variable *headers, struct ast_get_global_var_args *args, struct stasis_http_response *response)
 {
 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+	RAII_VAR(struct ast_str *, tmp, ast_str_create(32), ast_free);
+
 	const char *value;
 
 	ast_assert(response != NULL);
 
-	value = pbx_builtin_getvar_helper(NULL, args->variable);
+	if (!tmp) {
+		stasis_http_response_alloc_failed(response);
+		return;
+	}
+
+	value = ast_str_retrieve_variable(&tmp, 0, NULL, NULL, args->variable);
 
 	if (!(json = ast_json_pack("{s: s}", "value", S_OR(value, "")))) {
 		stasis_http_response_alloc_failed(response);




More information about the asterisk-commits mailing list