From 6b8d5b2b100946e2a23eacacbd88ae595097697d Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 9 Nov 2014 00:41:59 -0800 Subject: [PATCH] freetdm: Fix release guard timer check --- libs/freetdm/src/ftdm_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 099035409f..cbc04eb894 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1492,12 +1492,13 @@ static __inline__ int chan_is_avail(ftdm_channel_t *check) } /* release guard time check */ if (check->span->sig_release_guard_time_ms && check->last_release_time) { - ftdm_time_t time_diff = (check->last_release_time - ftdm_current_time_in_ms()); + ftdm_time_t time_diff = (ftdm_current_time_in_ms() - check->last_release_time); if (time_diff < check->span->sig_release_guard_time_ms) { return 0; } /* circuit now available for outbound dialing */ check->last_release_time = 0; + ftdm_log_chan(check, FTDM_LOG_DEBUG, "Channel is now available, release guard timer expired %zdms ago\n", (time_diff - check->span->sig_release_guard_time_ms)); } return 1; }