No subject


Mon Jan 10 01:51:56 CST 2011


I've added a new manager action to list only the active conferences on an
Asterisk system. It shows the same data displayed when you run a 'meetme list'
on the Asterisk CLI.

(closes issue #17905)
Reported by: rcasas
Patches: 
      app_meetme.c.patch uploaded by rcasas (license 641)

Review: https://reviewboard.asterisk.org/r/874/


Modified:
    trunk/CHANGES
    trunk/apps/app_meetme.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=307359&r1=307358&r2=307359
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Feb  9 16:48:02 2011
@@ -21,6 +21,8 @@
  * PeerStatus now includes Address and Port.
  * Added Hold events for when the remote party puts the call on and off hold
    for chan_dahdi ISDN channels.
+ * Added new action MeetmeListRooms to list active conferences (shows same
+   data as "meetme list" at the CLI).
 
 Asterisk HTTP Server
 --------------------------

Modified: trunk/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_meetme.c?view=diff&rev=307359&r1=307358&r2=307359
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Wed Feb  9 16:48:02 2011
@@ -509,6 +509,19 @@
 			MeetmeListComplete.</para>
 		</description>
 	</manager>
+	<manager name="MeetmeListRooms" language="en_US">
+		<synopsis>
+			List active conferences.
+		</synopsis>
+		<syntax>
+			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
+		</syntax>
+		<description>
+			<para>Lists data about all active conferences.
+				MeetmeListRooms will follow as separate events, followed by a final event called
+				MeetmeListRoomsComplete.</para>
+		</description>
+	</manager>
  ***/
 
 #define CONFIG_FILE_NAME "meetme.conf"
@@ -4891,6 +4904,73 @@
 	return 0;
 }
 
+static int action_meetmelistrooms(struct mansession *s, const struct message *m)
+{
+	const char *actionid = astman_get_header(m, "ActionID");
+	char idText[80] = "";
+	struct ast_conference *cnf;
+	int totalitems = 0;
+	int hr, min, sec;
+	time_t now;
+	char markedusers[5];
+
+	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 conferences will follow", "start");
+
+	now = time(NULL);
+
+	/* Traverse the conference list */
+	AST_LIST_LOCK(&confs);
+	AST_LIST_TRAVERSE(&confs, cnf, list) {
+		totalitems++;
+
+		if (cnf->markedusers == 0) {
+			strcpy(markedusers, "N/A");
+		} else {
+			sprintf(markedusers, "%.4d", cnf->markedusers);
+		}
+		hr = (now - cnf->start) / 3600;
+		min = ((now - cnf->start) % 3600) / 60;
+		sec = (now - cnf->start) % 60;
+
+		astman_append(s,
+		"Event: MeetmeListRooms\r\n"
+		"%s"
+		"Conference: %s\r\n"
+		"Parties: %d\r\n"
+		"Marked: %s\r\n"
+		"Activity: %2.2d:%2.2d:%2.2d\r\n"
+		"Creation: %s\r\n"
+		"Locked: %s\r\n"
+		"\r\n",
+		idText,
+		cnf->confno,
+		cnf->users,
+		markedusers,
+		hr,  min, sec,
+		cnf->isdynamic ? "Dynamic" : "Static",
+		cnf->locked ? "Yes" : "No"); 
+	}
+	AST_LIST_UNLOCK(&confs);
+
+	/* Send final confirmation */
+	astman_append(s,
+	"Event: MeetmeListRoomsComplete\r\n"
+	"EventList: Complete\r\n"
+	"ListItems: %d\r\n"
+	"%s"
+	"\r\n", totalitems, idText);
+	return 0;
+}
+
 static void *recordthread(void *args)
 {
 	struct ast_conference *cnf = args;
@@ -7152,6 +7232,7 @@
 	res = ast_manager_unregister("MeetmeMute");
 	res |= ast_manager_unregister("MeetmeUnmute");
 	res |= ast_manager_unregister("MeetmeList");
+	res |= ast_manager_unregister("MeetmeListRooms");
 	res |= ast_unregister_application(app4);
 	res |= ast_unregister_application(app3);
 	res |= ast_unregister_application(app2);
@@ -7187,6 +7268,7 @@
 	res |= ast_manager_register_xml("MeetmeMute", EVENT_FLAG_CALL, action_meetmemute);
 	res |= ast_manager_register_xml("MeetmeUnmute", EVENT_FLAG_CALL, action_meetmeunmute);
 	res |= ast_manager_register_xml("MeetmeList", EVENT_FLAG_REPORTING, action_meetmelist);
+	res |= ast_manager_register_xml("MeetmeListRooms", EVENT_FLAG_REPORTING, action_meetmelistrooms);
 	res |= ast_register_application_xml(app4, channel_admin_exec);
 	res |= ast_register_application_xml(app3, admin_exec);
 	res |= ast_register_application_xml(app2, count_exec);




More information about the svn-commits mailing list