mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 06:48:25 +00:00
Bug 4880 - add priority label matching and dialplan function retrieval
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
21
manager.c
21
manager.c
@@ -726,15 +726,15 @@ static int action_getvar(struct mansession *s, struct message *m)
|
|||||||
char *name = astman_get_header(m, "Channel");
|
char *name = astman_get_header(m, "Channel");
|
||||||
char *varname = astman_get_header(m, "Variable");
|
char *varname = astman_get_header(m, "Variable");
|
||||||
char *id = astman_get_header(m,"ActionID");
|
char *id = astman_get_header(m,"ActionID");
|
||||||
const char *varval;
|
char *varval;
|
||||||
char *varval2=NULL;
|
char workspace[1024];
|
||||||
|
|
||||||
if (!strlen(varname)) {
|
if (ast_strlen_zero(varname)) {
|
||||||
astman_send_error(s, m, "No variable specified");
|
astman_send_error(s, m, "No variable specified");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(name)) {
|
if (!ast_strlen_zero(name)) {
|
||||||
c = ast_get_channel_by_name_locked(name);
|
c = ast_get_channel_by_name_locked(name);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
astman_send_error(s, m, "No such channel");
|
astman_send_error(s, m, "No such channel");
|
||||||
@@ -742,15 +742,12 @@ static int action_getvar(struct mansession *s, struct message *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
varval=pbx_builtin_getvar_helper(c,varname);
|
pbx_retrieve_variable(c, varname, &varval, workspace, sizeof(workspace), NULL);
|
||||||
if (varval)
|
|
||||||
varval2 = ast_strdupa(varval);
|
|
||||||
if (!varval2)
|
|
||||||
varval2 = "";
|
|
||||||
if (c)
|
if (c)
|
||||||
ast_mutex_unlock(&c->lock);
|
ast_mutex_unlock(&c->lock);
|
||||||
ast_cli(s->fd, "Response: Success\r\n"
|
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))
|
if (!ast_strlen_zero(id))
|
||||||
ast_cli(s->fd, "ActionID: %s\r\n",id);
|
ast_cli(s->fd, "ActionID: %s\r\n",id);
|
||||||
ast_cli(s->fd, "\r\n");
|
ast_cli(s->fd, "\r\n");
|
||||||
@@ -874,9 +871,11 @@ static int action_redirect(struct mansession *s, struct message *m)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
|
if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
|
||||||
|
if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
|
||||||
astman_send_error(s, m, "Invalid priority\n");
|
astman_send_error(s, m, "Invalid priority\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
chan = ast_get_channel_by_name_locked(name);
|
chan = ast_get_channel_by_name_locked(name);
|
||||||
if (!chan) {
|
if (!chan) {
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
@@ -1020,9 +1019,11 @@ static int action_originate(struct mansession *s, struct message *m)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
|
if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) {
|
||||||
|
if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
|
||||||
astman_send_error(s, m, "Invalid priority\n");
|
astman_send_error(s, m, "Invalid priority\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) {
|
if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) {
|
||||||
astman_send_error(s, m, "Invalid timeout\n");
|
astman_send_error(s, m, "Invalid timeout\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user