[asterisk-commits] trunk - r7658 /trunk/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 27 13:13:14 CST 2005


Author: tilghman
Date: Tue Dec 27 13:13:13 2005
New Revision: 7658

URL: http://svn.digium.com/view/asterisk?rev=7658&view=rev
Log:
Bug 4880 - add priority label matching and dialplan function retrieval

Modified:
    trunk/manager.c

Modified: trunk/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/manager.c?rev=7658&r1=7657&r2=7658&view=diff
==============================================================================
--- trunk/manager.c (original)
+++ trunk/manager.c Tue Dec 27 13:13:13 2005
@@ -722,35 +722,32 @@
 
 static int action_getvar(struct mansession *s, struct message *m)
 {
-        struct ast_channel *c = NULL;
-        char *name = astman_get_header(m, "Channel");
-        char *varname = astman_get_header(m, "Variable");
+	struct ast_channel *c = NULL;
+	char *name = astman_get_header(m, "Channel");
+	char *varname = astman_get_header(m, "Variable");
 	char *id = astman_get_header(m,"ActionID");
-	const char *varval;
-	char *varval2=NULL;
-
-	if (!strlen(varname)) {
+	char *varval;
+	char workspace[1024];
+
+	if (ast_strlen_zero(varname)) {
 		astman_send_error(s, m, "No variable specified");
 		return 0;
 	}
 
-	if (strlen(name)) {
+	if (!ast_strlen_zero(name)) {
 		c = ast_get_channel_by_name_locked(name);
 		if (!c) {
 			astman_send_error(s, m, "No such channel");
 			return 0;
 		}
 	}
-	
-	varval=pbx_builtin_getvar_helper(c,varname);
-	if (varval)
-		varval2 = ast_strdupa(varval);
-	if (!varval2)
-		varval2 = "";
+
+	pbx_retrieve_variable(c, varname, &varval, workspace, sizeof(workspace), NULL);
+
 	if (c)
 		ast_mutex_unlock(&c->lock);
 	ast_cli(s->fd, "Response: Success\r\n"
-		"Variable: %s\r\nValue: %s\r\n" ,varname,varval2);
+		"Variable: %s\r\nValue: %s\r\n", varname, varval);
 	if (!ast_strlen_zero(id))
 		ast_cli(s->fd, "ActionID: %s\r\n",id);
 	ast_cli(s->fd, "\r\n");
@@ -874,8 +871,10 @@
 		return 0;
 	}
 	if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
-		astman_send_error(s, m, "Invalid priority\n");
-		return 0;
+		if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
+			astman_send_error(s, m, "Invalid priority\n");
+			return 0;
+		}
 	}
 	chan = ast_get_channel_by_name_locked(name);
 	if (!chan) {
@@ -1020,8 +1019,10 @@
 		return 0;
 	}
 	if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
-		astman_send_error(s, m, "Invalid priority\n");
-		return 0;
+		if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
+			astman_send_error(s, m, "Invalid priority\n");
+			return 0;
+		}
 	}
 	if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) {
 		astman_send_error(s, m, "Invalid timeout\n");



More information about the asterisk-commits mailing list