]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make sure unregistering a peer unlinks it from the peer container
authorTerry Wilson <twilson@digium.com>
Tue, 26 Apr 2011 22:47:56 +0000 (22:47 +0000)
committerTerry Wilson <twilson@digium.com>
Tue, 26 Apr 2011 22:47:56 +0000 (22:47 +0000)
Instead of mostly copying the code from expire_register, just use the function
that "does the right thing".

(closes issue #16033)
Reported by: kkm
Patches:
      016033-tilgman-fixed-refcount.diff uploaded by kkm (license 888)
Tested by: kkm, tilghman, twilson

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@315671 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 4f6338c93bba6cde236cbb7f74a5e9252c032242..becd4c2c00fd721921f1fc64cd4c143d0ceb8ae5 100644 (file)
@@ -9083,24 +9083,12 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
                return PARSE_REGISTER_QUERY;
        } else if (!strcasecmp(curi, "*") || !expiry) { /* Unregister this peer */
                /* This means remove all registrations and return OK */
-               memset(&peer->addr, 0, sizeof(peer->addr));
                if (!AST_SCHED_DEL(sched, peer->expire)) {
                        struct sip_peer *peer_ptr = peer;
                        ASTOBJ_UNREF(peer_ptr, sip_destroy_peer);
                }
 
-               destroy_association(peer);
-               
-               register_peer_exten(peer, 0);   /* Add extension from regexten= setting in sip.conf */
-               peer->fullcontact[0] = '\0';
-               peer->useragent[0] = '\0';
-               peer->sipoptions = 0;
-               peer->lastms = 0;
-               peer->portinuri = 0;
-               pvt->expiry = 0;
-
-               if (option_verbose > 2)
-                       ast_verbose(VERBOSE_PREFIX_3 "Unregistered SIP '%s'\n", peer->name);
+               expire_register(ASTOBJ_REF(peer));
 
                manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Unregistered\r\n", peer->name);
                return PARSE_REGISTER_UPDATE;