]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_sip: Allow Asterisk to retry after 403 on register
authorKinsey Moore <kmoore@digium.com>
Mon, 30 Sep 2013 15:19:23 +0000 (15:19 +0000)
committerKinsey Moore <kmoore@digium.com>
Mon, 30 Sep 2013 15:19:23 +0000 (15:19 +0000)
This adds a global option in chan_sip to allow it to continue
attempting registration if a 403 is received, clearing the cached nonce
and treating it as a non-fatal response. Normally, this would cause
registration attempts to that endpoint to stop.

(closes issue ASTERISK-17138)
Review: https://reviewboard.asterisk.org/r/2874/
Reported by: Rudi

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@400137 65c4cc65-6c06-0410-ace0-fbb531ad65f3

UPGRADE.txt
channels/chan_sip.c
configs/sip.conf.sample

index 2cf2a226db603692a9000ae0112893026561a206..c28be5a82c64a264482377945e78747620cd8dcd 100644 (file)
@@ -23,6 +23,10 @@ from 1.8.23.0 to 1.8.24.0:
   the function will be RESULT_FAILURE instead of the prior behavior of always
   returning RESULT_SUCCESS even if there was an error. 
 
+* The option "register_retry_403" has been added to chan_sip to work around
+  servers that are known to erroneously send 403 in response to valid
+  REGISTER requests and allows Asterisk to continue attepmting to connect.
+
 from 1.8.22.0 to 1.8.23.0:
 * The default settings for chan_sip are now overriden properly by the general
   settings in sip.conf.  Please look over your settings upon upgrading.
index 6db86a9255f19573aadcab7caa0dd3b6e80cc990..f5c726fea2e936056f4a3f20b6abdcdd24297bc6 100644 (file)
@@ -714,6 +714,7 @@ static int global_rtpholdtimeout;   /*!< Time out call if no RTP during hold */
 static int global_rtpkeepalive;     /*!< Send RTP keepalives */
 static int global_reg_timeout;      /*!< Global time between attempts for outbound registrations */
 static int global_regattempts_max;  /*!< Registration attempts before giving up */
+static int global_reg_retry_403;    /*!< Treat 403 responses to registrations as 401 responses */
 static int global_shrinkcallerid;   /*!< enable or disable shrinking of caller id  */
 static int global_callcounter;      /*!< Enable call counters for all devices. This is currently enabled by setting the peer
                                      *   call-limit to INT_MAX. When we remove the call-limit from the code, we can make it
@@ -18895,6 +18896,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
        ast_cli(a->fd, "  Reg. default duration:  %d secs\n", default_expiry);
        ast_cli(a->fd, "  Outbound reg. timeout:  %d secs\n", global_reg_timeout);
        ast_cli(a->fd, "  Outbound reg. attempts: %d\n", global_regattempts_max);
+       ast_cli(a->fd, "  Outbound reg. retry 403:%d\n", global_reg_retry_403);
        ast_cli(a->fd, "  Notify ringing state:   %s\n", AST_CLI_YESNO(sip_cfg.notifyringing));
        if (sip_cfg.notifyringing) {
                ast_cli(a->fd, "    Include CID:          %s%s\n",
@@ -28899,6 +28901,7 @@ static int reload_config(enum channelreloadreason reason)
        sip_cfg.compactheaders = DEFAULT_COMPACTHEADERS;
        global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
        global_regattempts_max = 0;
+       global_reg_retry_403 = 0;
        sip_cfg.pedanticsipchecking = DEFAULT_PEDANTIC;
        sip_cfg.autocreatepeer = DEFAULT_AUTOCREATEPEER;
        global_autoframing = 0;
@@ -29238,6 +29241,8 @@ static int reload_config(enum channelreloadreason reason)
                        }
                } else if (!strcasecmp(v->name, "registerattempts")) {
                        global_regattempts_max = atoi(v->value);
+               } else if (!strcasecmp(v->name, "register_retry_403")) {
+                       global_reg_retry_403 = ast_true(v->value);
                } else if (!strcasecmp(v->name, "bindaddr") || !strcasecmp(v->name, "udpbindaddr")) {
                        if (ast_parse_arg(v->value, PARSE_ADDR, &bindaddr)) {
                                ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
index fdec8e502096b617232ba4bca6789225bfebb7fb..a25c45b850912e596ae80ad5d1f95d8c1bf3f50f 100644 (file)
@@ -722,6 +722,9 @@ srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
                                 ; 0 = continue forever, hammering the other server
                                 ; until it accepts the registration
                                 ; Default is 0 tries, continue forever
+;register_retry_403=yes         ; Treat 403 responses to registrations as if they were
+                                ; 401 responses and continue retrying according to normal
+                                ; retry rules.
 
 ;----------------------------------------- OUTBOUND MWI SUBSCRIPTIONS -------------------------
 ; Asterisk can subscribe to receive the MWI from another SIP server and store it locally for retrieval