[Asterisk-cvs] asterisk/channels chan_sip.c,1.379,1.380

markster at lists.digium.com markster at lists.digium.com
Sun May 9 17:53:55 CDT 2004


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

Modified Files:
	chan_sip.c 
Log Message:
merge brian's cleanups 


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.379
retrieving revision 1.380
diff -u -d -r1.379 -r1.380
--- chan_sip.c	9 May 2004 21:05:43 -0000	1.379
+++ chan_sip.c	9 May 2004 22:03:38 -0000	1.380
@@ -3648,6 +3648,7 @@
 	int expiry = atoi(expires);
 	char *c, *n, *pt;
 	int port;
+	char *useragent;
 	struct hostent *hp;
 	struct ast_hostent ahp;
 	struct sockaddr_in oldsin;
@@ -3679,6 +3680,7 @@
 			ast_sched_del(sched, p->expire);
 		p->expire = -1;
 		ast_db_del("SIP/Registry", p->name);
+		strcpy(p->useragent, "");
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "Unregistered SIP '%s'\n", p->name);
 		return 0;
@@ -3744,10 +3746,13 @@
 	}
 
 	/* Save User agent */
-	strncpy(p->useragent, get_header(req, "User-Agent"),sizeof(p->useragent));
-	if (option_verbose > 2) 
-		ast_verbose(VERBOSE_PREFIX_3 "Saved useragent \"%s\" for peer %s\n",p->useragent,p->name);  
-
+	useragent = get_header(req, "User-Agent");
+	if(useragent && strcasecmp(useragent, p->useragent)) {
+		strncpy(p->useragent, get_header(req, "User-Agent"),sizeof(p->useragent));
+		if (option_verbose > 2) {
+			ast_verbose(VERBOSE_PREFIX_3 "Saved useragent \"%s\" for peer %s\n",p->useragent,p->name);  
+		}
+	}
 	return 0;
 }
 




More information about the svn-commits mailing list