From a83c8caaf5d21694a29f02d8b85e4f0506edfeae Mon Sep 17 00:00:00 2001 From: markster Date: Sun, 12 Dec 2004 03:44:17 +0000 Subject: Make registertimeout be configurable (bug #2874) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4434 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 9 ++++++++- configs/sip.conf.sample | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index cb66c7e08..7bdb91b42 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -74,6 +74,7 @@ #define SIPDUMPER #define DEFAULT_DEFAULT_EXPIRY 120 #define DEFAULT_MAX_EXPIRY 3600 +#define DEFAULT_REGISTRATION_TIMEOUT 20 /* guard limit must be larger than guard secs */ /* guard min must be < 1000, and should be >= 250 */ @@ -154,6 +155,8 @@ static int global_trustrpid = 0; /* Trust RPID headers? Default off. */ static int global_progressinband = 0; +static int global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; + #ifdef OSP_SUPPORT static int global_ospauth = 0; /* OSP = Open Settlement Protocol */ #endif @@ -4160,7 +4163,7 @@ static int transmit_register(struct sip_registry *r, char *cmd, char *auth, char ast_log(LOG_WARNING, "Still have a timeout, %d\n", r->timeout); ast_sched_del(sched, r->timeout); } - r->timeout = ast_sched_add(sched, 20*1000, sip_reg_timeout, r); + r->timeout = ast_sched_add(sched, global_reg_timeout*1000, sip_reg_timeout, r); ast_log(LOG_DEBUG, "Scheduled a timeout # %d\n", r->timeout); } @@ -8809,6 +8812,10 @@ static int reload_config(void) default_expiry = atoi(v->value); if (default_expiry < 1) default_expiry = DEFAULT_DEFAULT_EXPIRY; + } else if (!strcasecmp(v->name, "registertimeout")){ + global_reg_timeout = atoi(v->value); + if (global_reg_timeout < 1) + global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; } else if (!strcasecmp(v->name, "bindaddr")) { if (!(hp = ast_gethostbyname(v->value, &ahp))) { ast_log(LOG_WARNING, "Invalid address: %s\n", v->value); diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index eb201d4c1..9db19b7d8 100755 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -121,6 +121,7 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; Tip 2: Use separate type=peer and type=user sections for SIP providers ; (instead of type=friend) if you have calls in both directions +;registertimeout=20 ; retry registration calls every 20 seconds (default) ;externip = 200.201.202.203 ; Address that we're going to put in outbound SIP messages ; if we're behind a NAT -- cgit v1.2.3