[asterisk-commits] rmudgett: trunk r411639 - in /trunk: ./ res/parking/parking_bridge.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 1 17:42:26 CDT 2014


Author: rmudgett
Date: Tue Apr  1 17:42:23 2014
New Revision: 411639

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411639
Log:
res_parking: Minor tweaks.

* Use ast_bridge_channel_lock()/ast_bridge_channel_unlock() instead of
ao2_lock()/ao2_unlock() for struct ast_bridge_channel variables.

* Use ast_copy_string() instead of inlining it.

* Remove an already done TODO comment.

* Some whitespace tweaks.
........

Merged revisions 411638 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/parking/parking_bridge.c

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

Modified: trunk/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/parking/parking_bridge.c?view=diff&rev=411639&r1=411638&r2=411639
==============================================================================
--- trunk/res/parking/parking_bridge.c (original)
+++ trunk/res/parking/parking_bridge.c Tue Apr  1 17:42:23 2014
@@ -221,13 +221,14 @@
 
 	if (swap) {
 		int use_ringing = 0;
-		ao2_lock(swap);
+
+		ast_bridge_channel_lock(swap);
 		pu = swap->bridge_pvt;
 		if (!pu) {
 			/* This should be impossible since the only way a channel can enter in the first place
 			 * is if it has a parked user associated with it */
 			publish_parked_call_failure(bridge_channel->chan);
-			ao2_unlock(swap);
+			ast_bridge_channel_unlock(swap);
 			return -1;
 		}
 
@@ -236,16 +237,15 @@
 		bridge_channel->bridge_pvt = pu;
 		swap->bridge_pvt = NULL;
 
-		/* 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);
+		ast_bridge_channel_unlock(swap);
 
 		parking_set_duration(bridge_channel->features, pu);
 
@@ -278,6 +278,7 @@
 
 	if (parker == bridge_channel->chan) {
 		struct ast_channel *real_parker = ast_channel_get_by_name(blind_transfer);
+
 		if (real_parker) {
 			ao2_cleanup(parker);
 			parker = real_parker;
@@ -286,7 +287,6 @@
 
 	pu = generate_parked_user(self->lot, bridge_channel->chan, parker,
 		park_datastore->parker_dial_string, park_datastore->randomize, park_datastore->time_limit);
-
 	if (!pu) {
 		publish_parked_call_failure(bridge_channel->chan);
 		return -1;
@@ -294,8 +294,7 @@
 
 	/* If a comeback_override was provided, set it for the parked user's comeback string. */
 	if (park_datastore->comeback_override) {
-		strncpy(pu->comeback, park_datastore->comeback_override, sizeof(pu->comeback));
-		pu->comeback[sizeof(pu->comeback) - 1] = '\0';
+		ast_copy_string(pu->comeback, park_datastore->comeback_override, sizeof(pu->comeback));
 	}
 
 	/* Generate ParkedCall Stasis Message */
@@ -304,6 +303,7 @@
 	/* If the parkee and the parker are the same and silence_announce isn't set, play the announcement to the parkee */
 	if (!strcmp(blind_transfer, ast_channel_name(bridge_channel->chan)) && !park_datastore->silence_announce) {
 		char saynum_buf[16];
+
 		snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 0, pu->parking_space);
 		ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
 	}
@@ -339,6 +339,7 @@
 static void bridge_parking_pull(struct ast_bridge_parking *self, struct ast_bridge_channel *bridge_channel)
 {
 	RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup);
+
 	ast_bridge_base_v_table.pull(&self->base, bridge_channel);
 
 	/* Take over the bridge channel's pu reference. It will be released when we are done. */




More information about the asterisk-commits mailing list