[asterisk-commits] tilghman: trunk r83532 - in /trunk: apps/app_meetme.c main/manager.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Sep 22 09:03:49 CDT 2007
Author: tilghman
Date: Sat Sep 22 09:03:48 2007
New Revision: 83532
URL: http://svn.digium.com/view/asterisk?view=rev&rev=83532
Log:
Add the MeetmeList and Reload manager commands, which supplement the need to have Command privilege. (closes issue #10736)
Modified:
trunk/apps/app_meetme.c
trunk/main/manager.c
Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=83532&r1=83531&r2=83532
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Sat Sep 22 09:03:48 2007
@@ -3099,6 +3099,81 @@
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)
{
struct ast_conference *cnf = args;
@@ -4976,6 +5051,7 @@
ast_cli_unregister_multiple(cli_meetme, ARRAY_LEN(cli_meetme));
res = ast_manager_unregister("MeetmeMute");
res |= ast_manager_unregister("MeetmeUnmute");
+ res |= ast_manager_unregister("MeetmeList");
res |= ast_unregister_application(app4);
res |= ast_unregister_application(app3);
res |= ast_unregister_application(app2);
@@ -5002,6 +5078,8 @@
action_meetmemute, "Mute a Meetme user");
res |= ast_manager_register("MeetmeUnmute", EVENT_FLAG_CALL,
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(app3, admin_exec, synopsis3, descrip3);
res |= ast_register_application(app2, count_exec, synopsis2, descrip2);
Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=83532&r1=83531&r2=83532
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Sat Sep 22 09:03:48 2007
@@ -2337,6 +2337,28 @@
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
@@ -3307,6 +3329,7 @@
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("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_extension_state_add(NULL, NULL, manager_state_cb, NULL);
More information about the asterisk-commits
mailing list