[asterisk-commits] jpeeler: trunk r234380 - in /trunk: ./ apps/app_meetme.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 11 17:17:14 CST 2009


Author: jpeeler
Date: Fri Dec 11 17:17:09 2009
New Revision: 234380

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=234380
Log:
Merged revisions 234379 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r234379 | jpeeler | 2009-12-11 16:37:21 -0600 (Fri, 11 Dec 2009) | 11 lines
  
  Fix talking detection status after conference user is muted.
  
  This patch ensures that when a conference user is muted that the accompanying
  AMI Meetme talking off event is sent. Also, the meetme list output is updated
  to show the muted user as unmonitored.
  
  (closes issue #16247)
  Reported by: dimas
  Patches: 
        v3-16247.patch uploaded by dimas (license 88)
........

Modified:
    trunk/   (props changed)
    trunk/apps/app_meetme.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_meetme.c?view=diff&rev=234380&r1=234379&r2=234380
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Fri Dec 11 17:17:09 2009
@@ -2051,6 +2051,35 @@
 	return (chan->_state == AST_STATE_UP);
 }
 
+static void send_talking_event(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking)
+{
+	ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking",
+	      "Channel: %s\r\n"
+	      "Uniqueid: %s\r\n"
+	      "Meetme: %s\r\n"
+	      "Usernum: %d\r\n"
+	      "Status: %s\r\n",
+	      chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off");
+}
+
+static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor)
+{
+	int last_talking = user->talking;
+	if (last_talking == talking)
+		return;
+
+	user->talking = talking;
+
+	if (monitor) {
+		/* Check if talking state changed. Take care of -1 which means unmonitored */
+		int was_talking = (last_talking > 0);
+		int now_talking = (talking > 0);
+		if (was_talking != now_talking) {
+			send_talking_event(chan, conf, user, now_talking);
+		}
+	}
+}
+
 static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struct ast_flags64 *confflags, char *optargs[])
 {
 	struct ast_conf_user *user = NULL;
@@ -2865,6 +2894,11 @@
 					break;
 				}
 
+				/* Indicate user is not talking anymore - change him to unmonitored state */
+				if (ast_test_flag64(confflags,  (CONFFLAG_MONITORTALKER | CONFFLAG_OPTIMIZETALKER))) {
+					set_user_talking(chan, conf, user, -1, ast_test_flag64(confflags, CONFFLAG_MONITORTALKER));
+				}
+
 				ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeMute",
 						"Channel: %s\r\n"
 						"Uniqueid: %s\r\n"
@@ -2975,28 +3009,11 @@
 
 						res = ast_dsp_silence(dsp, f, &totalsilence);
 						if (!user->talking && totalsilence < MEETME_DELAYDETECTTALK) {
-							user->talking = 1;
-							if (ast_test_flag64(confflags, CONFFLAG_MONITORTALKER)) {
-								ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking",
-								      "Channel: %s\r\n"
-								      "Uniqueid: %s\r\n"
-								      "Meetme: %s\r\n"
-								      "Usernum: %d\r\n"
-								      "Status: on\r\n",
-								      chan->name, chan->uniqueid, conf->confno, user->user_no);
-							}
+							set_user_talking(chan, conf, user, 1, ast_test_flag64(confflags, CONFFLAG_MONITORTALKER));
 						}
+
 						if (user->talking && totalsilence > MEETME_DELAYDETECTENDTALK) {
-							user->talking = 0;
-							if (ast_test_flag64(confflags, CONFFLAG_MONITORTALKER)) {
-								ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking",
-								      "Channel: %s\r\n"
-								      "Uniqueid: %s\r\n"
-								      "Meetme: %s\r\n"
-								      "Usernum: %d\r\n"
-								      "Status: off\r\n",
-								      chan->name, chan->uniqueid, conf->confno, user->user_no);
-							}
+							set_user_talking(chan, conf, user, 0, ast_test_flag64(confflags, CONFFLAG_MONITORTALKER));
 						}
 					}
 					if (using_pseudo) {




More information about the asterisk-commits mailing list