[asterisk-commits] twilson: branch 1.4 r315671 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 26 17:48:04 CDT 2011


Author: twilson
Date: Tue Apr 26 17:47:56 2011
New Revision: 315671

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=315671
Log:
Make sure unregistering a peer unlinks it from the peer container

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

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=315671&r1=315670&r2=315671
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Apr 26 17:47:56 2011
@@ -9083,24 +9083,12 @@
 		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;




More information about the asterisk-commits mailing list