]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
handle multi contact register responses and register timeout better
authorMichael Jerris <mike@jerris.com>
Tue, 7 Oct 2008 22:15:51 +0000 (22:15 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 7 Oct 2008 22:15:51 +0000 (22:15 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9885 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index ebf9978639afa5f01081e6df27b1714553970a81..fc03b5acd49e3608aa6cc4791a0be1e6e0af2718 100644 (file)
@@ -958,7 +958,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                                                  gateway->freq, name);
                                gateway->freq = 3600;
                        }
-                       gateway->freq -= 2;
+
 
                        gateway->next = profile->gateways;
                        profile->gateways = gateway;
index a0c2d1c2d1d7c4ca990f20056c273aa70b8e6562..d4d5479e1ca1a960a13b7713bd05e262e9e2cfc8 100644 (file)
@@ -119,7 +119,12 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
                        break;
                case REG_STATE_REGISTER:
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "registered %s\n", gateway_ptr->name);
-                       gateway_ptr->expires = now + gateway_ptr->freq;
+                       if (gateway_ptr->expires > 60) {
+                               gateway_ptr->expires = now + (gateway_ptr->freq - 15);
+                       } else {
+                               gateway_ptr->expires = now + (gateway_ptr->freq - 2);
+                       }
+
                        gateway_ptr->state = REG_STATE_REGED;
                        gateway_ptr->status = SOFIA_GATEWAY_UP;
                        break;
@@ -1025,9 +1030,14 @@ void sofia_reg_handle_sip_r_register(int status,
                                const char *new_expires;
                                uint32_t expi;
                                if (contact->m_next) {
-                                       //const char *sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
-                                       //find the contact
+                                       const char *sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
+                                       for ( ; contact && strcasecmp(contact->m_url->url_host, sipip); contact = contact->m_next);
                                }
+
+                               if (!contact) {
+                                       contact = sip->sip_contact;
+                               }
+
                                if (contact->m_expires) {
                                        new_expires = contact->m_expires;
                                        expi = (uint32_t) atoi(new_expires);