diff options
author | Mark Spencer <markster@digium.com> | 2005-10-12 05:43:21 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2005-10-12 05:43:21 +0000 |
commit | 522dfad1070a91a72d07b6f6997b5d7e0b3dc75e (patch) | |
tree | e7f82fcec59368b392df54832b21ac6b2e43ad50 /channels | |
parent | 4d9210f70553ae1ce56e95ee81bdca2035b003a7 (diff) |
Do *not* default to a max number of registration attempts
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 636f5e999..acf68fe6f 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -95,7 +95,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define DEFAULT_DEFAULT_EXPIRY 120 #define DEFAULT_MAX_EXPIRY 3600 #define DEFAULT_REGISTRATION_TIMEOUT 20 -#define DEFAULT_REGATTEMPTS_MAX 10 /* guard limit must be larger than guard secs */ /* guard min must be < 1000, and should be >= 250 */ @@ -360,7 +359,7 @@ static int global_rtpholdtimeout = 0; static int global_rtpkeepalive = 0; static int global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; -static int global_regattempts_max = DEFAULT_REGATTEMPTS_MAX; +static int global_regattempts_max = 0; /* Object counters */ static int suserobjs = 0; @@ -5219,7 +5218,7 @@ static int sip_reg_timeout(void *data) __sip_pretend_ack(p); } /* If we have a limit, stop registration and give up */ - if (global_regattempts_max && r->regattempts > global_regattempts_max) { + if (global_regattempts_max && (r->regattempts > global_regattempts_max)) { /* Ok, enough is enough. Don't try any more */ /* We could add an external notification here... steal it from app_voicemail :-) */ @@ -9493,13 +9492,15 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str break; case 403: /* Forbidden */ ast_log(LOG_WARNING, "Forbidden - wrong password on authentication for REGISTER for '%s' to '%s'\n", p->registry->username, p->registry->hostname); - p->registry->regattempts = global_regattempts_max+1; + if (global_regattempts_max) + p->registry->regattempts = global_regattempts_max+1; ast_sched_del(sched, r->timeout); ast_set_flag(p, SIP_NEEDDESTROY); break; case 404: /* Not found */ ast_log(LOG_WARNING, "Got 404 Not found on SIP register to service %s@%s, giving up\n", p->registry->username,p->registry->hostname); - p->registry->regattempts = global_regattempts_max+1; + if (global_regattempts_max) + p->registry->regattempts = global_regattempts_max+1; ast_set_flag(p, SIP_NEEDDESTROY); r->call = NULL; ast_sched_del(sched, r->timeout); @@ -9512,7 +9513,8 @@ static int handle_response_register(struct sip_pvt *p, int resp, char *rest, str break; case 479: /* SER: Not able to process the URI - address is wrong in register*/ ast_log(LOG_WARNING, "Got error 479 on register to %s@%s, giving up (check config)\n", p->registry->username,p->registry->hostname); - p->registry->regattempts = global_regattempts_max+1; + if (global_regattempts_max) + p->registry->regattempts = global_regattempts_max+1; ast_set_flag(p, SIP_NEEDDESTROY); r->call = NULL; ast_sched_del(sched, r->timeout); @@ -12123,7 +12125,7 @@ static int reload_config(void) global_rtpkeepalive = 0; pedanticsipchecking = 0; global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; - global_regattempts_max = DEFAULT_REGATTEMPTS_MAX; + global_regattempts_max = 0; ast_clear_flag(&global_flags, AST_FLAGS_ALL); ast_set_flag(&global_flags, SIP_DTMF_RFC2833); ast_set_flag(&global_flags, SIP_NAT_RFC3581); |