[svn-commits] dvossel: branch dvossel/hd_confbridge r310411 - in /team/dvossel/hd_confbridg...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 11 16:06:41 CST 2011


Author: dvossel
Date: Fri Mar 11 16:06:37 2011
New Revision: 310411

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310411
Log:
Addition of admin lock and kick menu options

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/configs/confbridge.conf.sample

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=310411&r1=310410&r2=310411
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Fri Mar 11 16:06:37 2011
@@ -802,6 +802,8 @@
 	struct conf_menu *menu)
 {
 	struct conf_menu_action *menu_action;
+	struct conference_bridge_user *last_participant = NULL;
+	int isadmin = ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ADMIN);
 	int res = 0;
 
 	AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
@@ -840,6 +842,29 @@
 			break;
 		case MENU_ACTION_DIALPLAN_EXEC:
 			res |= action_dialplan_exec(bridge_channel, menu_action);
+			break;
+		case MENU_ACTION_ADMIN_TOGGLE_LOCK:
+			if (!isadmin) {
+				break;
+			}
+			conference_bridge->locked = (!conference_bridge->locked ? 1 : 0);
+			res |= ast_stream_and_wait(bridge_channel->chan,
+				(conference_bridge->locked ? "conf-lockednow" : "conf-unlockednow"), "");
+			break;
+		case MENU_ACTION_ADMIN_KICK_LAST:
+			if (!isadmin) {
+				break;
+			}
+			ao2_lock(conference_bridge);
+			if (((last_participant = AST_LIST_LAST(&conference_bridge->users_list)) == conference_bridge_user)
+				|| (ast_test_flag(&last_participant->u_profile, USER_OPT_ADMIN))) {
+				ao2_unlock(conference_bridge);
+				res = ast_stream_and_wait(bridge_channel->chan, "conf-errormenu", "");
+			} else if (last_participant) {
+				last_participant->kicked = 1;
+				ast_bridge_remove(conference_bridge->bridge, last_participant->chan);
+				ao2_unlock(conference_bridge);
+			}
 			break;
 		}
 	}

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=310411&r1=310410&r2=310411
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Fri Mar 11 16:06:37 2011
@@ -249,6 +249,8 @@
 	case MENU_ACTION_DECREASE_LISTENING:
 	case MENU_ACTION_INCREASE_TALKING:
 	case MENU_ACTION_DECREASE_TALKING:
+	case MENU_ACTION_ADMIN_TOGGLE_LOCK:
+	case MENU_ACTION_ADMIN_KICK_LAST:
 		break;
 	case MENU_ACTION_PLAYBACK:
 	case MENU_ACTION_PLAYBACK_AND_CONTINUE:
@@ -317,6 +319,10 @@
 		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_INCREASE_TALKING, NULL);
 	} else if (!strcasecmp(action, "decrease_talking_volume")) {
 		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DECREASE_TALKING, NULL);
+	} else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
+		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_TOGGLE_LOCK, NULL);
+	} else if (!strcasecmp(action, "admin_kick_last")) {
+		res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_KICK_LAST, NULL);
 	} else if (!strncasecmp(action, "dialplan_exec", 13)) {
 		action_args = ast_strdupa(action);
 		if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
@@ -616,6 +622,12 @@
 					menu_action->data.dialplan_args.exten,
 					menu_action->data.dialplan_args.priority);
 				break;
+			case MENU_ACTION_ADMIN_TOGGLE_LOCK:
+				ast_cli(a->fd, "admin_toggle_conference_lock");
+				break;
+			case MENU_ACTION_ADMIN_KICK_LAST:
+				ast_cli(a->fd, "admin_kick_last");
+				break;
 			}
 			action_num++;
 		}

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=310411&r1=310410&r2=310411
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Fri Mar 11 16:06:37 2011
@@ -50,6 +50,8 @@
 	MENU_ACTION_INCREASE_TALKING,
 	MENU_ACTION_DECREASE_TALKING,
 	MENU_ACTION_DIALPLAN_EXEC,
+	MENU_ACTION_ADMIN_TOGGLE_LOCK,
+	MENU_ACTION_ADMIN_KICK_LAST,
 };
 
 /*! The conference menu action contains both

Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=310411&r1=310410&r2=310411
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Fri Mar 11 16:06:37 2011
@@ -67,10 +67,21 @@
                                          ; commands in the dialplan.  Once the dialplan
                                          ; exits the user will be put back into the
                                          ; conference.  The possibilities are endless!
+;
+; admin_kick_last  ; This action allows an Admin to kick the last participant from the
+                   ; conference. This action will only work for admins which allows
+                   ; a single menu to be used for both users and admins.
+;
+; admin_toggle_conference_lock ; This action allows an Admin to toggle locking and
+                               ; unlocking the conference.  Non admins can not use
+                               ; this action even if it is in their menu.
+
 [sample_user_menu]
 type=menu
 *=playback_and_continue(conf-usermenu)
 *1=toggle_mute
+*2=admin_toggle_conference_lock ; only applied to admin users
+*3=admin_kick_last              ; only applied to admin users
 *4=decrease_listening_volume
 *6=increase_listening_volume
 *7=decrease_talking_volume




More information about the svn-commits mailing list