[asterisk-bugs] [Asterisk 0014196]: [patch] Realtime peers are never qualified after 'sip reload'

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 16 01:54:08 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14196 
====================================================================== 
Reported By:                pdf
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   14196
Category:                   Channels/chan_sip/DatabaseSupport
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 167620 
Request Review:              
====================================================================== 
Date Submitted:             2009-01-08 01:04 CST
Last Modified:              2009-01-16 01:54 CST
====================================================================== 
Summary:                    [patch] Realtime peers are never qualified after
'sip reload'
Description: 
Realtime SIP peers all report status as 'UNKNOWN' when re-initialised after
'sip reload'.  Peers are never sent OPTIONS qualify packet after reload,
unless they re-register.



    -- Registered SIP 'nnn' at xxx.xxx.xxx.xxx port 5060
pabx*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status    
Realtime  
nnn/nnn                    xxx.xxx.xxx.xxx       D          5060     OK
(35 ms) Cached RT 
1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0
offline]


pabx*CLI> sip reload
 Reloading SIP
  == Parsing '/etc/asterisk/sip.conf': Found
  == Parsing '/etc/asterisk/users.conf': Found
  == Parsing '/etc/asterisk/sip_notify.conf': Found
pabx*CLI> sip show peers
Name/username              Host            Dyn Nat ACL Port     Status    
Realtime  
nnn/nnn                    xxx.xxx.xxx.xxx       D          5060    
UNKNOWN    Cached RT 
1 sip peers [Monitored: 0 online, 1 offline Unmonitored: 0 online, 0
offline]



======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0013316 Realtime registrations don't work after...
====================================================================== 

---------------------------------------------------------------------- 
 (0098001) pdf (reporter) - 2009-01-16 01:54
 http://bugs.digium.com/view.php?id=14196#c98001 
---------------------------------------------------------------------- 
@oej: I hear where you're coming from - there is definitely a gap between
user expectations and the implementation, and agree with your closing
comments.

@Corydon76: What you suggest seems sane enough, however I think this may
be incorrect:

@@ -12817,6 +12823,7 @@
        ast_log(LOG_NOTICE, "Peer '%s' is now %s. (%dms / %dms)\n",
            peer->name, s, pingtime, peer->maxms);
        ast_device_state_changed("SIP/%s", peer->name);
+       ast_update_realtime("sippeers", "name", peer->name, "lastms",
"-1", NULL);
        manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
            "Peer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
            peer->name, s, pingtime);


I think this needs to be:
@@ -12725,11 +12725,13 @@
        peer->call = NULL;
        if (statechanged) {
                const char *s = is_reachable ? "Reachable" : "Lagged";
+               char str_lastms[20];
+               snprintf(str_lastms, sizeof(str_lastms), "%d", pingtime);
 
                ast_log(LOG_NOTICE, "Peer '%s' is now %s. (%dms /
%dms)\n",
                        peer->name, s, pingtime, peer->maxms);
                ast_device_state_changed("SIP/%s", peer->name);
-               ast_update_realtime("sippeers", "name", peer->name,
"lastms", "-1", NULL);
+               ast_update_realtime("sippeers", "name", peer->name,
"lastms", str_lastms, NULL);
                manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
                        "Peer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
                        peer->name, s, pingtime);


for this approach to work? 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-16 01:54 pdf            Note Added: 0098001                          
======================================================================




More information about the asterisk-bugs mailing list