[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311547 - in /team/dvossel/hd_confbridg...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 22 13:37:48 CDT 2011
Author: dvossel
Date: Tue Mar 22 13:37:43 2011
New Revision: 311547
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311547
Log:
Introduction of ConfbridgeList and ConfbridgeListRooms AMI actions
Modified:
team/dvossel/hd_confbridge/apps/app_confbridge.c
team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
team/dvossel/hd_confbridge/bridges/bridge_softmix.c
Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=311547&r1=311546&r2=311547
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Tue Mar 22 13:37:43 2011
@@ -4,6 +4,7 @@
* Copyright (C) 2007-2008, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
+ * David Vossel <dvossel at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -21,6 +22,7 @@
* \brief Conference Bridge application
*
* \author\verbatim Joshua Colp <jcolp at digium.com> \endverbatim
+ * \author\verbatim David Vossel <dvossel at digium.com> \endverbatim
*
* This is a conference bridge application utilizing the bridging core.
* \ingroup applications
@@ -1469,6 +1471,121 @@
.write = func_confbridge_helper,
};
+static int action_confbridgelist(struct mansession *s, const struct message *m)
+{
+ const char *actionid = astman_get_header(m, "ActionID");
+ const char *conference = astman_get_header(m, "Conference");
+ struct conference_bridge_user *participant = NULL;
+ struct conference_bridge *bridge = NULL;
+ struct conference_bridge tmp;
+ char id_text[80] = "";
+ int total = 0;
+
+ if (!ast_strlen_zero(actionid)) {
+ snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
+ }
+ if (ast_strlen_zero(conference)) {
+ astman_send_error(s, m, "No Conference name provided.");
+ return 0;
+ }
+ if (!ao2_container_count(conference_bridges)) {
+ astman_send_error(s, m, "No active conferences.");
+ return 0;
+ }
+ ast_copy_string(tmp.name, conference, sizeof(tmp.name));
+ bridge = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+ if (!bridge) {
+ astman_send_error(s, m, "No Conference by that name found.");
+ return 0;
+ }
+
+ astman_send_listack(s, m, "Confbridge user list will follow", "start");
+
+ ao2_lock(bridge);
+ AST_LIST_TRAVERSE(&bridge->users_list, participant, list) {
+ total++;
+ astman_append(s,
+ "Event: ConfbridgeList\r\n"
+ "%s"
+ "Conference: %s\r\n"
+ "CallerIDNum: %s\r\n"
+ "CallerIDName: %s\r\n"
+ "Channel: %s\r\n"
+ "Admin: %s\r\n"
+ "MarkedUser: %s\r\n"
+ "\r\n",
+ id_text,
+ bridge->name,
+ S_COR(participant->chan->caller.id.number.valid, participant->chan->caller.id.number.str, "<unknown>"),
+ S_COR(participant->chan->caller.id.name.valid, participant->chan->caller.id.name.str, "<no name>"),
+ participant->chan->name,
+ ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
+ ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
+ }
+ ao2_unlock(bridge);
+ ao2_ref(bridge, -1);
+
+ astman_append(s,
+ "Event: ConfbridgeListComplete\r\n"
+ "EventList: Complete\r\n"
+ "ListItems: %d\r\n"
+ "%s"
+ "\r\n", total, id_text);
+
+ return 0;
+}
+
+static int action_confbridgelistrooms(struct mansession *s, const struct message *m)
+{
+ const char *actionid = astman_get_header(m, "ActionID");
+ struct conference_bridge *bridge = NULL;
+ struct ao2_iterator i;
+ char id_text[80] = "";
+ int totalitems = 0;
+
+ if (!ast_strlen_zero(actionid)) {
+ snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", actionid);
+ }
+
+ if (!ao2_container_count(conference_bridges)) {
+ astman_send_error(s, m, "No active conferences.");
+ return 0;
+ }
+
+ astman_send_listack(s, m, "Confbridge conferences will follow", "start");
+
+ /* Traverse the conference list */
+ i = ao2_iterator_init(conference_bridges, 0);
+ while ((bridge = ao2_iterator_next(&i))) {
+ totalitems++;
+ astman_append(s,
+ "Event: ConfbridgeListRooms\r\n"
+ "%s"
+ "Conference: %s\r\n"
+ "Parties: %d\r\n"
+ "Marked: %d\r\n"
+ "Locked: %s\r\n"
+ "\r\n",
+ id_text,
+ bridge->name,
+ bridge->users,
+ bridge->markedusers,
+ bridge->locked ? "Yes" : "No");
+
+ ao2_ref(bridge, -1);
+ }
+ ao2_iterator_destroy(&i);
+
+ /* Send final confirmation */
+ astman_append(s,
+ "Event: ConfbridgeListRoomsComplete\r\n"
+ "EventList: Complete\r\n"
+ "ListItems: %d\r\n"
+ "%s"
+ "\r\n", totalitems, id_text);
+ return 0;
+}
+
/*! \brief Called when module is being unloaded */
static int unload_module(void)
{
@@ -1486,13 +1603,16 @@
ast_channel_unregister(&record_tech);
record_tech.capabilities = ast_format_cap_destroy(record_tech.capabilities);
+ res |= ast_manager_unregister("ConfbridgeList");
+ res |= ast_manager_unregister("ConfbridgeListRooms");
+
return res;
}
/*! \brief Called when module is being loaded */
static int load_module(void)
{
-
+ int res = 0;
if ((ast_custom_function_register(&confbridge_function))) {
return AST_MODULE_LOAD_FAILURE;
}
@@ -1504,21 +1624,21 @@
ast_log(LOG_ERROR, "Unable to register ConfBridge recorder.\n");
return AST_MODULE_LOAD_FAILURE;
}
-
/* Create a container to hold the conference bridges */
if (!(conference_bridges = ao2_container_alloc(CONFERENCE_BRIDGE_BUCKETS, conference_bridge_hash_cb, conference_bridge_cmp_cb))) {
- return AST_MODULE_LOAD_DECLINE;
- }
-
+ return AST_MODULE_LOAD_FAILURE;
+ }
if (ast_register_application_xml(app, confbridge_exec)) {
ao2_ref(conference_bridges, -1);
- return AST_MODULE_LOAD_DECLINE;
- }
-
- ast_cli_register_multiple(cli_confbridge, sizeof(cli_confbridge) / sizeof(struct ast_cli_entry));
+ return AST_MODULE_LOAD_FAILURE;
+ }
+
+ res |= ast_cli_register_multiple(cli_confbridge, sizeof(cli_confbridge) / sizeof(struct ast_cli_entry));
+ res |= ast_manager_register_xml("ConfbridgeList", EVENT_FLAG_REPORTING, action_confbridgelist);
+ res |= ast_manager_register_xml("ConfbridgeListRooms", EVENT_FLAG_REPORTING, action_confbridgelistrooms);
conf_load_config(0);
- return AST_MODULE_LOAD_SUCCESS;
+ return res;
}
static int reload(void)
Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=311547&r1=311546&r2=311547
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Tue Mar 22 13:37:43 2011
@@ -207,8 +207,10 @@
u_profile->flags = ast_true(value) ?
u_profile->flags | USER_OPT_DROP_SILENCE :
u_profile->flags & ~USER_OPT_DROP_SILENCE;
- } else if (!strcasecmp(name, "template") && !(conf_find_user_profile(NULL, value, u_profile))) {
- return -1;
+ } else if (!strcasecmp(name, "template")) {
+ if (!(conf_find_user_profile(NULL, value, u_profile))) {
+ return -1;
+ }
} else {
return -1;
}
Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=311547&r1=311546&r2=311547
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Tue Mar 22 13:37:43 2011
@@ -2,6 +2,9 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2011, Digium, Inc.
+ *
+ * David Vossel <dvossel at digium.com>
+ * Joshua Colp <jcolp at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
Modified: team/dvossel/hd_confbridge/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/bridges/bridge_softmix.c?view=diff&rev=311547&r1=311546&r2=311547
==============================================================================
--- team/dvossel/hd_confbridge/bridges/bridge_softmix.c (original)
+++ team/dvossel/hd_confbridge/bridges/bridge_softmix.c Tue Mar 22 13:37:43 2011
@@ -1,9 +1,10 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2007, Digium, Inc.
+ * Copyright (C) 2011, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
+ * David Vossel <dvossel at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -21,6 +22,7 @@
* \brief Multi-party software based channel mixing
*
* \author Joshua Colp <jcolp at digium.com>
+ * \author David Vossel <dvossel at digium.com>
*
* \ingroup bridges
*/
More information about the asterisk-commits
mailing list