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))
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 */
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)