Make sure registration is taken care of if DNS fails (bug #3424)
authorMark Spencer <markster@digium.com>
Wed, 26 Jan 2005 00:11:38 +0000 (00:11 +0000)
committerMark Spencer <markster@digium.com>
Wed, 26 Jan 2005 00:11:38 +0000 (00:11 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4891 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 41590e8..db06529 100755 (executable)
@@ -4204,7 +4204,14 @@ static int transmit_register(struct sip_registry *r, char *cmd, char *auth, char
                }
                /* Find address to hostname */
                if (create_addr(p,r->hostname)) {
                }
                /* Find address to hostname */
                if (create_addr(p,r->hostname)) {
+                       /* we have what we hope is a temporary network error,
+                        * probably DNS.  We need to reschedule a registration try */
                        sip_destroy(p);
                        sip_destroy(p);
+                       if (r->timeout > -1) {
+                               ast_log(LOG_WARNING, "Still have a registration timeout (create_addr() error), %d\n", r->timeout);
+                               ast_sched_del(sched, r->timeout);
+                       }
+                       r->timeout = ast_sched_add(sched, global_reg_timeout*1000, sip_reg_timeout, r);
                        return 0;
                }
 
                        return 0;
                }