]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 234380 via svnmerge from
authorJeff Peeler <jpeeler@digium.com>
Fri, 11 Dec 2009 23:23:11 +0000 (23:23 +0000)
committerJeff Peeler <jpeeler@digium.com>
Fri, 11 Dec 2009 23:23:11 +0000 (23:23 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r234380 | jpeeler | 2009-12-11 17:17:09 -0600 (Fri, 11 Dec 2009) | 18 lines

  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)
  ........
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@234404 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c

index 3abb8f921191c9e9a711f103d41dee2a278c69a8..95dabc9490e76fb07fc094938a9641ed1ff36d32 100644 (file)
@@ -1601,6 +1601,35 @@ static int can_write(struct ast_channel *chan, int confflags)
        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)
+{
+       manager_event(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, int confflags, char *optargs[])
 {
        struct ast_conf_user *user = NULL;
@@ -2316,6 +2345,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                        break;
                                }
 
+                               /* Indicate user is not talking anymore - change him to unmonitored state */
+                               if ((confflags & (CONFFLAG_MONITORTALKER | CONFFLAG_OPTIMIZETALKER))) {
+                                       set_user_talking(chan, conf, user, -1, confflags & CONFFLAG_MONITORTALKER);
+                               }
+
                                manager_event(EVENT_FLAG_CALL, "MeetmeMute", 
                                                "Channel: %s\r\n"
                                                "Uniqueid: %s\r\n"
@@ -2420,27 +2454,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                        user->talking = 0;
 
                                                res = ast_dsp_silence(dsp, f, &totalsilence);
-                                               if (!user->talking && totalsilence < MEETME_DELAYDETECTTALK) {
-                                                       user->talking = 1;
-                                                       if (confflags & CONFFLAG_MONITORTALKER)
-                                                               manager_event(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);
+                                               if (totalsilence < MEETME_DELAYDETECTTALK) {
+                                                       set_user_talking(chan, conf, user, 1, confflags & CONFFLAG_MONITORTALKER);
                                                }
-                                               if (user->talking && totalsilence > MEETME_DELAYDETECTENDTALK) {
-                                                       user->talking = 0;
-                                                       if (confflags & CONFFLAG_MONITORTALKER)
-                                                               manager_event(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);
+                                               if (totalsilence > MEETME_DELAYDETECTENDTALK) {
+                                                       set_user_talking(chan, conf, user, 0, confflags & CONFFLAG_MONITORTALKER);
                                                }
                                        }
                                        if (using_pseudo) {