[asterisk-commits] tilghman: branch 1.4 r186057 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 2 12:04:02 CDT 2009


Author: tilghman
Date: Thu Apr  2 12:03:59 2009
New Revision: 186057

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=186057
Log:
Avoid multiple warning messages in SIP, due to this column not existing

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=186057&r1=186056&r2=186057
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Apr  2 12:03:59 2009
@@ -192,6 +192,7 @@
 static int max_expiry = DEFAULT_MAX_EXPIRY;        /*!< Maximum accepted registration time */
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
 static int expiry = DEFAULT_EXPIRY;
+static char seen_lastms = 0;
 
 #ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -2456,9 +2457,11 @@
 		ast_update_realtime("sippeers", "name", peername, "ipaddr", ipaddr,
 			"port", port, "regseconds", regseconds,
 			"username", username, syslabel, sysname, NULL); /* note syslabel _can_ be NULL */
-	/* We cannot do this in the same statement as above, because the lack of
-	 * this field could cause the whole statement to fail. */
-	ast_update_realtime("sippeers", "name", peername, "lastms", str_lastms, NULL);
+	if (seen_lastms) {
+		/* We cannot do this in the same statement as above, because the lack of
+		 * this field could cause the whole statement to fail. */
+		ast_update_realtime("sippeers", "name", peername, "lastms", str_lastms, NULL);
+	}
 }
 
 /*! \brief Automatically add peer extension to dial plan */
@@ -2641,9 +2644,11 @@
 			return NULL;
 		} else if (!newpeername && !strcasecmp(tmp->name, "name")) {
 			newpeername = tmp->value;
-		}
-	}
-	
+		} else if (!strcasecmp(tmp->name, "lastms")) {
+			seen_lastms = 1;
+		}
+	}
+
 	if (!newpeername) {	/* Did not find peer in realtime */
 		ast_log(LOG_WARNING, "Cannot Determine peer name ip=%s\n", iabuf);
 		if(peerlist)




More information about the asterisk-commits mailing list