[asterisk-commits] rmudgett: trunk r288081 - in /trunk: ./ apps/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 21 15:33:24 CDT 2010
Author: rmudgett
Date: Tue Sep 21 15:33:20 2010
New Revision: 288081
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=288081
Log:
Merged revisions 288079-288080 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r288079 | rmudgett | 2010-09-21 15:29:51 -0500 (Tue, 21 Sep 2010) | 2 lines
Protect channel access in CONNECTED_LINE and REDIRECTING interception macro launch code.
........
r288080 | rmudgett | 2010-09-21 15:29:59 -0500 (Tue, 21 Sep 2010) | 8 lines
Simplify locking code for REDIRECTING interception macro when forwarding a call.
Simplified the locking code by using a local copy of the redirecting party
information in app_dial.c:do_forward() and app_queue.c:wait_for_answer()
for launching the REDIRECTING interception macro when a call is forwarded.
Reduced the lock time of the 'o->chan' and 'in' channels.
........
Modified:
trunk/ (props changed)
trunk/apps/app_dial.c
trunk/apps/app_queue.c
trunk/main/channel.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=288081&r1=288080&r2=288081
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Sep 21 15:33:20 2010
@@ -852,6 +852,8 @@
handle_cause(cause, num);
ast_hangup(original);
} else {
+ struct ast_party_redirecting redirecting;
+
if (single && CAN_EARLY_BRIDGE(peerflags, c, in)) {
ast_rtp_instance_early_bridge_make_compatible(c, in);
}
@@ -895,21 +897,19 @@
* deadlock. This is why the handling of c's lock may seem a bit unusual
* here.
*/
+ ast_party_redirecting_init(&redirecting);
+ ast_party_redirecting_copy(&redirecting, &c->redirecting);
ast_channel_unlock(c);
- if (ast_channel_redirecting_macro(c, in, &c->redirecting, 1, 0)) {
- while (ast_channel_trylock(c)) {
- CHANNEL_DEADLOCK_AVOIDANCE(in);
- }
- ast_channel_update_redirecting(in, &c->redirecting, NULL);
- ast_channel_unlock(c);
- }
+ if (ast_channel_redirecting_macro(c, in, &redirecting, 1, 0)) {
+ ast_channel_update_redirecting(in, &redirecting, NULL);
+ }
+ ast_party_redirecting_free(&redirecting);
+ ast_channel_unlock(in);
ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE);
if (ast_test_flag64(peerflags, OPT_CANCEL_TIMEOUT)) {
*to = -1;
}
-
- ast_channel_unlock(in);
if (ast_call(c, stuff, 0)) {
ast_log(LOG_NOTICE, "Forwarding failed to dial '%s/%s'\n",
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=288081&r1=288080&r2=288081
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Sep 21 15:33:20 2010
@@ -3414,6 +3414,8 @@
o->stillgoing = 0;
numnochan++;
} else {
+ struct ast_party_redirecting redirecting;
+
ast_channel_lock(o->chan);
while (ast_channel_trylock(in)) {
CHANNEL_DEADLOCK_AVOIDANCE(o->chan);
@@ -3449,27 +3451,24 @@
* deadlock. This is why the handling of o->chan's lock may
* seem a bit unusual here.
*/
+ ast_party_redirecting_init(&redirecting);
+ ast_party_redirecting_copy(&redirecting, &o->chan->redirecting);
ast_channel_unlock(o->chan);
- res = ast_channel_redirecting_macro(o->chan, in, &o->chan->redirecting, 1, 0);
- while (ast_channel_trylock(o->chan)) {
- CHANNEL_DEADLOCK_AVOIDANCE(in);
+ res = ast_channel_redirecting_macro(o->chan, in, &redirecting, 1, 0);
+ if (res) {
+ ast_channel_update_redirecting(in, &redirecting, NULL);
}
- if (res) {
- ast_channel_update_redirecting(in, &o->chan->redirecting, NULL);
- }
+ ast_party_redirecting_free(&redirecting);
+ ast_channel_unlock(in);
update_connectedline = 1;
if (ast_call(o->chan, stuff, 0)) {
ast_log(LOG_NOTICE, "Forwarding failed to dial '%s/%s'\n",
tech, stuff);
- ast_channel_unlock(o->chan);
do_hang(o);
numnochan++;
- } else {
- ast_channel_unlock(o->chan);
}
- ast_channel_unlock(in);
}
/* Hangup the original channel now, in case we needed it */
ast_hangup(winner);
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=288081&r1=288080&r2=288081
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Sep 21 15:33:20 2010
@@ -8775,9 +8775,9 @@
macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
macro_args = ast_strdupa(S_OR(macro_args, ""));
- ast_channel_unlock(macro_chan);
if (ast_strlen_zero(macro)) {
+ ast_channel_unlock(macro_chan);
return -1;
}
@@ -8790,9 +8790,12 @@
ast_party_connected_line_copy(¯o_chan->connected, connected);
}
+ ast_channel_unlock(macro_chan);
if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) {
+ ast_channel_lock(macro_chan);
ast_channel_update_connected_line(macro_chan, ¯o_chan->connected, NULL);
+ ast_channel_unlock(macro_chan);
}
return retval;
@@ -8811,9 +8814,9 @@
macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
? "REDIRECTING_CALLER_SEND_MACRO_ARGS" : "REDIRECTING_CALLEE_SEND_MACRO_ARGS");
macro_args = ast_strdupa(S_OR(macro_args, ""));
- ast_channel_unlock(macro_chan);
if (ast_strlen_zero(macro)) {
+ ast_channel_unlock(macro_chan);
return -1;
}
@@ -8826,10 +8829,13 @@
ast_party_redirecting_copy(¯o_chan->redirecting, redirecting);
}
+ ast_channel_unlock(macro_chan);
retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
if (!retval) {
+ ast_channel_lock(macro_chan);
ast_channel_update_redirecting(macro_chan, ¯o_chan->redirecting, NULL);
+ ast_channel_unlock(macro_chan);
}
return retval;
More information about the asterisk-commits
mailing list