On update, test against the existence of sipregs.
authorTilghman Lesher <tilghman@meg.abyt.es>
Sat, 21 Feb 2009 15:59:49 +0000 (15:59 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Sat, 21 Feb 2009 15:59:49 +0000 (15:59 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177944 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index a28696a..d45e271 100644 (file)
@@ -11108,7 +11108,7 @@ static void destroy_association(struct sip_peer *peer)
        if (!sip_cfg.ignore_regexpire) {
                if (peer->rt_fromcontact) {
                        ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", peer->deprecated_username ? "username" : "defaultuser", "", "regserver", "", "useragent", "", SENTINEL);
-                       ast_update_realtime("sippeers", "name", peer->name, "lastms", "", SENTINEL);
+                       ast_update_realtime(tablename, "name", peer->name, "lastms", "", SENTINEL);
                } else {
                        ast_db_del("SIP/Registry", peer->name);
                }
@@ -17195,7 +17195,7 @@ static void handle_response_peerpoke(struct sip_pvt *p, int resp, struct sip_req
                ast_log(LOG_NOTICE, "Peer '%s' is now %s. (%dms / %dms)\n",
                        peer->name, s, pingtime, peer->maxms);
                ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
-               ast_update_realtime("sippeers", "name", peer->name, "lastms", str_lastms, SENTINEL);
+               ast_update_realtime(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", peer->name, "lastms", str_lastms, SENTINEL);
                manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
                        "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
                        peer->name, s, pingtime);
@@ -21649,7 +21649,7 @@ static int sip_poke_noanswer(const void *data)
 
        if (peer->lastms > -1) {
                ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE!  Last qualify: %d\n", peer->name, peer->lastms);
-               ast_update_realtime("sippeers", "name", peer->name, "lastms", "-1", SENTINEL);
+               ast_update_realtime(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", peer->name, "lastms", "-1", SENTINEL);
                manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, -1);
                if (sip_cfg.regextenonqualify) {
                        register_peer_exten(peer, FALSE);