[Freeswitch-svn] [commit] r9885 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Tue Oct 7 18:15:52 EDT 2008


Author: mikej
Date: Tue Oct  7 18:15:51 2008
New Revision: 9885

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Log:
handle multi contact register responses and register timeout better

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Tue Oct  7 18:15:51 2008
@@ -958,7 +958,7 @@
 								  gateway->freq, name);
 				gateway->freq = 3600;
 			}
-			gateway->freq -= 2;
+
 
 			gateway->next = profile->gateways;
 			profile->gateways = gateway;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Tue Oct  7 18:15:51 2008
@@ -119,7 +119,12 @@
 			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 @@
 				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);



More information about the Freeswitch-svn mailing list