[asterisk-commits] kmoore: branch kmoore/scheduler r422535 - in /team/kmoore/scheduler: ./ apps/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 1 18:37:52 CDT 2014


Author: kmoore
Date: Mon Sep  1 18:37:36 2014
New Revision: 422535

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=422535
Log:
Multiple revisions 422072,422092,422158,422178,422201,422216,422240-422241,422257,422277,422297,422358,422375,422380,422443,422446,422505,422524

........
  r422072 | mmichelson | 2014-08-26 17:14:46 -0500 (Tue, 26 Aug 2014) | 26 lines
  
  Fix race condition in the scheduler when deleting a running entry.
  
  When scheduled tasks run, they are removed from the heap (or hashtab).
  When a scheduled task is deleted, if the task can't be found in the
  heap (or hashtab), an assertion is triggered. If DO_CRASH is enabled,
  this assertion causes a crash.
  
  The problem is, sometimes it just so happens that someone attempts
  to delete a scheduled task at the time that it is running, leading
  to a crash. This change corrects the issue by tracking which task
  is currently running. If that task is attempted to be deleted,
  then we mark the task, and then wait for the task to complete.
  This way, we can be sure to coordinate task deletion and memory
  freeing.
  
  ASTERISK-24212
  Reported by Matt Jordan
  
  Review: https://reviewboard.asterisk.org/r/3927
  ........
  
  Merged revisions 422070 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422071 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422092 | gtjoseph | 2014-08-26 18:30:00 -0500 (Tue, 26 Aug 2014) | 17 lines
  
  confbridge: Make kick, mute and unmute handle channel targets consistently.
  
  Kick, mute and unmute were a little inconsistent in their handling of channel
  targets.  This patch cleans that up by insuring they all handle the 'all'
  target consistently and adds the 'participants' target which acts on
  non-admins.  Documentation for kick was also cleaned up as it never
  supported partial channel names.
  
  Tested by: George Joseph
  Review: https://reviewboard.asterisk.org/r/3944/
  ........
  
  Merged revisions 422090 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422091 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422158 | kmoore | 2014-08-27 10:39:35 -0500 (Wed, 27 Aug 2014) | 22 lines
  
  CallerID: Fix parsing of malformed callerid
  
  This allows the callerid parsing function to handle malformed input
  strings and strings containing escaped and unescaped double quotes.
  This also adds a unittest to cover many of the cases where the parsing
  algorithm previously failed.
  
  Review: https://reviewboard.asterisk.org/r/3923/
  Review: https://reviewboard.asterisk.org/r/3933/
  ........
  
  Merged revisions 422112 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 422113 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422114 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422154 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422178 | gtjoseph | 2014-08-27 12:30:51 -0500 (Wed, 27 Aug 2014) | 15 lines
  
  confbridge: Add 'Admin' param to join, leave, mute, unmute and talking events
  
  Currently there's no way to tell if a user is an admin or not when receiving
  the join, leave, mute, unmute and talking events.  This patch adds that
  capability.
  
  Tested by: George Joseph
  Review: https://reviewboard.asterisk.org/r/3950/
  ........
  
  Merged revisions 422176 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422177 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422201 | rmudgett | 2014-08-27 19:16:01 -0500 (Wed, 27 Aug 2014) | 5 lines
  
  sched: Fix typo and whitespace change.
  ........
  
  Merged revisions 422200 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422216 | rmudgett | 2014-08-27 19:44:59 -0500 (Wed, 27 Aug 2014) | 13 lines
  
  res/res_pjsip/pjsip_options.c: Eliminate excessive RAII_VAR usage.
  
  * Fix off nominal ref leak in find_or_create_contact_status().
  
  * Add missing NULL check of status in update_contact_status() and
  init_start_time().
  ........
  
  Merged revisions 422214 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422215 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422240 | mmichelson | 2014-08-28 10:50:41 -0500 (Thu, 28 Aug 2014) | 10 lines
  
  Fix bug that did not allow for multiple batched RLS notifications to be sent.
  
  A misunderstanding of how the scheduler worked caused further batched notifications
  beyond the first not to get scheduled. Now we reset our scheduler ID to -1 after
  the batched notification is sent. This way, further notifications can be scheduled
  when they arise.
  ........
  
  Merged revisions 422239 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422241 | pabelanger | 2014-08-28 11:06:55 -0500 (Thu, 28 Aug 2014) | 13 lines
  
  chan_sip.c: Add 'rtpbindaddr' setting
  
  Users now have the ability to bind the rtpengine instance to a specific IP
  address.  For example, you want chan_sip (call control) on eth0 but rtp (media)
  on eth1.
  
  ASTERISK-24280 #close
  Reported by: Paul Belanger
  Tested by: Paul Belanger
  Review: https://reviewboard.asterisk.org/r/3952/
  Patches:
      rtpengine.diff uploaded by Paul Belanger
........
  r422257 | rmudgett | 2014-08-28 12:29:16 -0500 (Thu, 28 Aug 2014) | 8 lines
  
  Added ConfBridge AMI event note to UPGRADE.txt.
  ........
  
  Merged revisions 422255 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422256 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422277 | elguero | 2014-08-28 15:31:48 -0500 (Thu, 28 Aug 2014) | 40 lines
  
  chan_iax2: Fix Dynamic IAX2 Registrations After Temporary DNS Failure
  
  The reporter on the issue found some issues when upgrading from version 10 to 11
  on 55 hosts.
  
  Two situations that can occur with dynamic registrations.
  
  1.  With dnsmgr disabled, if the host is not resolvable we are not trying to
      resolve the host again when it is time to attempt to register again.  This
      results in never registering to the host.
  2.  With dnsmgr enabled, when the host is temporarily not resolvable the
      address is set to 0.0.0.0:0 and then when the host is resolvable the port
      is not being restored and stays set to 0.
  
  This patch resolves these two issues by:
  
  * Storing the hostname so that it can be used for resolving with DNS.
  * Resolve the hostname on the next scheduled attempt to register.
  * Storing the port used to reach the host so that when the hostname is
    resolvable again, we can set the port again if the port is still unset after
    looking up the host.
  
  ASTERISK-23767 #close
  Reported by: David Herselman
  Tested by: David Herselman, Michael L. Young
  Patches:
      asterisk-23767-dns_reg_retry_and_set_port_11_v3.diff
                                       uploaded by Michael L. Young (license 5026)
  
  Review: https://reviewboard.asterisk.org/r/3856/
  ........
  
  Merged revisions 422274 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422275 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422276 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422297 | mjordan | 2014-08-28 16:54:44 -0500 (Thu, 28 Aug 2014) | 31 lines
  
  LICENSE: Clarify language in Asterisk's LICENSE to allow for linking to UniMRCP
  
  The UniMRCP project distributes Asterisk modules that integrate Asterisk with
  UniMRCP, and other Asterisk users use the UniMRCP library as well.
  Unfortunately, the UniMRCP license is Apache 2.0, which per the Free Software
  Foundation, is not a compatible license with the GPLv2.
  
  "Please note that this license is not compatible with GPL version 2, because it
  has some requirements that are not in that GPL version. These include certain
  patent termination and indemnification provisions. The patent termination
  provision is a good thing, which is why we recommend the Apache 2.0 license for
  substantial programs over other lax permissive licenses."
  
  On the other hand, UniMRCP is a great project and we'd like to let people use
  it with Asterisk.
  
  This patch updates the LICENSE text to allow users to link Asterisk with
  UniMRCP and distribute the resulting binaries.
  ........
  
  Merged revisions 422293 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 422294 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422295 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422296 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422358 | sgriepentrog | 2014-08-29 13:46:19 -0500 (Fri, 29 Aug 2014) | 7 lines
  
  The assertion that peer was not found on final event
  message was being triggered on configuration reload.
  This patch changes that case to just return instead.
  
  Review: https://reviewboard.asterisk.org/r/3953/
........
  r422375 | mjordan | 2014-08-29 14:35:43 -0500 (Fri, 29 Aug 2014) | 25 lines
  
  doc: Add a manpage for the aelparse utility
  
  This patch adds a manpage for the aelparse utility. Note that this is one of
  the patches the Debian distro applies for the Asterisk project, as per
  ASTERISK-24191.
  
  Review: https://reviewboard.asterisk.org/r/3896/
  
  ASTERISK-24171 #close
  Reported by: Jeremy Laine
  patches:
    aelparse.8 uploaded by Jeremy Laine (License 6561)
  ........
  
  Merged revisions 422371 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 422372 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422373 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422374 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422380 | mjordan | 2014-08-29 14:40:34 -0500 (Fri, 29 Aug 2014) | 25 lines
  
  doc: Add a manpage for the smsq utility
  
  This patch adds a manpage for the smsq utility. Note that this is one of
  the patches the Debian distro applies for the Asterisk project, as per
  ASTERISK-24191.
  
  Review: https://reviewboard.asterisk.org/r/3895/
  
  ASTERISK-24171 #close
  Reported by: Jeremy Laine
  patches:
    smsq.8 uploaded by Jeremy Laine (License 6561)
  ........
  
  Merged revisions 422376 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 422377 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422378 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422379 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422443 | gtjoseph | 2014-08-30 12:24:57 -0500 (Sat, 30 Aug 2014) | 21 lines
  
  manager: Make WaitEvent action respect eventfilters
  
  A WaitEvent issued via an http session isn't respecting eventfilters defined
  for the user. I just added a match_filter to the predicate that controls
  astman_append.
  
  Tested by: George Joseph
  Review: https://reviewboard.asterisk.org/r/3958/
  ........
  
  Merged revisions 422439 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 422440 from http://svn.asterisk.org/svn/asterisk/branches/11
  ........
  
  Merged revisions 422441 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422442 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422446 | gtjoseph | 2014-08-30 12:33:08 -0500 (Sat, 30 Aug 2014) | 15 lines
  
  confbridge: Add Duration to ConfbridgeList event
  
  The ConfbridgeList event doesn't include how long the user has been a
  member of the conference.  This patch adds Duration (seconds) which
  is based on user->chan->answertime.
  
  Tested by: George Joseph
  Review: https://reviewboard.asterisk.org/r/3955/
  ........
  
  Merged revisions 422444 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422445 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422505 | mjordan | 2014-09-01 09:15:32 -0500 (Mon, 01 Sep 2014) | 39 lines
  
  res_stasis: Don't play MoH to channels by default when added to holding bridges
  
  When ARI manipulates a bridge, it generally doesn't care what the mixing
  technology is. Operations on a bridge initiated through ARI should perform
  their action in generally the same way, regardless of the bridge's mixing
  technology. While the mixing technology may determine how media flows to
  channels, the actual operations on a bridge themselves should be the same.
  
  Currently, this isn't the case with holding bridges. When a channel joins
  without a role, MoH is started on that channel automatically. Subsequent bridge
  operations that would stop MoH would fail (as there is no Announcer channel
  playing MoH to the bridge). Starting MoH on the bridge will also create two
  MoH streams: one from the MoH being played on the participant channel, and one
  from the announcer channel. From the perspective of ARI users, this is
  counter-intuitive - I would not expect MoH to be started for me. The mixing
  technology determines how media is shared between participants, not the
  application experience.
  
  This patch does the following:
   * The Stasis bridge class now inspects channels as they are going into a
     bridge. If the bridge has a holding capability, and the channel has no
     roles, we give it a participant role and mark the default behaviour to have
     no entertainment. This allows addChannel operations to continue to set a
     participant role with an entertainment option if it felt like it (or could
     do it).
   * The music on hold channel is now Stasis approved (tm)
  
  Review: https://reviewboard.asterisk.org/r/3929/
  
  ASTERISK-24264 #close
  Reported by: Samuel Galarneau
  Tested by: Samuel Galarneau 
  ........
  
  Merged revisions 422503 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422504 from http://svn.asterisk.org/svn/asterisk/branches/13
........
  r422524 | mjordan | 2014-09-01 10:25:26 -0500 (Mon, 01 Sep 2014) | 11 lines
  
  main/cli: Do not attempt to show CDR data for internal channels
  
  Internal channels don't have CDRs. Querying the CDR engine for their variables
  will make it cranky.
  ........
  
  Merged revisions 422506 from http://svn.asterisk.org/svn/asterisk/branches/12
  ........
  
  Merged revisions 422507 from http://svn.asterisk.org/svn/asterisk/branches/13
........

Merged revisions 422072,422092,422158,422178,422201,422216,422240-422241,422257,422277,422297,422358,422375,422380,422443,422446,422505,422524 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/kmoore/scheduler/doc/aelparse.8
      - copied unchanged from r422524, trunk/doc/aelparse.8
    team/kmoore/scheduler/doc/smsq.8
      - copied unchanged from r422524, trunk/doc/smsq.8
    team/kmoore/scheduler/tests/test_callerid.c
      - copied unchanged from r422524, trunk/tests/test_callerid.c
Modified:
    team/kmoore/scheduler/   (props changed)
    team/kmoore/scheduler/CHANGES
    team/kmoore/scheduler/LICENSE
    team/kmoore/scheduler/UPGRADE-13.txt
    team/kmoore/scheduler/apps/app_confbridge.c
    team/kmoore/scheduler/apps/confbridge/confbridge_manager.c
    team/kmoore/scheduler/channels/chan_iax2.c
    team/kmoore/scheduler/channels/chan_sip.c
    team/kmoore/scheduler/configs/samples/sip.conf.sample
    team/kmoore/scheduler/include/asterisk/utils.h
    team/kmoore/scheduler/main/callerid.c
    team/kmoore/scheduler/main/cli.c
    team/kmoore/scheduler/main/manager.c
    team/kmoore/scheduler/main/sched.c
    team/kmoore/scheduler/main/utils.c
    team/kmoore/scheduler/res/res_pjsip/pjsip_options.c
    team/kmoore/scheduler/res/res_pjsip_caller_id.c
    team/kmoore/scheduler/res/res_pjsip_pubsub.c
    team/kmoore/scheduler/res/res_stasis.c
    team/kmoore/scheduler/res/stasis/stasis_bridge.c
    team/kmoore/scheduler/tests/test_utils.c

Propchange: team/kmoore/scheduler/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/kmoore/scheduler/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Propchange: team/kmoore/scheduler/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Sep  1 18:37:36 2014
@@ -1,1 +1,1 @@
-/trunk:1-422045
+/trunk:1-422534

Modified: team/kmoore/scheduler/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/scheduler/CHANGES?view=diff&rev=422535&r1=422534&r2=422535
==============================================================================
--- team/kmoore/scheduler/CHANGES (original)
+++ team/kmoore/scheduler/CHANGES Mon Sep  1 18:37:36 2014
@@ -12,7 +12,14 @@
 --- Functionality changes from Asterisk 13 to Asterisk 14 --------------------
 ------------------------------------------------------------------------------
 
-
+Channel Drivers
+------------------
+
+chan_sip
+------------------
+ * New 'rtpbindaddr' global setting. This allows a user to define which
+   ipaddress to bind the rtpengine too.  For example, chan_sip might bind
+   to eth0 (10.0.0.2) but rtpengine to eth1 (192.168.1.10).
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 12 to Asterisk 13 --------------------

Modified: team/kmoore/scheduler/LICENSE
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/scheduler/LICENSE?view=diff&rev=422535&r1=422534&r2=422535
==============================================================================
--- team/kmoore/scheduler/LICENSE (original)
+++ team/kmoore/scheduler/LICENSE Mon Sep  1 18:37:36 2014
@@ -25,7 +25,7 @@
 would strongly encourage you to make the same exception that we do).
 
 Specific permission is also granted to link Asterisk with OpenSSL, OpenH323
-and/or the UW IMAP Toolkit and distribute the resulting binary files.
+UniMRCP, and/or the UW IMAP Toolkit and distribute the resulting binary files.
 
 In addition, Asterisk implements several management/control protocols.
 This includes the Asterisk Manager Interface (AMI), the Asterisk Gateway

Modified: team/kmoore/scheduler/UPGRADE-13.txt
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/scheduler/UPGRADE-13.txt?view=diff&rev=422535&r1=422534&r2=422535
==============================================================================
--- team/kmoore/scheduler/UPGRADE-13.txt (original)
+++ team/kmoore/scheduler/UPGRADE-13.txt Mon Sep  1 18:37:36 2014
@@ -60,11 +60,14 @@
 Applications:
 
 ConfBridge:
-- The sound_place_into_conference sound used in Confbridge is now deprecated
-  and is no longer functional since it has been broken since its inception
-  and the fix involved using a different method to achieve the same goal. The
-  new method to achieve this functionality is by using sound_begin to play
-  a sound to the conference when waitmarked users are moved into the conference.
+ - The sound_place_into_conference sound used in Confbridge is now deprecated
+   and is no longer functional since it has been broken since its inception
+   and the fix involved using a different method to achieve the same goal. The
+   new method to achieve this functionality is by using sound_begin to play
+   a sound to the conference when waitmarked users are moved into the conference.
+
+ - Added 'Admin' header to ConfbridgeJoin, ConfbridgeLeave, ConfbridgeMute,
+   ConfbridgeUnmute, and ConfbridgeTalking AMI events.
 
 ControlPlayback:
  - The ControlPlayback and 'control stream file' AGI command will no longer

Modified: team/kmoore/scheduler/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/scheduler/apps/app_confbridge.c?view=diff&rev=422535&r1=422534&r2=422535
==============================================================================
--- team/kmoore/scheduler/apps/app_confbridge.c (original)
+++ team/kmoore/scheduler/apps/app_confbridge.c Mon Sep  1 18:37:36 2014
@@ -211,6 +211,8 @@
 			<parameter name="Conference" required="true" />
 			<parameter name="Channel" required="true">
 				<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
+				<para>If this parameter is "all", all channels will be muted.</para>
+				<para>If this parameter is "participants", all non-admin channels will be muted.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -225,6 +227,8 @@
 			<parameter name="Conference" required="true" />
 			<parameter name="Channel" required="true">
 				<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
+				<para>If this parameter is "all", all channels will be unmuted.</para>
+				<para>If this parameter is "participants", all non-admin channels will be unmuted.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -238,8 +242,8 @@
 			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
 			<parameter name="Conference" required="true" />
 			<parameter name="Channel" required="true" >
-				<para>If this parameter is not a complete channel name, the first channel with this prefix will be used.</para>
 				<para>If this parameter is "all", all channels will be kicked from the conference.</para>
+				<para>If this parameter is "participants", all non-admin channels will be kicked from the conference.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -441,7 +445,8 @@
 	return "";
 }
 
-static void send_conf_stasis(struct confbridge_conference *conference, struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *extras, int channel_topic)
+static void send_conf_stasis(struct confbridge_conference *conference, struct ast_channel *chan,
+	struct stasis_message_type *type, struct ast_json *extras, int channel_topic)
 {
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
@@ -483,14 +488,32 @@
 	send_conf_stasis(conference, NULL, confbridge_end_type(), NULL, 0);
 }
 
-static void send_join_event(struct ast_channel *chan, struct confbridge_conference *conference)
-{
-	send_conf_stasis(conference, chan, confbridge_join_type(), NULL, 0);
-}
-
-static void send_leave_event(struct ast_channel *chan, struct confbridge_conference *conference)
-{
-	send_conf_stasis(conference, chan, confbridge_leave_type(), NULL, 0);
+static void send_join_event(struct confbridge_user *user, struct confbridge_conference *conference)
+{
+	struct ast_json *json_object;
+
+	json_object = ast_json_pack("{s: b}",
+		"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
+	);
+	if (!json_object) {
+		return;
+	}
+	send_conf_stasis(conference, user->chan, confbridge_join_type(), json_object, 0);
+	ast_json_unref(json_object);
+}
+
+static void send_leave_event(struct confbridge_user *user, struct confbridge_conference *conference)
+{
+	struct ast_json *json_object;
+
+	json_object = ast_json_pack("{s: b}",
+		"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
+	);
+	if (!json_object) {
+		return;
+	}
+	send_conf_stasis(conference, user->chan, confbridge_leave_type(), json_object, 0);
+	ast_json_unref(json_object);
 }
 
 static void send_start_record_event(struct confbridge_conference *conference)
@@ -503,14 +526,32 @@
 	send_conf_stasis(conference, NULL, confbridge_stop_record_type(), NULL, 0);
 }
 
-static void send_mute_event(struct ast_channel *chan, struct confbridge_conference *conference)
-{
-	send_conf_stasis(conference, chan, confbridge_mute_type(), NULL, 1);
-}
-
-static void send_unmute_event(struct ast_channel *chan, struct confbridge_conference *conference)
-{
-	send_conf_stasis(conference, chan, confbridge_unmute_type(), NULL, 1);
+static void send_mute_event(struct confbridge_user *user, struct confbridge_conference *conference)
+{
+	struct ast_json *json_object;
+
+	json_object = ast_json_pack("{s: b}",
+		"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
+	);
+	if (!json_object) {
+		return;
+	}
+	send_conf_stasis(conference, user->chan, confbridge_mute_type(), json_object, 1);
+	ast_json_unref(json_object);
+}
+
+static void send_unmute_event(struct confbridge_user *user, struct confbridge_conference *conference)
+{
+	struct ast_json *json_object;
+
+	json_object = ast_json_pack("{s: b}",
+		"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
+	);
+	if (!json_object) {
+		return;
+	}
+	send_conf_stasis(conference, user->chan, confbridge_unmute_type(), json_object, 1);
+	ast_json_unref(json_object);
 }
 
 static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
@@ -1450,25 +1491,21 @@
 	return play_sound_helper(conference, NULL, say_number);
 }
 
-static void conf_handle_talker_destructor(void *pvt_data)
-{
-	ast_free(pvt_data);
-}
-
 static int conf_handle_talker_cb(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking)
 {
-	const char *conf_name = hook_pvt;
+	const struct confbridge_user *user = hook_pvt;
 	RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
 	struct ast_json *talking_extras;
 
-	conference = ao2_find(conference_bridges, conf_name, OBJ_KEY);
+	conference = ao2_find(conference_bridges, user->conference->name, OBJ_KEY);
 	if (!conference) {
 		/* Remove the hook since the conference does not exist. */
 		return -1;
 	}
 
-	talking_extras = ast_json_pack("{s: s}",
-		"talking_status", talking ? "on" : "off");
+	talking_extras = ast_json_pack("{s: s, s: b}",
+		"talking_status", talking ? "on" : "off",
+		"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN));
 	if (!talking_extras) {
 		return 0;
 	}
@@ -1684,17 +1721,9 @@
 
 	/* Set a talker indicate call back if talking detection is requested */
 	if (ast_test_flag(&user.u_profile, USER_OPT_TALKER_DETECT)) {
-		char *conf_name = ast_strdup(args.conf_name); /* this is freed during feature cleanup */
-
-		if (!conf_name) {
+		if (ast_bridge_talk_detector_hook(&user.features, conf_handle_talker_cb,
+			&user, NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 			pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
-			res = -1;
-			goto confbridge_cleanup;
-		}
-		if (ast_bridge_talk_detector_hook(&user.features, conf_handle_talker_cb,
-			conf_name, conf_handle_talker_destructor, AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
-			pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
-			ast_free(conf_name);
 			res = -1;
 			goto confbridge_cleanup;
 		}
@@ -1763,7 +1792,7 @@
 	conf_moh_unsuspend(&user);
 
 	/* Join our conference bridge for real */
-	send_join_event(user.chan, conference);
+	send_join_event(&user, conference);
 	ast_bridge_join(conference->bridge,
 		chan,
 		NULL,
@@ -1775,7 +1804,7 @@
 		pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "HANGUP");
 	}
 
-	send_leave_event(user.chan, conference);
+	send_leave_event(&user, conference);
 
 	/* if we're shutting down, don't attempt to do further processing */
 	if (ast_shutting_down()) {
@@ -1834,8 +1863,7 @@
 }
 
 static int action_toggle_mute(struct confbridge_conference *conference,
-	struct confbridge_user *user,
-	struct ast_channel *chan)
+	struct confbridge_user *user)
 {
 	int mute;
 
@@ -1848,17 +1876,17 @@
 		"Message: participant %s %s\r\n"
 		"Conference: %s\r\n"
 		"Channel: %s",
-		ast_channel_name(chan),
+		ast_channel_name(user->chan),
 		mute ? "muted" : "unmuted",
 		user->b_profile.name,
-		ast_channel_name(chan));
+		ast_channel_name(user->chan));
 	if (mute) {
-		send_mute_event(chan, conference);
+		send_mute_event(user, conference);
 	} else {
-		send_unmute_event(chan, conference);
-	}
-
-	return ast_stream_and_wait(chan, (mute ?
+		send_unmute_event(user, conference);
+	}
+
+	return ast_stream_and_wait(user->chan, (mute ?
 		conf_get_sound(CONF_SOUND_MUTED, user->b_profile.sounds) :
 		conf_get_sound(CONF_SOUND_UNMUTED, user->b_profile.sounds)),
 		"");
@@ -2076,9 +2104,7 @@
 	AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
 		switch (menu_action->id) {
 		case MENU_ACTION_TOGGLE_MUTE:
-			res |= action_toggle_mute(conference,
-				user,
-				bridge_channel->chan);
+			res |= action_toggle_mute(conference, user);
 			break;
 		case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
 			if (!isadmin) {
@@ -2189,37 +2215,47 @@
 	return 0;
 }
 
-static int kick_conference_participant(struct confbridge_conference *conference, const char *channel)
+static int kick_conference_participant(struct confbridge_conference *conference,
+	const char *channel)
 {
 	int res = -1;
+	int match;
 	struct confbridge_user *user = NULL;
+	int all = !strcasecmp("all", channel);
+	int participants = !strcasecmp("participants", channel);
 
 	SCOPED_AO2LOCK(bridge_lock, conference);
 
 	AST_LIST_TRAVERSE(&conference->active_list, user, list) {
-		if (!strcasecmp(ast_channel_name(user->chan), channel) && !user->kicked) {
-			user->kicked = 1;
-			pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
-			ast_bridge_remove(conference->bridge, user->chan);
-			return 0;
-		} else if (!strcasecmp("all", channel)) {
+		if (user->kicked) {
+			continue;
+		}
+		match = !strcasecmp(channel, ast_channel_name(user->chan));
+		if (match || all
+				|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
 			user->kicked = 1;
 			pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
 			ast_bridge_remove(conference->bridge, user->chan);
 			res = 0;
+			if (match) {
+				return res;
+			}
 		}
 	}
 	AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
-		if (!strcasecmp(ast_channel_name(user->chan), channel) && !user->kicked) {
-			user->kicked = 1;
-			pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
-			ast_bridge_remove(conference->bridge, user->chan);
-			return 0;
-		} else if (!strcasecmp("all", channel)) {
+		if (user->kicked) {
+			continue;
+		}
+		match = !strcasecmp(channel, ast_channel_name(user->chan));
+		if (match || all
+				|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
 			user->kicked = 1;
 			pbx_builtin_setvar_helper(user->chan, "CONFBRIDGE_RESULT", "KICKED");
 			ast_bridge_remove(conference->bridge, user->chan);
 			res = 0;
+			if (match) {
+				return res;
+			}
 		}
 	}
 
@@ -2261,10 +2297,13 @@
 		return NULL;
 	}
 
-	if (!state) {
+	if (!strncasecmp("all", word, wordlen) && ++which > state) {
 		return ast_strdup("all");
 	}
-	state--;
+
+	if (!strncasecmp("participants", word, wordlen) && ++which > state) {
+		return ast_strdup("participants");
+	}
 
 	{
 		SCOPED_AO2LOCK(bridge_lock, conference);
@@ -2295,7 +2334,8 @@
 		e->command = "confbridge kick";
 		e->usage =
 			"Usage: confbridge kick <conference> <channel>\n"
-			"       Kicks a channel out of the conference bridge (all to kick everyone).\n";
+			"       Kicks a channel out of the conference bridge.\n"
+			"             (all to kick everyone, participants to kick non-admins).\n";
 		return NULL;
 	case CLI_GENERATE:
 		if (a->pos == 2) {
@@ -2319,10 +2359,14 @@
 	not_found = kick_conference_participant(conference, a->argv[3]);
 	ao2_ref(conference, -1);
 	if (not_found) {
-		ast_cli(a->fd, "No participant named '%s' found!\n", a->argv[3]);
+		if (!strcasecmp("all", a->argv[3]) || !strcasecmp("participants", a->argv[3])) {
+			ast_cli(a->fd, "No participants found!\n");
+		} else {
+			ast_cli(a->fd, "No participant named '%s' found!\n", a->argv[3]);
+		}
 		return CLI_SUCCESS;
 	}
-	ast_cli(a->fd, "Participant '%s' kicked out of conference '%s'\n", a->argv[3], a->argv[2]);
+	ast_cli(a->fd, "Kicked '%s' out of conference '%s'\n", a->argv[3], a->argv[2]);
 	return CLI_SUCCESS;
 }
 
@@ -2455,59 +2499,78 @@
 }
 
 /* \internal
+ * \brief Mute/unmute a single user.
+ */
+static void generic_mute_unmute_user(struct confbridge_conference *conference, struct confbridge_user *user, int mute)
+{
+	/* Set user level mute request. */
+	user->muted = mute ? 1 : 0;
+
+	conf_update_user_mute(user);
+	ast_test_suite_event_notify("CONF_MUTE",
+		"Message: participant %s %s\r\n"
+		"Conference: %s\r\n"
+		"Channel: %s",
+		ast_channel_name(user->chan),
+		mute ? "muted" : "unmuted",
+		conference->b_profile.name,
+		ast_channel_name(user->chan));
+	if (mute) {
+		send_mute_event(user, conference);
+	} else {
+		send_unmute_event(user, conference);
+	}
+}
+
+/* \internal
  * \brief finds a conference user by channel name and mutes/unmutes them.
  *
  * \retval 0 success
  * \retval -1 conference not found
  * \retval -2 user not found
  */
-static int generic_mute_unmute_helper(int mute, const char *conference_name, const char *chan_name)
-{
-	struct confbridge_conference *conference;
+static int generic_mute_unmute_helper(int mute, const char *conference_name,
+	const char *chan_name)
+{
+	RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
 	struct confbridge_user *user;
-	int res = 0;
+	int all = !strcasecmp("all", chan_name);
+	int participants = !strcasecmp("participants", chan_name);
+	int res = -2;
 
 	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		return -1;
 	}
-	ao2_lock(conference);
-	AST_LIST_TRAVERSE(&conference->active_list, user, list) {
-		if (!strncmp(chan_name, ast_channel_name(user->chan), strlen(chan_name))) {
-			break;
-		}
-	}
-	if (!user) {
-		/* user is not in the active list so check the waiting list as well */
+
+	{
+		SCOPED_AO2LOCK(bridge_lock, conference);
+		AST_LIST_TRAVERSE(&conference->active_list, user, list) {
+			int match = !strncasecmp(chan_name, ast_channel_name(user->chan),
+				strlen(chan_name));
+			if (match || all
+				|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
+				generic_mute_unmute_user(conference, user, mute);
+				res = 0;
+				if (match) {
+					return res;
+				}
+			}
+		}
+
 		AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
-			if (!strncmp(chan_name, ast_channel_name(user->chan), strlen(chan_name))) {
-				break;
+			int match = !strncasecmp(chan_name, ast_channel_name(user->chan),
+				strlen(chan_name));
+			if (match || all
+				|| (participants && !ast_test_flag(&user->u_profile, USER_OPT_ADMIN))) {
+				generic_mute_unmute_user(conference, user, mute);
+				res = 0;
+				if (match) {
+					return res;
+				}
 			}
 		}
 	}
-	if (user) {
-		/* Set user level mute request. */
-		user->muted = mute ? 1 : 0;
-
-		conf_update_user_mute(user);
-		ast_test_suite_event_notify("CONF_MUTE",
-			"Message: participant %s %s\r\n"
-			"Conference: %s\r\n"
-			"Channel: %s",
-			ast_channel_name(user->chan),
-			mute ? "muted" : "unmuted",
-			conference->b_profile.name,
-			ast_channel_name(user->chan));
-		if (mute) {
-			send_mute_event(user->chan, conference);
-		} else {
-			send_unmute_event(user->chan, conference);
-		}
-	} else {
-		res = -2;;
-	}
-	ao2_unlock(conference);
-	ao2_ref(conference, -1);
 
 	return res;
 }
@@ -2520,7 +2583,11 @@
 		ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
 		return -1;
 	} else if (res == -2) {
-		ast_cli(a->fd, "No channel named '%s' found in conference %s\n", a->argv[3], a->argv[2]);
+		if (!strcasecmp("all", a->argv[3]) || !strcasecmp("participants", a->argv[3])) {
+			ast_cli(a->fd, "No participants found in conference %s\n", a->argv[2]);
+		} else {
+			ast_cli(a->fd, "No channel named '%s' found in conference %s\n", a->argv[3], a->argv[2]);
+		}
 		return -1;
 	}
 	ast_cli(a->fd, "%s %s from confbridge %s\n", mute ? "Muting" : "Unmuting", a->argv[3], a->argv[2]);
@@ -2535,6 +2602,7 @@
 		e->usage =
 			"Usage: confbridge mute <conference> <channel>\n"
 			"       Mute a channel in a conference.\n"
+			"              (all to mute everyone, participants to mute non-admins)\n"
 			"       If the specified channel is a prefix,\n"
 			"       the action will be taken on the first\n"
 			"       matching channel.\n";
@@ -2565,6 +2633,7 @@
 		e->usage =
 			"Usage: confbridge unmute <conference> <channel>\n"
 			"       Unmute a channel in a conference.\n"
+			"              (all to unmute everyone, participants to unmute non-admins)\n"
 			"       If the specified channel is a prefix,\n"
 			"       the action will be taken on the first\n"
 			"       matching channel.\n";
@@ -2735,8 +2804,8 @@
 static struct ast_cli_entry cli_confbridge[] = {
 	AST_CLI_DEFINE(handle_cli_confbridge_list, "List conference bridges and participants."),
 	AST_CLI_DEFINE(handle_cli_confbridge_kick, "Kick participants out of conference bridges."),
-	AST_CLI_DEFINE(handle_cli_confbridge_mute, "Mute a participant."),
-	AST_CLI_DEFINE(handle_cli_confbridge_unmute, "Unmute a participant."),
+	AST_CLI_DEFINE(handle_cli_confbridge_mute, "Mute participants."),
+	AST_CLI_DEFINE(handle_cli_confbridge_unmute, "Unmute participants."),
 	AST_CLI_DEFINE(handle_cli_confbridge_lock, "Lock a conference."),
 	AST_CLI_DEFINE(handle_cli_confbridge_unlock, "Unlock a conference."),
 	AST_CLI_DEFINE(handle_cli_confbridge_start_record, "Start recording a conference"),
@@ -2768,6 +2837,7 @@
 		"EndMarked: %s\r\n"
 		"Waiting: %s\r\n"
 		"Muted: %s\r\n"
+		"AnsweredTime: %d\r\n"
 		"\r\n",
 		id_text,
 		conference->name,
@@ -2779,7 +2849,8 @@
 		ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED) ? "Yes" : "No",
 		ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED) ? "Yes" : "No",
 		waiting ? "Yes" : "No",
-		user->muted ? "Yes" : "No");
+		user->muted ? "Yes" : "No",
+		ast_channel_get_up_time(user->chan));
 }
 
 static int action_confbridgelist(struct mansession *s, const struct message *m)

Modified: team/kmoore/scheduler/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/scheduler/apps/confbridge/confbridge_manager.c?view=diff&rev=422535&r1=422534&r2=422535
==============================================================================
--- team/kmoore/scheduler/apps/confbridge/confbridge_manager.c (original)
+++ team/kmoore/scheduler/apps/confbridge/confbridge_manager.c Mon Sep  1 18:37:36 2014
@@ -76,6 +76,13 @@
 				</parameter>
 				<bridge_snapshot/>
 				<channel_snapshot/>
+				<parameter name="Admin">
+					<para>Identifies this user as an admin user.</para>
+					<enumlist>
+						<enum name="Yes"/>
+						<enum name="No"/>
+					</enumlist>
+				</parameter>
 			</syntax>
 			<see-also>
 				<ref type="managerEvent">ConfbridgeLeave</ref>
@@ -92,6 +99,13 @@
 				</parameter>
 				<bridge_snapshot/>
 				<channel_snapshot/>
+				<parameter name="Admin">
+					<para>Identifies this user as an admin user.</para>
+					<enumlist>
+						<enum name="Yes"/>
+						<enum name="No"/>
+					</enumlist>
+				</parameter>
 			</syntax>
 			<see-also>
 				<ref type="managerEvent">ConfbridgeJoin</ref>
@@ -138,6 +152,13 @@
 				</parameter>
 				<bridge_snapshot/>
 				<channel_snapshot/>
+				<parameter name="Admin">
+					<para>Identifies this user as an admin user.</para>
+					<enumlist>
+						<enum name="Yes"/>
+						<enum name="No"/>
+					</enumlist>
+				</parameter>
 			</syntax>
 			<see-also>
 				<ref type="managerEvent">ConfbridgeUnmute</ref>
@@ -154,6 +175,13 @@
 				</parameter>
 				<bridge_snapshot/>
 				<channel_snapshot/>
+				<parameter name="Admin">
+					<para>Identifies this user as an admin user.</para>
+					<enumlist>
+						<enum name="Yes"/>
+						<enum name="No"/>
+					</enumlist>
+				</parameter>
 			</syntax>
 			<see-also>
 				<ref type="managerEvent">ConfbridgeMute</ref>
@@ -174,6 +202,13 @@
 					<enumlist>

[... 1287 lines stripped ...]



More information about the asterisk-commits mailing list