[Asterisk-cvs] asterisk db.c,1.20,1.21

kpfleming at lists.digium.com kpfleming at lists.digium.com
Tue Jul 19 20:30:59 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv20016

Modified Files:
	db.c 
Log Message:
add ActionID output and lock CLI fd for Manager action DBGet (bug #4727)


Index: db.c
===================================================================
RCS file: /usr/cvsroot/asterisk/db.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- db.c	20 Jul 2005 00:09:39 -0000	1.20
+++ db.c	20 Jul 2005 00:38:20 -0000	1.21
@@ -529,6 +529,8 @@
 
 static int manager_dbget(struct mansession *s, struct message *m)
 {
+	char *id = astman_get_header(m,"ActionID");
+	char idText[256] = "";
 	char *family = astman_get_header(m, "Family");
 	char *key = astman_get_header(m, "Key");
 	char tmp[256];
@@ -543,16 +545,23 @@
 		return 0;
 	}
 
+	if (id && !ast_strlen_zero(id))
+		snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
+
 	res = ast_db_get(family, key, tmp, sizeof(tmp));
 	if (res) {
 		astman_send_error(s, m, "Database entry not found");
 	} else {
 		astman_send_ack(s, m, "Result will follow");
+		ast_mutex_lock(&s->lock);
 		ast_cli(s->fd, "Event: DBGetResponse\r\n"
 				"Family: %s\r\n"
 				"Key: %s\r\n"
-				"Val: %s\r\n\r\n",
-				family, key, tmp);
+				"Val: %s\r\n"
+				"%s"
+				"\r\n",
+				family, key, tmp, idText);
+		ast_mutex_unlock(&s->lock);
 	}
 	return 0;
 }




More information about the svn-commits mailing list