[asterisk-commits] russell: branch 1.6.1 r181430 - in /branches/1.6.1: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 11 17:16:15 CDT 2009


Author: russell
Date: Wed Mar 11 17:16:12 2009
New Revision: 181430

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181430
Log:
Merged revisions 181428 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r181428 | russell | 2009-03-11 17:14:55 -0500 (Wed, 11 Mar 2009) | 2 lines

Make handling of the BRIDGEPVTCALLID variable thread-safe.

........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/channel.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/main/channel.c?view=diff&rev=181430&r1=181429&r2=181430
==============================================================================
--- branches/1.6.1/main/channel.c (original)
+++ branches/1.6.1/main/channel.c Wed Mar 11 17:16:12 2009
@@ -4523,25 +4523,39 @@
 			S_OR(c1->cid.cid_num, ""));
 }
 
-static void update_bridgepeer(struct ast_channel *c0, struct ast_channel *c1)
+static void update_bridge_vars(struct ast_channel *c0, struct ast_channel *c1)
 {
 	const char *c0_name;
 	const char *c1_name;
+	const char *c0_pvtid = NULL;
+	const char *c1_pvtid = NULL;
 
 	ast_channel_lock(c1);
 	c1_name = ast_strdupa(c1->name);
+	if (c1->tech->get_pvt_uniqueid) {
+		c1_pvtid = ast_strdupa(c1->tech->get_pvt_uniqueid(c1));
+	}
 	ast_channel_unlock(c1);
 
 	ast_channel_lock(c0);
 	if (!ast_strlen_zero(pbx_builtin_getvar_helper(c0, "BRIDGEPEER"))) {
 		pbx_builtin_setvar_helper(c0, "BRIDGEPEER", c1_name);
 	}
+	if (c1_pvtid) {
+		pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1_pvtid);
+	}
 	c0_name = ast_strdupa(c0->name);
+	if (c0->tech->get_pvt_uniqueid) {
+		c0_pvtid = ast_strdupa(c0->tech->get_pvt_uniqueid(c0));
+	}
 	ast_channel_unlock(c0);
 
 	ast_channel_lock(c1);
 	if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER"))) {
 		pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0_name);
+	}
+	if (c0_pvtid) {
+		pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0_pvtid);
 	}
 	ast_channel_unlock(c1);
 }
@@ -4699,12 +4713,7 @@
 			break;
 		}
 
-		update_bridgepeer(c0, c1);
-
-		if (c0->tech->get_pvt_uniqueid)
-			pbx_builtin_setvar_helper(c1, "BRIDGEPVTCALLID", c0->tech->get_pvt_uniqueid(c0));
-		if (c1->tech->get_pvt_uniqueid)
-			pbx_builtin_setvar_helper(c0, "BRIDGEPVTCALLID", c1->tech->get_pvt_uniqueid(c1));
+		update_bridge_vars(c0, c1);
 
 		/* See if we need to play an audio file to any side of the bridge */
 		if ((bridge_play_sound = pbx_builtin_getvar_helper(c0, "BRIDGE_PLAY_SOUND"))) {
@@ -4774,7 +4783,7 @@
 			o1nativeformats = c1->nativeformats;
 		}
 
-		update_bridgepeer(c0, c1);
+		update_bridge_vars(c0, c1);
 
 		res = ast_generic_bridge(c0, c1, config, fo, rc, config->nexteventts);
 		if (res != AST_BRIDGE_RETRY) {




More information about the asterisk-commits mailing list