[asterisk-commits] qwell: branch 10-digiumphones r378661 - in /branches/10-digiumphones: ./ apps...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 8 13:12:52 CST 2013


Author: qwell
Date: Tue Jan  8 13:12:38 2013
New Revision: 378661

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=378661
Log:
Multiple revisions 377838,377842,377848,377882,377923,377947,377992,378037,378089,378093,378120,378218,378286,378320

........
  r377838 | rmudgett | 2012-12-11 14:42:59 -0600 (Tue, 11 Dec 2012) | 16 lines
  
  Cleanup taskprocessor on exit.
  
  * Cleanup CLI commands on exit.
  
  * v10 only: Merged v1.8 -r374177 change to taskprocessor.c missed in v10 -r374178.
  
  (issue ASTERISK-20649)
  Reported by: Corey Farrell
  Patches:
        taskprocessor-cleanup-1_8-11-trunk.patch (license #5909) patch uploaded by Corey Farrell
        taskprocessor-cleanup-10-only.patch (license #5909) patch uploaded by Corey Farrell
        Modified
  ........
  
  Merged revisions 377837 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377842 | mmichelson | 2012-12-11 14:48:16 -0600 (Tue, 11 Dec 2012) | 13 lines
  
  Fix crash that can occur if CLI registration fails for an aliased command.
  
  A recent memory leak fix in main/cli.c causes an ast_cli_entry's command
  field to be freed and NULLed if ast_cli_register() fails. res_clialiases
  was ignoring the return value of ast_cli_register() and was then passing
  the NULL command off to a a hash function. This resulted in a crash.
  
  The fix is not to ignore the erroneous return value. If ast_cli_register()
  fails, then we do not continue trying to process the current alias.
  ........
  
  Merged revisions 377840 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377848 | rmudgett | 2012-12-11 15:07:47 -0600 (Tue, 11 Dec 2012) | 14 lines
  
  Cleanup udptl on exit.
  
  * Cleanup CLI commands on exit.
  
  (issue ASTERISK-20649)
  Reported by: Corey Farrell
  Patches:
        udptl-shutdown-1_8-10.patch (license #5909) patch uploaded by Corey Farrell
        udptl-shutdown-11-trunk.patch (license #5909) patch uploaded by Corey Farrell
        Modified
  ........
  
  Merged revisions 377847 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377882 | rmudgett | 2012-12-11 15:57:44 -0600 (Tue, 11 Dec 2012) | 10 lines
  
  Cleanup CLI commands on exit for several files.
  
  (issue ASTERISK-20649)
  Reported by: Corey Farrell
  Patches:
        unregister-cli-multiple-all.patch (license #5909) patch uploaded by Corey Farrell
  ........
  
  Merged revisions 377881 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377923 | newtonr | 2012-12-12 16:41:24 -0600 (Wed, 12 Dec 2012) | 12 lines
  
  Incremented EXTRA_SOUNDS_VERSION in sounds/Makefile to 1.4.12 for new Extra Sounds releases
  
  See CHANGES-* files in English extra 1.4.12 tarballs for new sound prompts added.
  
  (closes ASTERISK-20328)
  Reported by: Matt Jordan
  (closes AST-755)
  Reported by: John Bigelow
  ........
  
  Merged revisions 377922 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377947 | kmoore | 2012-12-13 07:48:32 -0600 (Thu, 13 Dec 2012) | 17 lines
  
  Ensure Min-SE is included in outbound INVITEs
  
  Asterisk now includes Min-SE in outbound INVITEs when the value is not
  90 (the default) and session timers are not disabled. This has the
  effect of Asterisk following RFC4028 more closely with regard to 422
  responses and preventing situations in which Asterisk would be forced
  to temporarily accept a call to tear it down based on a Session-Expires
  below the locally configured Min-SE.
  
  (issue SWP-5051)
  Review: https://reviewboard.asterisk.org/r/2222/
  Reported-by: Kinsey Moore
  Patch-by: Kinsey Moore
  ........
  
  Merged revisions 377946 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r377992 | rmudgett | 2012-12-13 14:52:26 -0600 (Thu, 13 Dec 2012) | 29 lines
  
  confbridge: Fix MOH on simultaneous user entry to a new conference.
  
  When two users entered a new conference simultaneously, one of the callers
  hears MOH.  This happened if two unmarked users entered simultaneously and
  also if a waitmarked and a marked user entered simultaneously.
  
  * Created a confbridge internal MOH API to eliminate the inlined MOH
  handling code.  Note that the conference mixing bridge needs to be locked
  when actually starting/stopping MOH because there is a small window
  between the conference join unsuspend MOH and actually joining the mixing
  bridge.
  
  * Created the concept of suspended MOH so it can be interrupted while
  conference join announcements to the user and DTMF features can operate.
  
  * Suspend any MOH until the user is about to actually join the mixing
  bridge of the conference.  This way any pre-join file playback does not
  need to worry about MOH.
  
  * Made post-join actions only play deferred entry announcement files.
  Changing the user/conference state during that time is not protected or
  controlled by the state machine.
  
  (closes issue ASTERISK-20606)
  Reported by: Eugenia Belova
  Tested by: rmudgett
  
  Review: https://reviewboard.asterisk.org/r/2232/
........
  r378037 | rmudgett | 2012-12-14 15:30:46 -0600 (Fri, 14 Dec 2012) | 20 lines
  
  app_queue: Revert bad ringinuse=no patch.
  
  With the option ringinuse=no set, the patch committed for ASTERISK-16115
  causes non-SIP queue members to never be called because the device state
  is checked after a channel is created to determine if the member is busy.
  These queue members always get the "Member %s is busy, cannot dial"
  message.
  
  Most channel drivers other than chan_sip use the default device state
  handling.  The default device-state state is considered in use or unknown
  if the channel exists or not respectively.
  
  (closes issue ASTERISK-20801)
  Reported by: rmudgett
  Patches:
        jira_asterisk_16115_revert_r370418_v1.8.patch (license #5621) patch uploaded by rmudgett
  ........
  
  Merged revisions 378036 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378089 | rmudgett | 2012-12-17 16:57:10 -0600 (Mon, 17 Dec 2012) | 16 lines
  
  Make chan_local module references tied to local_pvt lifetime.
  
  The chan_local module references were manually tied to the existence of
  the ;1 and ;2 channel links.
  
  * Made chan_local module references tied to the existence of the local_pvt
  structure as well as automatically take care of the module references.
  
  * Tweaked the wording of the local_fixup() failure warning message to make
  sense.
  
  Review: https://reviewboard.asterisk.org/r/2181/
  ........
  
  Merged revisions 378088 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378093 | rmudgett | 2012-12-17 17:08:40 -0600 (Mon, 17 Dec 2012) | 5 lines
  
  Fix potential double free when unloading a module.
  ........
  
  Merged revisions 378092 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378120 | kmoore | 2012-12-18 11:38:22 -0600 (Tue, 18 Dec 2012) | 11 lines
  
  Add test events for time limit-related hangups
  
  This patch adds hangup-related test events in order to support testing
  of time-limited bridges. This aids in testing the S() and L() bridge
  options.
  
  (issue SWP-4713)
  ........
  
  Merged revisions 378119 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378218 | kmoore | 2012-12-31 08:43:26 -0600 (Mon, 31 Dec 2012) | 12 lines
  
  Ensure chan_sip rejects encrypted streams without crypto info
  
  This ensures that Asterisk rejects encrypted media streams (RTP/SAVP
  audio and video) that are missing cryptographic keys and ensures that
  the incoming SDP is consistent with RFC4568 as far as having a crypto
  attribute present for any SAVP streams.
  
  Review: https://reviewboard.asterisk.org/r/2204/
  ........
  
  Merged revisions 378217 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378286 | mjordan | 2013-01-02 09:23:57 -0600 (Wed, 02 Jan 2013) | 30 lines
  
  Resolve crashes due to large stack allocations when using TCP
  
  Asterisk had several places where messages received over various network
  transports may be copied in a single stack allocation. In the case of TCP,
  since multiple packets in a stream may be concatenated together, this can
  lead to large allocations that overflow the stack.
  
  This patch modifies those portions of Asterisk using TCP to either
  favor heap allocations or use an upper bound to ensure that the stack will not
  overflow:
   * For SIP, the allocation now has an upper limit
   * For HTTP, the allocation is now a heap allocation instead of a stack
     allocation
   * For XMPP (in res_jabber), the allocation has been eliminated since it was
     unnecesary.
  
  Note that the HTTP portion of this issue was independently found by Brandon
  Edwards of Exodus Intelligence.
  
  (issue ASTERISK-20658)
  Reported by: wdoekes, Brandon Edwards
  Tested by: mmichelson, wdoekes
  patches:
    ASTERISK-20658_res_jabber.c.patch uploaded by mmichelson (license 5049)
    issueA20658_http_postvars_use_malloc2.patch uploaded by wdoekes (license 5674)
    issueA20658_limit_sip_packet_size3.patch uploaded by wdoekes (license 5674)
  ........
  
  Merged revisions 378269 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
  r378320 | mjordan | 2013-01-02 11:40:28 -0600 (Wed, 02 Jan 2013) | 27 lines
  
  Prevent exhaustion of system resources through exploitation of event cache
  
  Asterisk maintains an internal cache for devices in the event subsystem. The
  device state cache holds the state of each device known to Asterisk, such that
  consumers of device state information can query for the last known state for
  a particular device, even if it is not part of an active call. The concept of
  a device in Asterisk can include entities that do not have a physical
  representation. One way that this occurred was when anonymous calls are allowed
  in Asterisk. A device was automatically created and stored in the cache for
  each anonymous call that occurred; this was possible in the SIP and IAX2
  channel drivers and through channel drivers that utilized the
  res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
  are never removed from the system, allowing anonymous calls to potentially
  exhaust a system's resources.
  
  This patch changes the event cache subsystem and device state management to
  no longer cache devices that are not associated with a physical entity.
  
  (issue ASTERISK-20175)
  Reported by: Russell Bryant, Leif Madsen, Joshua Colp
  Tested by: kmoore
  patches:
    event-cachability-3.diff uploaded by jcolp (license 5000)
  ........
  
  Merged revisions 378303 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 377838,377842,377848,377882,377923,377947,377992,378037,378089,378093,378120,378218,378286,378320 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/10-digiumphones/   (props changed)
    branches/10-digiumphones/apps/app_confbridge.c
    branches/10-digiumphones/apps/app_meetme.c
    branches/10-digiumphones/apps/app_queue.c
    branches/10-digiumphones/apps/confbridge/conf_state.c
    branches/10-digiumphones/apps/confbridge/conf_state_empty.c
    branches/10-digiumphones/apps/confbridge/conf_state_multi_marked.c
    branches/10-digiumphones/apps/confbridge/include/confbridge.h
    branches/10-digiumphones/channels/chan_agent.c
    branches/10-digiumphones/channels/chan_dahdi.c
    branches/10-digiumphones/channels/chan_iax2.c
    branches/10-digiumphones/channels/chan_local.c
    branches/10-digiumphones/channels/chan_sip.c
    branches/10-digiumphones/channels/chan_skinny.c
    branches/10-digiumphones/channels/sip/include/sip.h
    branches/10-digiumphones/funcs/func_devstate.c
    branches/10-digiumphones/include/asterisk/bridging.h
    branches/10-digiumphones/include/asterisk/channel.h
    branches/10-digiumphones/include/asterisk/devicestate.h
    branches/10-digiumphones/include/asterisk/event_defs.h
    branches/10-digiumphones/main/aoc.c
    branches/10-digiumphones/main/ccss.c
    branches/10-digiumphones/main/cel.c
    branches/10-digiumphones/main/channel.c
    branches/10-digiumphones/main/data.c
    branches/10-digiumphones/main/devicestate.c
    branches/10-digiumphones/main/event.c
    branches/10-digiumphones/main/features.c
    branches/10-digiumphones/main/file.c
    branches/10-digiumphones/main/http.c
    branches/10-digiumphones/main/image.c
    branches/10-digiumphones/main/loader.c
    branches/10-digiumphones/main/stun.c
    branches/10-digiumphones/main/taskprocessor.c
    branches/10-digiumphones/main/timing.c
    branches/10-digiumphones/main/udptl.c
    branches/10-digiumphones/res/res_calendar.c
    branches/10-digiumphones/res/res_clialiases.c
    branches/10-digiumphones/res/res_jabber.c
    branches/10-digiumphones/sounds/Makefile

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
--- branch-10-merged (original)
+++ branch-10-merged Tue Jan  8 13:12:38 2013
@@ -1,1 +1,1 @@
-/branches/10:1-377807
+/branches/10:1-378660

Modified: branches/10-digiumphones/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/app_confbridge.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/app_confbridge.c (original)
+++ branches/10-digiumphones/apps/app_confbridge.c Tue Jan  8 13:12:38 2013
@@ -848,6 +848,94 @@
 	return 0;
 }
 
+void conf_moh_stop(struct conference_bridge_user *user)
+{
+	user->playing_moh = 0;
+	if (!user->suspended_moh) {
+		int in_bridge;
+
+		/*
+		 * Locking the ast_bridge here is the only way to hold off the
+		 * call to ast_bridge_join() in confbridge_exec() from
+		 * interfering with the bridge and MOH operations here.
+		 */
+		ast_bridge_lock(user->conference_bridge->bridge);
+
+		/*
+		 * Temporarily suspend the user from the bridge so we have
+		 * control to stop MOH if needed.
+		 */
+		in_bridge = !ast_bridge_suspend(user->conference_bridge->bridge, user->chan);
+		ast_moh_stop(user->chan);
+		if (in_bridge) {
+			ast_bridge_unsuspend(user->conference_bridge->bridge, user->chan);
+		}
+
+		ast_bridge_unlock(user->conference_bridge->bridge);
+	}
+}
+
+void conf_moh_start(struct conference_bridge_user *user)
+{
+	user->playing_moh = 1;
+	if (!user->suspended_moh) {
+		int in_bridge;
+
+		/*
+		 * Locking the ast_bridge here is the only way to hold off the
+		 * call to ast_bridge_join() in confbridge_exec() from
+		 * interfering with the bridge and MOH operations here.
+		 */
+		ast_bridge_lock(user->conference_bridge->bridge);
+
+		/*
+		 * Temporarily suspend the user from the bridge so we have
+		 * control to start MOH if needed.
+		 */
+		in_bridge = !ast_bridge_suspend(user->conference_bridge->bridge, user->chan);
+		ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
+		if (in_bridge) {
+			ast_bridge_unsuspend(user->conference_bridge->bridge, user->chan);
+		}
+
+		ast_bridge_unlock(user->conference_bridge->bridge);
+	}
+}
+
+/*!
+ * \internal
+ * \brief Unsuspend MOH for the conference user.
+ *
+ * \param user Conference user to unsuspend MOH on.
+ *
+ * \return Nothing
+ */
+static void conf_moh_unsuspend(struct conference_bridge_user *user)
+{
+	ao2_lock(user->conference_bridge);
+	if (--user->suspended_moh == 0 && user->playing_moh) {
+		ast_moh_start(user->chan, user->u_profile.moh_class, NULL);
+	}
+	ao2_unlock(user->conference_bridge);
+}
+
+/*!
+ * \internal
+ * \brief Suspend MOH for the conference user.
+ *
+ * \param user Conference user to suspend MOH on.
+ *
+ * \return Nothing
+ */
+static void conf_moh_suspend(struct conference_bridge_user *user)
+{
+	ao2_lock(user->conference_bridge);
+	if (user->suspended_moh++ == 0 && user->playing_moh) {
+		ast_moh_stop(user->chan);
+	}
+	ao2_unlock(user->conference_bridge);
+}
+
 int conf_handle_first_marked_common(struct conference_bridge_user *cbu)
 {
 	if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET) && play_prompt_to_user(cbu, conf_get_sound(CONF_SOUND_PLACE_IN_CONF, cbu->b_profile.sounds))) {
@@ -858,18 +946,11 @@
 
 int conf_handle_inactive_waitmarked(struct conference_bridge_user *cbu)
 {
-	/* Be sure we are muted so we can't talk to anybody else waiting */
-	cbu->features.mute = 1;
 	/* If we have not been quieted play back that they are waiting for the leader */
 	if (!ast_test_flag(&cbu->u_profile, USER_OPT_QUIET) && play_prompt_to_user(cbu,
 			conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, cbu->b_profile.sounds))) {
 		/* user hungup while the sound was playing */
 		return -1;
-	}
-	/* Start music on hold if needed */
-	if (ast_test_flag(&cbu->u_profile, USER_OPT_MUSICONHOLD)) {
-		ast_moh_start(cbu->chan, cbu->u_profile.moh_class, NULL);
-		cbu->playing_moh = 1;
 	}
 	return 0;
 }
@@ -901,7 +982,7 @@
 
 void conf_handle_first_join(struct conference_bridge *conference_bridge)
 {
-	ast_devstate_changed(AST_DEVICE_INUSE, "confbridge:%s", conference_bridge->name);
+	ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", conference_bridge->name);
 }
 
 void conf_handle_second_active(struct conference_bridge *conference_bridge)
@@ -909,11 +990,8 @@
 	/* If we are the second participant we may need to stop music on hold on the first */
 	struct conference_bridge_user *first_participant = AST_LIST_FIRST(&conference_bridge->active_list);
 
-	/* Temporarily suspend the above participant from the bridge so we have control to stop MOH if needed */
-	if (ast_test_flag(&first_participant->u_profile, USER_OPT_MUSICONHOLD) && !ast_bridge_suspend(conference_bridge->bridge, first_participant->chan)) {
-		first_participant->playing_moh = 0;
-		ast_moh_stop(first_participant->chan);
-		ast_bridge_unsuspend(conference_bridge->bridge, first_participant->chan);
+	if (ast_test_flag(&first_participant->u_profile, USER_OPT_MUSICONHOLD)) {
+		conf_moh_stop(first_participant);
 	}
 	if (!ast_test_flag(&first_participant->u_profile, USER_OPT_STARTMUTED)) {
 		first_participant->features.mute = 0;
@@ -1037,6 +1115,13 @@
 	conference_bridge_user->conference_bridge = conference_bridge;
 
 	ao2_lock(conference_bridge);
+
+	/*
+	 * Suspend any MOH until the user actually joins the bridge of
+	 * the conference.  This way any pre-join file playback does not
+	 * need to worry about MOH.
+	 */
+	conference_bridge_user->suspended_moh = 1;
 
 	if (handle_conf_user_join(conference_bridge_user)) {
 		/* Invalid event, nothing was done, so we don't want to process a leave. */
@@ -1455,20 +1540,17 @@
 	/* Play the Join sound to both the conference and the user entering. */
 	if (!quiet) {
 		const char *join_sound = conf_get_sound(CONF_SOUND_JOIN, conference_bridge_user.b_profile.sounds);
-		if (conference_bridge_user.playing_moh) {
-			ast_moh_stop(chan);
-		}
+
 		ast_stream_and_wait(chan, join_sound, "");
 		ast_autoservice_start(chan);
 		play_sound_file(conference_bridge, join_sound);
 		ast_autoservice_stop(chan);
-		if (conference_bridge_user.playing_moh) {
-			ast_moh_start(chan, conference_bridge_user.u_profile.moh_class, NULL);
-		}
 	}
 
 	/* See if we need to automatically set this user as a video source or not */
 	handle_video_on_join(conference_bridge, conference_bridge_user.chan, ast_test_flag(&conference_bridge_user.u_profile, USER_OPT_MARKEDUSER));
+
+	conf_moh_unsuspend(&conference_bridge_user);
 
 	/* Join our conference bridge for real */
 	send_join_event(conference_bridge_user.chan, conference_bridge->name);
@@ -1810,25 +1892,14 @@
 	struct conf_menu_entry *menu_entry,
 	struct conf_menu *menu)
 {
-	struct conference_bridge *conference_bridge = conference_bridge_user->conference_bridge;
-
 	/* See if music on hold is playing */
-	ao2_lock(conference_bridge);
-	if (conference_bridge_user->playing_moh) {
-		/* MOH is going, let's stop it */
-		ast_moh_stop(bridge_channel->chan);
-	}
-	ao2_unlock(conference_bridge);
+	conf_moh_suspend(conference_bridge_user);
 
 	/* execute the list of actions associated with this menu entry */
-	execute_menu_entry(conference_bridge, conference_bridge_user, bridge_channel, menu_entry, menu);
+	execute_menu_entry(conference_bridge_user->conference_bridge, conference_bridge_user, bridge_channel, menu_entry, menu);
 
 	/* See if music on hold needs to be started back up again */
-	ao2_lock(conference_bridge);
-	if (conference_bridge_user->playing_moh) {
-		ast_moh_start(bridge_channel->chan, conference_bridge_user->u_profile.moh_class, NULL);
-	}
-	ao2_unlock(conference_bridge);
+	conf_moh_unsuspend(conference_bridge_user);
 
 	return 0;
 }
@@ -2718,13 +2789,7 @@
 	/* Turn on MOH/mute if the single participant is set up for it */
 	if (ast_test_flag(&only_participant->u_profile, USER_OPT_MUSICONHOLD)) {
 		only_participant->features.mute = 1;
-		if (!only_participant->chan->bridge || !ast_bridge_suspend(conference_bridge->bridge, only_participant->chan)) {
-			ast_moh_start(only_participant->chan, only_participant->u_profile.moh_class, NULL);
-			only_participant->playing_moh = 1;
-			if (only_participant->chan->bridge) {
-				ast_bridge_unsuspend(conference_bridge->bridge, only_participant->chan);
-			}
-		}
+		conf_moh_start(only_participant);
 	}
 }
 

Modified: branches/10-digiumphones/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/app_meetme.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/app_meetme.c (original)
+++ branches/10-digiumphones/apps/app_meetme.c Tue Jan  8 13:12:38 2013
@@ -2650,7 +2650,7 @@
 
 	/* This device changed state now - if this is the first user */
 	if (conf->users == 1)
-		ast_devstate_changed(AST_DEVICE_INUSE, "meetme:%s", conf->confno);
+		ast_devstate_changed(AST_DEVICE_INUSE, (conf->isdynamic ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), "meetme:%s", conf->confno);
 
 	ast_mutex_unlock(&conf->playlock);
 
@@ -3967,7 +3967,7 @@
 
 		/* Change any states */
 		if (!conf->users) {
-			ast_devstate_changed(AST_DEVICE_NOT_INUSE, "meetme:%s", conf->confno);
+			ast_devstate_changed(AST_DEVICE_NOT_INUSE, (conf->isdynamic ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), "meetme:%s", conf->confno);
 		}
 
 		/* Return the number of seconds the user was in the conf */
@@ -5457,8 +5457,8 @@
 				|| trunk_ref == exclude)
 				continue;
 			trunk_ref->state = state;
-			ast_devstate_changed(sla_state_to_devstate(state), 
-				"SLA:%s_%s", station->name, trunk->name);
+			ast_devstate_changed(sla_state_to_devstate(state), AST_DEVSTATE_CACHABLE,
+					     "SLA:%s_%s", station->name, trunk->name);
 			break;
 		}
 	}
@@ -5956,8 +5956,8 @@
 {
 	ast_atomic_fetchadd_int((int *) &event->trunk_ref->trunk->hold_stations, 1);
 	event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME;
-	ast_devstate_changed(AST_DEVICE_ONHOLD, "SLA:%s_%s", 
-		event->station->name, event->trunk_ref->trunk->name);
+	ast_devstate_changed(AST_DEVICE_ONHOLD, AST_DEVSTATE_CACHABLE, "SLA:%s_%s",
+			     event->station->name, event->trunk_ref->trunk->name);
 	sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD, 
 		INACTIVE_TRUNK_REFS, event->trunk_ref);
 
@@ -6466,8 +6466,8 @@
 			sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
 		else {
 			trunk_ref->state = SLA_TRUNK_STATE_UP;
-			ast_devstate_changed(AST_DEVICE_INUSE, 
-				"SLA:%s_%s", station->name, trunk_ref->trunk->name);
+			ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE,
+					     "SLA:%s_%s", station->name, trunk_ref->trunk->name);
 		}
 	} else if (trunk_ref->state == SLA_TRUNK_STATE_RINGING) {
 		struct sla_ringing_trunk *ringing_trunk;

Modified: branches/10-digiumphones/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/app_queue.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/app_queue.c (original)
+++ branches/10-digiumphones/apps/app_queue.c Tue Jan  8 13:12:38 2013
@@ -3192,7 +3192,7 @@
 			if (newstate != tmp->member->status) {
 				ast_log(LOG_WARNING, "Found a channel matching iterface %s while status was %s changed to %s\n",
 					tmp->member->interface, ast_devstate2str(tmp->member->status), ast_devstate2str(newstate));
-				ast_devstate_changed_literal(newstate, tmp->member->interface);
+				ast_devstate_changed_literal(newstate, AST_DEVSTATE_CACHABLE, tmp->member->interface);
 			}
 		}
 		if ((tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
@@ -3306,18 +3306,8 @@
 	ast_channel_unlock(tmp->chan);
 	ast_channel_unlock(qe->chan);
 
-	ao2_lock(tmp->member);
-	update_status(qe->parent, tmp->member, get_queue_member_status(tmp->member));
-	if (!qe->parent->ringinuse && (tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
-		ast_verb(1, "Member %s is busy, cannot dial", tmp->member->interface);
-		res = -1;
-	}
-	else {
-		/* Place the call, but don't wait on the answer */
-		res = ast_call(tmp->chan, location, 0);
-	}
-	ao2_unlock(tmp->member);
-	if (res) {
+	/* Place the call, but don't wait on the answer */
+	if ((res = ast_call(tmp->chan, location, 0))) {
 		/* Again, keep going even if there's an error */
 		ast_verb(3, "Couldn't call %s\n", tmp->interface);
 		do_hang(tmp);

Modified: branches/10-digiumphones/apps/confbridge/conf_state.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/confbridge/conf_state.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/confbridge/conf_state.c (original)
+++ branches/10-digiumphones/apps/confbridge/conf_state.c Tue Jan  8 13:12:38 2013
@@ -47,9 +47,28 @@
 	ast_log(LOG_ERROR, "Invalid event for confbridge user '%s'\n", cbu->u_profile.name);
 }
 
+/*!
+ * \internal
+ * \brief Mute the user and play MOH if the user requires it.
+ *
+ * \param user Conference user to mute and optionally start MOH on.
+ *
+ * \return Nothing
+ */
+static void conf_mute_moh_inactive_waitmarked(struct conference_bridge_user *user)
+{
+	/* Be sure we are muted so we can't talk to anybody else waiting */
+	user->features.mute = 1;
+	/* Start music on hold if needed */
+	if (ast_test_flag(&user->u_profile, USER_OPT_MUSICONHOLD)) {
+		conf_moh_start(user);
+	}
+}
+
 void conf_default_join_waitmarked(struct conference_bridge_user *cbu)
 {
 	conf_add_user_waiting(cbu->conference_bridge, cbu);
+	conf_mute_moh_inactive_waitmarked(cbu);
 	conf_add_post_join_action(cbu, conf_handle_inactive_waitmarked);
 }
 

Modified: branches/10-digiumphones/apps/confbridge/conf_state_empty.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/confbridge/conf_state_empty.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/confbridge/conf_state_empty.c (original)
+++ branches/10-digiumphones/apps/confbridge/conf_state_empty.c Tue Jan  8 13:12:38 2013
@@ -81,6 +81,6 @@
 static void transition_to_empty(struct conference_bridge_user *cbu)
 {
 	/* Set device state to "not in use" */
-	ast_devstate_changed(AST_DEVICE_NOT_INUSE, "confbridge:%s", cbu->conference_bridge->name);
+	ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "confbridge:%s", cbu->conference_bridge->name);
 	conf_ended(cbu->conference_bridge);
 }

Modified: branches/10-digiumphones/apps/confbridge/conf_state_multi_marked.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/confbridge/conf_state_multi_marked.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/confbridge/conf_state_multi_marked.c (original)
+++ branches/10-digiumphones/apps/confbridge/conf_state_multi_marked.c Tue Jan  8 13:12:38 2013
@@ -107,12 +107,8 @@
 				cbu_iter->conference_bridge->waitingusers++;
 				/* Handle muting/moh of cbu_iter if necessary */
 				if (ast_test_flag(&cbu_iter->u_profile, USER_OPT_MUSICONHOLD)) {
-				   cbu_iter->features.mute = 1;
-					if (!ast_bridge_suspend(cbu_iter->conference_bridge->bridge, cbu_iter->chan)) {
-						ast_moh_start(cbu_iter->chan, cbu_iter->u_profile.moh_class, NULL);
-						cbu_iter->playing_moh = 1;
-						ast_bridge_unsuspend(cbu_iter->conference_bridge->bridge, cbu_iter->chan);
-					}
+					cbu_iter->features.mute = 1;
+					conf_moh_start(cbu_iter);
 				}
 			}
 		}
@@ -173,10 +169,8 @@
 		cbu->conference_bridge->waitingusers--;
 		AST_LIST_INSERT_TAIL(&cbu->conference_bridge->active_list, cbu_iter, list);
 		cbu->conference_bridge->activeusers++;
-		if (cbu_iter->playing_moh && !ast_bridge_suspend(cbu->conference_bridge->bridge, cbu_iter->chan)) {
-			cbu_iter->playing_moh = 0;
-			ast_moh_stop(cbu_iter->chan);
-			ast_bridge_unsuspend(cbu->conference_bridge->bridge, cbu_iter->chan);
+		if (cbu_iter->playing_moh) {
+			conf_moh_stop(cbu_iter);
 		}
 		/* only unmute them if they are not supposed to start muted */
 		if (!ast_test_flag(&cbu_iter->u_profile, USER_OPT_STARTMUTED)) {

Modified: branches/10-digiumphones/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/confbridge/include/confbridge.h?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/apps/confbridge/include/confbridge.h (original)
+++ branches/10-digiumphones/apps/confbridge/include/confbridge.h Tue Jan  8 13:12:38 2013
@@ -231,6 +231,7 @@
 	struct ast_channel *chan;                    /*!< Asterisk channel participating */
 	struct ast_bridge_features features;         /*!< Bridge features structure */
 	struct ast_bridge_tech_optimizations tech_args; /*!< Bridge technology optimizations for talk detection */
+	unsigned int suspended_moh;                  /*!< Count of active suspended MOH actions. */
 	unsigned int kicked:1;                       /*!< User has been kicked from the conference */
 	unsigned int playing_moh:1;                  /*!< MOH is currently being played to the user */
 	AST_LIST_HEAD_NOLOCK(, post_join_action) post_join_list; /*!< List of sounds to play after joining */;
@@ -353,6 +354,24 @@
  */
 void conf_ended(struct conference_bridge *conference_bridge);
 
+/*!
+ * \brief Stop MOH for the conference user.
+ *
+ * \param user Conference user to stop MOH on.
+ *
+ * \return Nothing
+ */
+void conf_moh_stop(struct conference_bridge_user *user);
+
+/*!
+ * \brief Start MOH for the conference user.
+ *
+ * \param user Conference user to start MOH on.
+ *
+ * \return Nothing
+ */
+void conf_moh_start(struct conference_bridge_user *user);
+
 /*! \brief Attempt to mute/play MOH to the only user in the conference if they require it
  * \param conference_bridge A conference bridge containing a single user
  */

Modified: branches/10-digiumphones/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/channels/chan_agent.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/channels/chan_agent.c (original)
+++ branches/10-digiumphones/channels/chan_agent.c Tue Jan  8 13:12:38 2013
@@ -617,7 +617,7 @@
 		if (p->chan) {
 			p->chan->_bridge = NULL;
 			p->chan = NULL;
-			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
+			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 			p->acknowledged = 0;
 		}
 	} else {
@@ -875,7 +875,7 @@
 	} else {
 		/* Agent hung-up */
 		p->chan = NULL;
-		ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
+		ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 	}
 
 	if (!res) {
@@ -995,7 +995,7 @@
 	if (!p->loginstart) {
 		p->logincallerid[0] = '\0';
 	} else {
-		ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
+		ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 	}
 
 	if (p->abouttograb) {
@@ -2143,7 +2143,7 @@
 						}
 						ast_mutex_unlock(&p->lock);
 						AST_LIST_UNLOCK(&agents);
-						ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
+						ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 						while (res >= 0) {
 							ast_mutex_lock(&p->lock);
 							if (p->deferlogoff && p->chan) {
@@ -2164,7 +2164,7 @@
 								if (ast_tvdiff_ms(ast_tvnow(), p->lastdisc) > 0) {
 									ast_debug(1, "Wrapup time for %s expired!\n", p->agent);
 									p->lastdisc = ast_tv(0, 0);
-									ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Agent/%s", p->agent);
+									ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 									if (p->ackcall) {
 										check_beep(p, 0);
 									} else {
@@ -2224,7 +2224,7 @@
 						ast_queue_log("NONE", chan->uniqueid, agent, "AGENTLOGOFF", "%s|%ld", chan->name, logintime);
 						ast_verb(2, "Agent '%s' logged out\n", p->agent);
 						/* If there is no owner, go ahead and kill it now */
-						ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
+						ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "Agent/%s", p->agent);
 						if (p->dead && !p->owner) {
 							ast_mutex_destroy(&p->lock);
 							ast_cond_destroy(&p->app_complete_cond);

Modified: branches/10-digiumphones/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/channels/chan_dahdi.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/channels/chan_dahdi.c (original)
+++ branches/10-digiumphones/channels/chan_dahdi.c Tue Jan  8 13:12:38 2013
@@ -3401,7 +3401,7 @@
 	}
 	if (pri->congestion_devstate != new_state) {
 		pri->congestion_devstate = new_state;
-		ast_devstate_changed(AST_DEVICE_UNKNOWN, "DAHDI/I%d/congestion", pri->span);
+		ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_NOT_CACHABLE, "DAHDI/I%d/congestion", pri->span);
 	}
 #if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
 	/* Update the span threshold device state and report any change. */
@@ -3417,7 +3417,7 @@
 	}
 	if (pri->threshold_devstate != new_state) {
 		pri->threshold_devstate = new_state;
-		ast_devstate_changed(AST_DEVICE_UNKNOWN, "DAHDI/I%d/threshold", pri->span);
+		ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_NOT_CACHABLE, "DAHDI/I%d/threshold", pri->span);
 	}
 #endif	/* defined(THRESHOLD_DEVSTATE_PLACEHOLDER) */
 }
@@ -9888,7 +9888,8 @@
 	if (dashptr) {
 		*dashptr = '\0';
 	}
-	ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, device_name);
+	tmp->flags |= AST_FLAG_DISABLE_DEVSTATE_CACHE;
+	ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, AST_DEVSTATE_NOT_CACHABLE, device_name);
 
 	for (v = i->vars ; v ; v = v->next)
 		pbx_builtin_setvar_helper(tmp, v->name, v->value);

Modified: branches/10-digiumphones/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/channels/chan_iax2.c?view=diff&rev=378661&r1=378660&r2=378661
==============================================================================
--- branches/10-digiumphones/channels/chan_iax2.c (original)
+++ branches/10-digiumphones/channels/chan_iax2.c Tue Jan  8 13:12:38 2013
@@ -5825,7 +5825,7 @@
 }
 
 /*! \brief  Create new call, interface with the PBX core */
-static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capability, const char *linkedid)
+static struct ast_channel *ast_iax2_new(int callno, int state, iax2_format capability, const char *linkedid, unsigned int cachable)
 {
 	struct ast_channel *tmp;
 	struct chan_iax2_pvt *i;
@@ -5899,6 +5899,10 @@
 		tmp->adsicpe = AST_ADSI_UNAVAILABLE;
 	i->owner = tmp;
 	i->capability = capability;
+
+	if (!cachable) {
+		tmp->flags |= AST_FLAG_DISABLE_DEVSTATE_CACHE;
+	}
 
 	/* Set inherited variables */
 	if (i->vars) {
@@ -8188,7 +8192,7 @@
 		/* if challenge has been sent, but no challenge response if given, reject. */
 		goto return_unref;
 	}
-	ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
+	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "IAX2/%s", p->name); /* Activate notification */
 
 	/* either Authentication has taken place, or a REGAUTH must be sent before verifying registration */
 	res = 0;
@@ -8742,7 +8746,7 @@
 	if (!ast_test_flag64(peer, IAX_TEMPONLY))
 		ast_db_del("IAX/Registry", peer->name);
 	register_peer_exten(peer, 0);
-	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", peer->name); /* Activate notification */
+	ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "IAX2/%s", peer->name); /* Activate notification */
 	if (iax2_regfunk)
 		iax2_regfunk(peer->name, 0);
 
@@ -8797,7 +8801,7 @@
 		}
 	}
 
-	ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
+	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "IAX2/%s", p->name); /* Activate notification */
 
 	p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, peer_ref(p));
 	if (p->expire == -1) {
@@ -8874,14 +8878,14 @@
 					    ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
 			manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\nPost: %d\r\nPort: %d\r\n", p->name, ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port), ntohs(sin->sin_port));
 			register_peer_exten(p, 1);
-			ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
+			ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "IAX2/%s", p->name); /* Activate notification */
 		} else if (!ast_test_flag64(p, IAX_TEMPONLY)) {
 			ast_verb(3, "Unregistered IAX2 '%s' (%s)\n", p->name,
 					    ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED");
 			manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unregistered\r\n", p->name);
 			register_peer_exten(p, 0);
 			ast_db_del("IAX/Registry", p->name);
-			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", p->name); /* Activate notification */
+			ast_devstate_changed(AST_DEVICE_UNAVAILABLE, AST_DEVSTATE_CACHABLE, "IAX2/%s", p->name); /* Activate notification */
 		}
 		/* Update the host */
 		/* Verify that the host is really there */
@@ -10397,7 +10401,8 @@
 		    (f.frametype == AST_FRAME_IAX)) {
 			if (ast_test_flag64(iaxs[fr->callno], IAX_DELAYPBXSTART)) {
 				ast_clear_flag64(iaxs[fr->callno], IAX_DELAYPBXSTART);
-				if (!ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->chosenformat, NULL)) {
+				if (!ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->chosenformat, NULL,
+						  ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED))) {
 					ast_variables_destroy(ies.vars);
 					ast_mutex_unlock(&iaxsl[fr->callno]);
 					return 1;
@@ -11036,13 +11041,13 @@
 						if (iaxs[fr->callno]->pingtime <= peer->maxms) {
 							ast_log(LOG_NOTICE, "Peer '%s' is now REACHABLE! Time: %d\n", peer->name, iaxs[fr->callno]->pingtime);

[... 1643 lines stripped ...]



More information about the asterisk-commits mailing list