diff options
author | Jeff Peeler <jpeeler@digium.com> | 2010-01-18 22:31:25 +0000 |
---|---|---|
committer | Jeff Peeler <jpeeler@digium.com> | 2010-01-18 22:31:25 +0000 |
commit | 568c057c4c03452c86aa70dc4593accee963745f (patch) | |
tree | 07b772f4a93f6e959ccf10510fee364dd143f4f6 /main | |
parent | bbd290308f67cdaaf3a7cc80b40f09cbe104a112 (diff) |
Extend max call limit duration from 24.8 days to 292+ million years.
If the limit was set past MAX_INT upon answering, the call was immediately
hung up due to overflow from the return of ast_tvdiff_ms (in ast_check_hangup).
The time calculation functions ast_tvdiff_sec and ast_tvdiff_ms have been
changed to return an int64_t to prevent overflow. Also the reporter suggested
adding a message indicating the reason for the call hanging up. Given that the
new limit is so much higher, the message (which would only really be useful in
the overflow scenario) has been made a debug message only.
(closes issue #16006)
Reported by: viraptor
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@241143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 1 | ||||
-rw-r--r-- | main/enum.c | 2 | ||||
-rw-r--r-- | main/features.c | 8 | ||||
-rw-r--r-- | main/timing.c | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/main/channel.c b/main/channel.c index 657b05353..0f39510b3 100644 --- a/main/channel.c +++ b/main/channel.c @@ -479,6 +479,7 @@ int ast_check_hangup(struct ast_channel *chan) return 0; if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */ return 0; + ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow())); chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */ return 1; } diff --git a/main/enum.c b/main/enum.c index 416bb9072..1d65152df 100644 --- a/main/enum.c +++ b/main/enum.c @@ -851,7 +851,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds ret = ast_search_dns(context, tmp, C_IN, T_NAPTR, enum_callback); time_end = ast_tvnow(); - ast_verb(2, "ast_get_enum() profiling: %s, %s, %d ms\n", + ast_verb(2, "ast_get_enum() profiling: %s, %s, %" PRIi64 " ms\n", (ret == 0) ? "OK" : "FAIL", tmp, ast_tvdiff_ms(time_end, time_start)); if (ret < 0) { diff --git a/main/features.c b/main/features.c index 3e8255de6..36c90dadb 100644 --- a/main/features.c +++ b/main/features.c @@ -4923,12 +4923,12 @@ int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *con config->timelimit = play_to_caller = play_to_callee = config->play_warning = config->warning_freq = 0; } else { - ast_verb(3, "Limit Data for this call:\n"); - ast_verb(4, "timelimit = %ld\n", config->timelimit); - ast_verb(4, "play_warning = %ld\n", config->play_warning); + ast_verb(4, "Limit Data for this call:\n"); + ast_verb(4, "timelimit = %ld ms (%.3lf s)\n", config->timelimit, config->timelimit / 1000.0); + ast_verb(4, "play_warning = %ld ms (%.3lf s)\n", config->play_warning, config->play_warning / 1000.0); ast_verb(4, "play_to_caller = %s\n", play_to_caller ? "yes" : "no"); ast_verb(4, "play_to_callee = %s\n", play_to_callee ? "yes" : "no"); - ast_verb(4, "warning_freq = %ld\n", config->warning_freq); + ast_verb(4, "warning_freq = %ld ms (%.3lf s)\n", config->warning_freq, config->warning_freq / 1000.0); ast_verb(4, "start_sound = %s\n", S_OR(config->start_sound, "")); ast_verb(4, "warning_sound = %s\n", config->warning_sound); ast_verb(4, "end_sound = %s\n", S_OR(config->end_sound, "")); diff --git a/main/timing.c b/main/timing.c index 751008ecf..d15024b32 100644 --- a/main/timing.c +++ b/main/timing.c @@ -270,7 +270,7 @@ static char *timing_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args * ast_timer_close(timer); - ast_cli(a->fd, "It has been %d milliseconds, and we got %d timer ticks\n", + ast_cli(a->fd, "It has been %" PRIi64 " milliseconds, and we got %d timer ticks\n", ast_tvdiff_ms(end, start), count); return CLI_SUCCESS; |