]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Avoid multiple warning messages in SIP, due to this column not existing
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 2 Apr 2009 17:03:59 +0000 (17:03 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 2 Apr 2009 17:03:59 +0000 (17:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@186057 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 26f835c7b19484d0a3862aa9fac1a2d31e9381e7..ea0ae8a97a21b52cfe548b7f96cbcc11780740fc 100644 (file)
@@ -192,6 +192,7 @@ static int min_expiry = DEFAULT_MIN_EXPIRY;        /*!< Minimum accepted registr
 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 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
                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 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
                        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)