[asterisk-commits] oej: branch oej/pinelonely-meetme-single-user-hangup-trunk r314197 - /team/oe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 19 07:04:39 CDT 2011


Author: oej
Date: Tue Apr 19 06:54:14 2011
New Revision: 314197

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314197
Log:
Check this, Tony.

Modified:
    team/oej/pinelonely-meetme-single-user-hangup-trunk/apps/app_meetme.c

Modified: team/oej/pinelonely-meetme-single-user-hangup-trunk/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pinelonely-meetme-single-user-hangup-trunk/apps/app_meetme.c?view=diff&rev=314197&r1=314196&r2=314197
==============================================================================
--- team/oej/pinelonely-meetme-single-user-hangup-trunk/apps/app_meetme.c (original)
+++ team/oej/pinelonely-meetme-single-user-hangup-trunk/apps/app_meetme.c Tue Apr 19 06:54:14 2011
@@ -120,6 +120,9 @@
 					</option>
 					<option name="I">
 						<para>Announce user join/leave without review.</para>
+					</option>
+					<option name="k">
+						<para>Close the conference if there's only one active participant left at exit.</para>
 					</option>
 					<option name="l">
 						<para>Set listen only mode (Listen only, no talking).</para>
@@ -539,6 +542,7 @@
 	ADMINFLAG_KICKME =    (1 << 3),  /*!< User has been kicked */
 	/*! User has requested to speak */
 	ADMINFLAG_T_REQUEST = (1 << 4),
+	ADMINFLAG_HANGUP = (1 << 5),	/*!< User will be leaving the conference */
 };
 
 #define MEETME_DELAYDETECTTALK     300
@@ -630,6 +634,8 @@
    If you add new flags, be sure to do it in the same way that CONFFLAG_INTROMSG is. */
 #define CONFFLAG_INTROMSG ((uint64_t)1 << 32)	 /*!< If set play an intro announcement at start of conference */
 #define CONFFLAG_INTROUSER_VMREC ((uint64_t)1 << 33)
+/*! If there's only one person left in a conference when someone leaves, kill the conference */
+#define CONFFLAG_KILL_LAST_MAN_STANDING ((uint64_t)1 << 33)
 
 enum {
 	OPT_ARG_WAITMARKED = 0,
@@ -657,6 +663,7 @@
 	AST_APP_OPTION_ARG('v', CONFFLAG_INTROUSER_VMREC , OPT_ARG_INTROUSER_VMREC),
 	AST_APP_OPTION('i', CONFFLAG_INTROUSER ),
 	AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW ),
+	AST_APP_OPTION('k', CONFFLAG_KILL_LAST_MAN_STANDING ),
 	AST_APP_OPTION_ARG('M', CONFFLAG_MOH, OPT_ARG_MOH_CLASS ),
 	AST_APP_OPTION('m', CONFFLAG_STARTMUTED ),
 	AST_APP_OPTION('o', CONFFLAG_OPTIMIZETALKER ),
@@ -2186,6 +2193,17 @@
 			send_talking_event(chan, conf, user, now_talking);
 		}
 	}
+}
+
+static int user_set_hangup_cb(void *obj, void *check_admin_arg, int flags)
+{
+	struct ast_conf_user *user = obj;
+	/* actual pointer contents of check_admin_arg is irrelevant */
+
+	if (!check_admin_arg || (check_admin_arg && !ast_test_flag64(&user->userflags, CONFFLAG_ADMIN))) {
+		user->adminflags |= ADMINFLAG_HANGUP;
+	}
+	return 0;
 }
 
 static int user_set_kickme_cb(void *obj, void *check_admin_arg, int flags)
@@ -3160,6 +3178,12 @@
 							     chan->name, chan->uniqueid, conf->confno, user->user_no);
 			}
 			
+			/* If user have been hung up, exit the conference */
+			if (user->adminflags & ADMINFLAG_HANGUP) {
+				ret = 0;
+				break;
+			}
+
 			/* If I have been kicked, exit the conference */
 			if (user->adminflags & ADMINFLAG_KICKME) {
 				/* You have been kicked. */
@@ -3845,6 +3869,11 @@
 		if (!conf->users) {
 			ast_devstate_changed(AST_DEVICE_NOT_INUSE, "meetme:%s", conf->confno);
 		}
+ 
+ 		/* This flag is meant to kill a conference with only one participant remaining.  */
+		if (conf->users == 1 && ast_test_flag64(confflags, CONFFLAG_KILL_LAST_MAN_STANDING)) {
+ 			ao2_callback(conf->usercontainer, 0, user_set_hangup_cb, NULL);
+ 		}
 
 		/* Return the number of seconds the user was in the conf */
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));




More information about the asterisk-commits mailing list