aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-23 21:17:23 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-03-23 21:17:23 +0000
commit52e75777f1ca69fc02aec87c709efad76b3204a8 (patch)
treedf50ca909117d962aa0fcf5252678ea774d9efda /main/channel.c
parent2c143e409d12d261d154313c40c5c0d101221c01 (diff)
Exit native bridging early for greater timing accuracy with warnings
This changes native bridging to break one millisecond early so that the more accurate timeval calculations done in the generic bridge can be performed using the bridge config. Currently the time between exiting native bridging slightly late can sometimes cause a large enough discrepancy for warnings to be missed. For the record, 1.4 does not attempt to native bridge at all when warnings are enabled. (closes issue #15815) Reported by: adomjan Review: https://reviewboard.asterisk.org/r/577/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@254050 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index 016453c24..191a4298f 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6058,14 +6058,17 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
bridge_play_sounds(c0, c1);
if (c0->tech->bridge &&
+ /* if < 1 ms remains use generic bridging for accurate timing */
+ (!config->timelimit || to > 1000 || to == 0) &&
(c0->tech->bridge == c1->tech->bridge) &&
!c0->monitor && !c1->monitor &&
- !c0->audiohooks && !c1->audiohooks &&
+ !c0->audiohooks && !c1->audiohooks &&
!c0->masq && !c0->masqr && !c1->masq && !c1->masqr) {
+ int timeoutms = to - 1000 > 0 ? to - 1000 : to;
/* Looks like they share a bridge method and nothing else is in the way */
ast_set_flag(c0, AST_FLAG_NBRIDGE);
ast_set_flag(c1, AST_FLAG_NBRIDGE);
- if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, to)) == AST_BRIDGE_COMPLETE) {
+ if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) {
ast_manager_event_multichan(EVENT_FLAG_CALL, "Unlink", 2, chans,
"Channel1: %s\r\n"
"Channel2: %s\r\n"