MT#55283 scale offer-timeout

Change-Id: I35419b378eaef025ec32dce616fdd046d3e05c8e
pull/1938/head
Richard Fuchs 8 months ago
parent d3dc92aca9
commit 482166f0dc

@ -243,7 +243,7 @@ no_sfd:
tmp_t_reason = SILENT_TIMEOUT;
}
else if (!PS_ISSET(ps, FILLED)) {
check = atomic_get_na(&rtpe_config.offer_timeout) * 1000000LL; // XXX scale to micro
check = atomic_get_na(&rtpe_config.offer_timeout_us);
tmp_t_reason = OFFER_TIMEOUT;
}

@ -660,7 +660,7 @@ static void cli_incoming_list_finaltimeout(str *instr, struct cli_writer *cw, co
cw->cw_printf(cw, "FINAL_TIMEOUT=%" PRId64 "\n", rtpe_config.final_timeout_us / 1000000L);
}
static void cli_incoming_list_offertimeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {
cw->cw_printf(cw, "OFFER_TIMEOUT=%u\n", rtpe_config.offer_timeout);
cw->cw_printf(cw, "OFFER_TIMEOUT=%" PRId64 "\n", rtpe_config.offer_timeout_us / 1000000L);
}
static void cli_incoming_list_callid(str *instr, struct cli_writer *cw) {
@ -1029,30 +1029,6 @@ static void cli_incoming_set_maxbw(str *instr, struct cli_writer *cw, const cli_
return;
}
static void cli_incoming_set_gentimeout(str *instr, struct cli_writer *cw, int *conf_timeout) {
long timeout_num;
char *endptr;
if (instr->len == 0) {
cw->cw_printf(cw, "More parameters required.\n");
return;
}
errno = 0;
timeout_num = strtol(instr->s, &endptr, 10);
if ((errno == ERANGE && (timeout_num == ULONG_MAX)) || (errno != 0 && timeout_num == 0) || timeout_num < 0 || timeout_num >= INT_MAX) {
cw->cw_printf(cw, "Fail setting timeout to %s; errno=%d\n", instr->s, errno);
return;
} else if (endptr == instr->s) {
cw->cw_printf(cw, "Fail setting timeout to %s; no digits found\n", instr->s);
return;
} else {
atomic_set_na(conf_timeout, timeout_num);
cw->cw_printf(cw, "Success setting timeout to %lu\n", timeout_num);
}
}
static void cli_incoming_set_gentimeout_us(str *instr, struct cli_writer *cw, int64_t *conf_timeout) {
long timeout_num;
char *endptr;
@ -1087,7 +1063,7 @@ static void cli_incoming_set_finaltimeout(str *instr, struct cli_writer *cw, con
cli_incoming_set_gentimeout_us(instr, cw, &rtpe_config.final_timeout_us);
}
static void cli_incoming_set_offertimeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {
cli_incoming_set_gentimeout(instr, cw, &rtpe_config.offer_timeout);
cli_incoming_set_gentimeout_us(instr, cw, &rtpe_config.offer_timeout_us);
}
static void cli_generic_handler(str *instr, struct cli_writer *cw, const cli_handler_t *handler) {

@ -675,6 +675,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
int silent_timeout = 0;
int timeout = 0;
int final_timeout = 0;
int offer_timeout = 0;
GOptionEntry e[] = {
{ "table", 't', 0, G_OPTION_ARG_INT, &rtpe_config.kernel_table, "Kernel table to use", "INT" },
@ -708,7 +709,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
{ "timeout", 'o', 0, G_OPTION_ARG_INT, &timeout, "RTP timeout", "SECS" },
{ "silent-timeout",'s',0,G_OPTION_ARG_INT, &silent_timeout, "RTP timeout for muted", "SECS" },
{ "final-timeout",'a',0,G_OPTION_ARG_INT, &final_timeout, "Call timeout", "SECS" },
{ "offer-timeout",0,0, G_OPTION_ARG_INT, &rtpe_config.offer_timeout, "Timeout for incomplete one-sided calls", "SECS" },
{ "offer-timeout",0,0, G_OPTION_ARG_INT, &offer_timeout, "Timeout for incomplete one-sided calls", "SECS" },
{ "port-min", 'm', 0, G_OPTION_ARG_INT, &rtpe_config.port_min, "Lowest port to use for RTP", "INT" },
{ "port-max", 'M', 0, G_OPTION_ARG_INT, &rtpe_config.port_max, "Highest port to use for RTP", "INT" },
{ "redis", 'r', 0, G_OPTION_ARG_STRING, &redisps, "Connect to Redis database", "[PW@]IP:PORT/INT" },
@ -1082,8 +1083,9 @@ static void options(int *argc, char ***argv, charp_ht templates) {
if (rtpe_config.silent_timeout_us <= 0)
rtpe_config.silent_timeout_us = 3600 * 1000000LL;
if (rtpe_config.offer_timeout <= 0)
rtpe_config.offer_timeout = 3600;
rtpe_config.offer_timeout_us = offer_timeout * 1000000LL;
if (rtpe_config.offer_timeout_us <= 0)
rtpe_config.offer_timeout_us = 3600 * 1000000LL;
rtpe_config.final_timeout_us = final_timeout * 1000000LL;
if (rtpe_config.final_timeout_us <= 0)

@ -36,7 +36,6 @@ enum endpoint_learning {
#define RTPE_CONFIG_INT_PARAMS \
X(kernel_table) \
X(max_sessions) \
X(offer_timeout) \
X(moh_max_duration) \
X(moh_max_repeats) \
X(delete_delay) \
@ -106,6 +105,7 @@ enum endpoint_learning {
X(silent_timeout_us) \
X(timeout_us) \
X(final_timeout_us) \
X(offer_timeout_us) \
#define RTPE_CONFIG_BOOL_PARAMS \
X(homer_rtcp_off) \

Loading…
Cancel
Save