mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
add ActionID output and lock CLI fd for Manager action DBGet (bug #4727)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6175 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
db.c
13
db.c
@@ -529,6 +529,8 @@ static int manager_dbput(struct mansession *s, struct message *m)
|
||||
|
||||
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 @@ static int manager_dbget(struct mansession *s, struct message *m)
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user