Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv31804/channels

Modified Files:
        chan_sip.c 
Log Message:
reset regattempts counter after successful registration (bug #4634)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.771
retrieving revision 1.772
diff -u -d -r1.771 -r1.772
--- chan_sip.c  24 Jun 2005 02:15:04 -0000      1.771
+++ chan_sip.c  5 Jul 2005 15:08:34 -0000       1.772
@@ -707,7 +707,7 @@
        char contact[256];              /* Contact extension */
        char random[80];
        int expire;                     /* Sched ID of expiration */
-       int regattempts;                /* Number of attempts */
+       int regattempts;                /* Number of attempts (since the last 
success) */
        int timeout;                    /* sched id of sip_reg_timeout */
        int refresh;                    /* How often to refresh */
        struct sip_pvt *call;           /* create a sip_pvt structure for each 
outbound "registration call" in progress */
@@ -4699,7 +4699,7 @@
 
        ast_log(LOG_NOTICE, "   -- Registration for '[EMAIL PROTECTED]' timed 
out, trying again (Attempt #%d)\n", r->username, r->hostname, r->regattempts); 
        if (r->call) {
-               /* Unlink us, destroy old call.  Locking is not relevent here 
because all this happens
+               /* Unlink us, destroy old call.  Locking is not relevant here 
because all this happens
                   in the single SIP manager thread. */
                p = r->call;
                if (p->registry)
@@ -4715,6 +4715,7 @@
                /* Ok, enough is enough. Don't try any more */
                /* We could add an external notification here... 
                        steal it from app_voicemail :-) */
+               ast_log(LOG_NOTICE, "   -- Giving up forever trying to register 
'[EMAIL PROTECTED]'\n", r->username, r->hostname);
                r->regstate=REG_STATE_FAILED;
        } else {
                r->regstate=REG_STATE_UNREGISTERED;
@@ -4775,12 +4776,11 @@
                                ast_log(LOG_WARNING, "Still have a registration 
timeout for [EMAIL PROTECTED] (create_addr() error), %d\n", r->username, 
r->hostname, r->timeout);
                        } else {
                                r->timeout = ast_sched_add(sched, 
global_reg_timeout*1000, sip_reg_timeout, r);
-                               ast_log(LOG_WARNING, "Propably a DNS error for 
registration to [EMAIL PROTECTED], trying REGISTER again (after %d seconds)\n", 
r->username, r->hostname, global_reg_timeout * 1000);
+                               ast_log(LOG_WARNING, "Probably a DNS error for 
registration to [EMAIL PROTECTED], trying REGISTER again (after %d seconds)\n", 
r->username, r->hostname, global_reg_timeout);
                        }
                        r->regattempts++;
                        return 0;
                }
-
                /* Copy back Call-ID in case create_addr changed it */
                ast_copy_string(r->callid, p->callid, sizeof(r->callid));
                if (r->portno)
@@ -8261,6 +8261,7 @@
 
                r->regstate=REG_STATE_REGISTERED;
                manager_event(EVENT_FLAG_SYSTEM, "Registry", "Channel: 
SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));
+               r->regattempts = 0;
                ast_log(LOG_DEBUG, "Registration successful\n");
                if (r->timeout > -1) {
                        ast_log(LOG_DEBUG, "Cancelling timeout %d\n", 
r->timeout);

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to