mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 03:08:45 +00:00
Add the MeetmeList and Reload manager commands, which supplement the need to have Command privilege. (closes issue #10736)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3099,6 +3099,81 @@ static int action_meetmeunmute(struct mansession *s, const struct message *m)
|
|||||||
return meetmemute(s, m, 0);
|
return meetmemute(s, m, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char mandescr_meetmelist[] =
|
||||||
|
"Description: Lists all users in a particular MeetMe conference.\n"
|
||||||
|
"MeetmeList will follow as separate events, followed by a final event called\n"
|
||||||
|
"MeetmeListComplete.\n"
|
||||||
|
"Variables:\n"
|
||||||
|
" *ActionId: <id>\n"
|
||||||
|
" *Conference: <confno>\n";
|
||||||
|
|
||||||
|
static int action_meetmelist(struct mansession *s, const struct message *m)
|
||||||
|
{
|
||||||
|
const char *actionid = astman_get_header(m, "ActionID");
|
||||||
|
const char *conference = astman_get_header(m, "Conference");
|
||||||
|
char idText[80] = "";
|
||||||
|
struct ast_conference *cnf;
|
||||||
|
struct ast_conf_user *user;
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(actionid))
|
||||||
|
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
|
||||||
|
|
||||||
|
if (AST_LIST_EMPTY(&confs)) {
|
||||||
|
astman_send_error(s, m, "No active conferences.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
astman_send_listack(s, m, "Meetme user list will follow", "start");
|
||||||
|
|
||||||
|
/* Find the right conference */
|
||||||
|
AST_LIST_LOCK(&confs);
|
||||||
|
AST_LIST_TRAVERSE(&confs, cnf, list) {
|
||||||
|
/* If we ask for one particular, and this isn't it, skip it */
|
||||||
|
if (!ast_strlen_zero(conference) && strcmp(cnf->confno, conference))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Show all the users */
|
||||||
|
AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
|
||||||
|
total++;
|
||||||
|
astman_append(s,
|
||||||
|
"Event: MeetmeList\r\n"
|
||||||
|
"%s"
|
||||||
|
"Conference: %s\r\n"
|
||||||
|
"UserNumber: %d\r\n"
|
||||||
|
"CallerIDNum: %s\r\n"
|
||||||
|
"CallerIDName: %s\r\n"
|
||||||
|
"Channel: %s\r\n"
|
||||||
|
"Admin: %s\r\n"
|
||||||
|
"Role: %s\r\n"
|
||||||
|
"MarkedUser: %s\r\n"
|
||||||
|
"Muted: %s\r\n"
|
||||||
|
"Talking: %s\r\n"
|
||||||
|
"\r\n",
|
||||||
|
idText,
|
||||||
|
cnf->confno,
|
||||||
|
user->user_no,
|
||||||
|
S_OR(user->chan->cid.cid_num, "<unknown>"),
|
||||||
|
S_OR(user->chan->cid.cid_name, "<no name>"),
|
||||||
|
user->chan->name,
|
||||||
|
user->userflags & CONFFLAG_ADMIN ? "Yes" : "No",
|
||||||
|
user->userflags & CONFFLAG_MONITOR ? "Listen only" : user->userflags & CONFFLAG_TALKER ? "Talk only" : "Talk and listen",
|
||||||
|
user->userflags & CONFFLAG_MARKEDUSER ? "Yes" : "No",
|
||||||
|
user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No",
|
||||||
|
user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
|
/* Send final confirmation */
|
||||||
|
astman_append(s,
|
||||||
|
"Event: MeetmeListComplete\r\n"
|
||||||
|
"EventList: Complete\r\n"
|
||||||
|
"ListItems: %d\r\n"
|
||||||
|
"%s"
|
||||||
|
"\r\n", total, idText);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void *recordthread(void *args)
|
static void *recordthread(void *args)
|
||||||
{
|
{
|
||||||
struct ast_conference *cnf = args;
|
struct ast_conference *cnf = args;
|
||||||
@@ -4976,6 +5051,7 @@ static int unload_module(void)
|
|||||||
ast_cli_unregister_multiple(cli_meetme, ARRAY_LEN(cli_meetme));
|
ast_cli_unregister_multiple(cli_meetme, ARRAY_LEN(cli_meetme));
|
||||||
res = ast_manager_unregister("MeetmeMute");
|
res = ast_manager_unregister("MeetmeMute");
|
||||||
res |= ast_manager_unregister("MeetmeUnmute");
|
res |= ast_manager_unregister("MeetmeUnmute");
|
||||||
|
res |= ast_manager_unregister("MeetmeList");
|
||||||
res |= ast_unregister_application(app4);
|
res |= ast_unregister_application(app4);
|
||||||
res |= ast_unregister_application(app3);
|
res |= ast_unregister_application(app3);
|
||||||
res |= ast_unregister_application(app2);
|
res |= ast_unregister_application(app2);
|
||||||
@@ -5002,6 +5078,8 @@ static int load_module(void)
|
|||||||
action_meetmemute, "Mute a Meetme user");
|
action_meetmemute, "Mute a Meetme user");
|
||||||
res |= ast_manager_register("MeetmeUnmute", EVENT_FLAG_CALL,
|
res |= ast_manager_register("MeetmeUnmute", EVENT_FLAG_CALL,
|
||||||
action_meetmeunmute, "Unmute a Meetme user");
|
action_meetmeunmute, "Unmute a Meetme user");
|
||||||
|
res |= ast_manager_register2("MeetmeList", EVENT_FLAG_REPORTING,
|
||||||
|
action_meetmelist, "List participants in a conference", mandescr_meetmelist);
|
||||||
res |= ast_register_application(app4, channel_admin_exec, synopsis4, descrip4);
|
res |= ast_register_application(app4, channel_admin_exec, synopsis4, descrip4);
|
||||||
res |= ast_register_application(app3, admin_exec, synopsis3, descrip3);
|
res |= ast_register_application(app3, admin_exec, synopsis3, descrip3);
|
||||||
res |= ast_register_application(app2, count_exec, synopsis2, descrip2);
|
res |= ast_register_application(app2, count_exec, synopsis2, descrip2);
|
||||||
|
@@ -2337,6 +2337,28 @@ static int action_corestatus(struct mansession *s, const struct message *m)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char mandescr_reload[] =
|
||||||
|
"Description: Send a reload event.\n"
|
||||||
|
"Variables: (Names marked with * are optional)\n"
|
||||||
|
" *ActionID: ActionID of this transaction\n"
|
||||||
|
" *Module: Name of the module to reload\n";
|
||||||
|
|
||||||
|
/*! \brief Send a reload event */
|
||||||
|
static int action_reload(struct mansession *s, const struct message *m)
|
||||||
|
{
|
||||||
|
const char *actionid = astman_get_header(m, "ActionID");
|
||||||
|
const char *module = astman_get_header(m, "Module");
|
||||||
|
int res = ast_module_reload(S_OR(module, NULL));
|
||||||
|
char idText[80] = "";
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(actionid))
|
||||||
|
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid);
|
||||||
|
if (res == 2)
|
||||||
|
astman_append(s, "Response: Success\r\n%s", idText);
|
||||||
|
else
|
||||||
|
astman_send_error(s, m, s == 0 ? "No such module" : "Module does not support reload");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Done with the action handlers here, we start with the code in charge
|
* Done with the action handlers here, we start with the code in charge
|
||||||
@@ -3307,6 +3329,7 @@ static int __init_manager(int reload)
|
|||||||
ast_manager_register2("WaitEvent", 0, action_waitevent, "Wait for an event to occur", mandescr_waitevent);
|
ast_manager_register2("WaitEvent", 0, action_waitevent, "Wait for an event to occur", mandescr_waitevent);
|
||||||
ast_manager_register2("CoreSettings", EVENT_FLAG_SYSTEM, action_coresettings, "Show PBX core settings (version etc)", mandescr_coresettings);
|
ast_manager_register2("CoreSettings", EVENT_FLAG_SYSTEM, action_coresettings, "Show PBX core settings (version etc)", mandescr_coresettings);
|
||||||
ast_manager_register2("CoreStatus", EVENT_FLAG_SYSTEM, action_corestatus, "Show PBX core status variables", mandescr_corestatus);
|
ast_manager_register2("CoreStatus", EVENT_FLAG_SYSTEM, action_corestatus, "Show PBX core status variables", mandescr_corestatus);
|
||||||
|
ast_manager_register2("Reload", EVENT_FLAG_CONFIG, action_reload, "Send a reload event", mandescr_reload);
|
||||||
|
|
||||||
ast_cli_register_multiple(cli_manager, sizeof(cli_manager) / sizeof(struct ast_cli_entry));
|
ast_cli_register_multiple(cli_manager, sizeof(cli_manager) / sizeof(struct ast_cli_entry));
|
||||||
ast_extension_state_add(NULL, NULL, manager_state_cb, NULL);
|
ast_extension_state_add(NULL, NULL, manager_state_cb, NULL);
|
||||||
|
Reference in New Issue
Block a user