[asterisk-commits] jrose: trunk r393815 - in /trunk: main/ res/parking/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 8 10:59:55 CDT 2013


Author: jrose
Date: Mon Jul  8 10:59:47 2013
New Revision: 393815

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393815
Log:
res_parking: Apply ringing role option on swap with a channel that rings

(closes issue ASTERISK-21877)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2648/

Modified:
    trunk/main/bridging.c
    trunk/res/parking/parking_bridge.c
    trunk/res/parking/parking_controller.c
    trunk/res/parking/res_parking.h

Modified: trunk/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridging.c?view=diff&rev=393815&r1=393814&r2=393815
==============================================================================
--- trunk/main/bridging.c (original)
+++ trunk/main/bridging.c Mon Jul  8 10:59:47 2013
@@ -1015,7 +1015,9 @@
 	 * playing the announcment.
 	 *
 	 * XXX We have no idea what MOH class was in use before playing
-	 * the file.
+	 * the file. This method also fails to restore ringing indications.
+	 * the proposed solution is to create a resume_entertainment callback
+	 * for the bridge technology and execute it here.
 	 */
 	if (ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_MOH)) {
 		ast_moh_start(bridge_channel->chan, NULL, NULL);

Modified: trunk/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/parking/parking_bridge.c?view=diff&rev=393815&r1=393814&r2=393815
==============================================================================
--- trunk/res/parking/parking_bridge.c (original)
+++ trunk/res/parking/parking_bridge.c Mon Jul  8 10:59:47 2013
@@ -219,6 +219,7 @@
 	}
 
 	if (swap) {
+		int use_ringing = 0;
 		ao2_lock(swap);
 		pu = swap->bridge_pvt;
 		if (!pu) {
@@ -236,15 +237,21 @@
 
 		/* TODO Add a parked call swap message type to relay information about parked channel swaps */
 
+		if (ast_bridge_channel_has_role(swap, "holding_participant")) {
+			const char *idle_mode = ast_bridge_channel_get_role_option(swap, "holding_participant", "idle_mode");
+			if (!ast_strlen_zero(idle_mode) && !strcmp(idle_mode, "ringing")) {
+				use_ringing = 1;
+			}
+		}
+
 		ao2_unlock(swap);
 
 		parking_set_duration(bridge_channel->features, pu);
 
-		/* BUGBUG Adding back local channel swapping made us not hear music on hold for the channel that got swapped
-		 * into the parking lot. Setting the roels back up gets around that, but we still need to deal with the ringing option
-		 * to the park application here somehow.
-		 */
-		parking_channel_set_roles(bridge_channel->chan, self->lot, 0);
+		if (parking_channel_set_roles(bridge_channel->chan, self->lot, use_ringing)) {
+			ast_log(LOG_WARNING, "Failed to apply holding bridge roles to %s while joining the parking lot.\n",
+				ast_channel_name(bridge_channel->chan));
+		}
 
 		return 0;
 	}

Modified: trunk/res/parking/parking_controller.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/parking/parking_controller.c?view=diff&rev=393815&r1=393814&r2=393815
==============================================================================
--- trunk/res/parking/parking_controller.c (original)
+++ trunk/res/parking/parking_controller.c Mon Jul  8 10:59:47 2013
@@ -54,17 +54,28 @@
 	return lot_bridge;
 }
 
-void parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing)
-{
-	ast_channel_add_bridge_role(chan, "holding_participant");
+int parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing)
+{
+	if (ast_channel_add_bridge_role(chan, "holding_participant")) {
+		return -1;
+	}
+
 	if (force_ringing) {
-		ast_channel_set_bridge_role_option(chan, "holding_participant", "idle_mode", "ringing");
+		if (ast_channel_set_bridge_role_option(chan, "holding_participant", "idle_mode", "ringing")) {
+			return -1;
+		}
 	} else {
-		ast_channel_set_bridge_role_option(chan, "holding_participant", "idle_mode", "musiconhold");
+		if (ast_channel_set_bridge_role_option(chan, "holding_participant", "idle_mode", "musiconhold")) {
+			return -1;
+		}
 		if (!ast_strlen_zero(lot->cfg->mohclass)) {
-			ast_channel_set_bridge_role_option(chan, "holding_participant", "moh_class", lot->cfg->mohclass);
-		}
-	}
+			if (ast_channel_set_bridge_role_option(chan, "holding_participant", "moh_class", lot->cfg->mohclass)) {
+				return -1;
+			}
+		}
+	}
+
+	return 0;
 }
 
 struct parking_limits_pvt {

Modified: trunk/res/parking/res_parking.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/parking/res_parking.h?view=diff&rev=393815&r1=393814&r2=393815
==============================================================================
--- trunk/res/parking/res_parking.h (original)
+++ trunk/res/parking/res_parking.h Mon Jul  8 10:59:47 2013
@@ -214,8 +214,11 @@
  * \param chan Entering channel
  * \param lot The parking lot the channel will be entering
  * \param force_ringing Use ringing instead of music on hold
- */
-void parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing);
+ *
+ * \retval 0 on success
+ * \retval non-zero on failure
+ */
+int parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing);
 
 /*!
  * \since 12.0.0




More information about the asterisk-commits mailing list