[asterisk-commits] russell: branch 1.6.1 r181474 - in /branches/1.6.1: ./ main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 11 17:27:46 CDT 2009
Author: russell
Date: Wed Mar 11 17:27:40 2009
New Revision: 181474
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=181474
Log:
Merged revisions 181465 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r181465 | russell | 2009-03-11 17:25:57 -0500 (Wed, 11 Mar 2009) | 2 lines
Make handling of the BRIDGE_PLAY_SOUND 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=181474&r1=181473&r2=181474
==============================================================================
--- branches/1.6.1/main/channel.c (original)
+++ branches/1.6.1/main/channel.c Wed Mar 11 17:27:40 2009
@@ -4560,6 +4560,33 @@
ast_channel_unlock(c1);
}
+static void bridge_play_sounds(struct ast_channel *c0, struct ast_channel *c1)
+{
+ const char *s, *sound;
+
+ /* See if we need to play an audio file to any side of the bridge */
+
+ ast_channel_lock(c0);
+ if ((s = pbx_builtin_getvar_helper(c0, "BRIDGE_PLAY_SOUND"))) {
+ sound = ast_strdupa(s);
+ ast_channel_unlock(c0);
+ bridge_playfile(c0, c1, sound, 0);
+ pbx_builtin_setvar_helper(c0, "BRIDGE_PLAY_SOUND", NULL);
+ } else {
+ ast_channel_unlock(c0);
+ }
+
+ ast_channel_lock(c1);
+ if ((s = pbx_builtin_getvar_helper(c1, "BRIDGE_PLAY_SOUND"))) {
+ sound = ast_strdupa(s);
+ ast_channel_unlock(c1);
+ bridge_playfile(c1, c0, sound, 0);
+ pbx_builtin_setvar_helper(c1, "BRIDGE_PLAY_SOUND", NULL);
+ } else {
+ ast_channel_unlock(c1);
+ }
+}
+
/*! \brief Bridge two channels together */
enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1,
struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc)
@@ -4637,7 +4664,6 @@
for (/* ever */;;) {
struct timeval now = { 0, };
int to;
- const char *bridge_play_sound = NULL;
to = -1;
@@ -4715,15 +4741,7 @@
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"))) {
- bridge_playfile(c0, c1, bridge_play_sound, 0);
- pbx_builtin_setvar_helper(c0, "BRIDGE_PLAY_SOUND", NULL);
- }
- if ((bridge_play_sound = pbx_builtin_getvar_helper(c1, "BRIDGE_PLAY_SOUND"))) {
- bridge_playfile(c1, c0, bridge_play_sound, 0);
- pbx_builtin_setvar_helper(c1, "BRIDGE_PLAY_SOUND", NULL);
- }
+ bridge_play_sounds(c0, c1);
if (c0->tech->bridge &&
(c0->tech->bridge == c1->tech->bridge) &&
More information about the asterisk-commits
mailing list