[asterisk-commits] simon.perreault: branch group/v6 r84543 - in /team/group/v6/trunk: channels/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 3 11:13:02 CDT 2007


Author: simon.perreault
Date: Wed Oct  3 11:13:02 2007
New Revision: 84543

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84543
Log:
Fixing some bugs which were preventing sip_poke_peer() from working.

Modified:
    team/group/v6/trunk/channels/chan_sip.c
    team/group/v6/trunk/main/netsock.c

Modified: team/group/v6/trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/channels/chan_sip.c?view=diff&rev=84543&r1=84542&r2=84543
==============================================================================
--- team/group/v6/trunk/channels/chan_sip.c (original)
+++ team/group/v6/trunk/channels/chan_sip.c Wed Oct  3 11:13:02 2007
@@ -5072,9 +5072,6 @@
 	char iabuf[NI_MAXHOST];
 	char sbuf[NI_MAXSERV];
 
-	if (!sa || sa_len <= 0)
-		return NULL;
-
 	if (!(p = ast_calloc(1, sizeof(*p))))
 		return NULL;
 
@@ -5095,7 +5092,7 @@
 	if (intended_method != SIP_OPTIONS)	/* Peerpoke has it's own system */
 		p->timer_t1 = SIP_TIMER_T1;	/* Default SIP retransmission timer T1 (RFC 3261) */
 
-	if (!ns) {
+	if (!ns && sa) {
 		if (!(ns = ast_vinetsock_find_best(netsocks, sa, sa_len, AF_UNSPEC))){
 			getnameinfo(sa, sa_len, iabuf, sizeof(iabuf),
 			sbuf, sizeof(sbuf), NI_NUMERICHOST|NI_NUMERICSERV);
@@ -8954,9 +8951,10 @@
 	char data[BUFSIZ];
 	const char *expires = get_header(req, "Expires");
 	int expiry = atoi(expires);
-	char *curi, *hostport;
+	char *curi, *domain;
 	char host[NI_MAXHOST];
 	char port[NI_MAXSERV];
+	char hostport[NI_MAXHOST];
 	const char *useragent;
 	struct sockaddr_storage oldsa;
 	socklen_t oldsa_len;
@@ -8993,6 +8991,7 @@
 	} else if (!strcasecmp(curi, "*") || !expiry) {	/* Unregister this peer */
 		/* This means remove all registrations and return OK */
 		memset(&peer->addr, 0, sizeof(peer->addr));
+		peer->addr_len = 0;
 		if (peer->expire > -1)
 			ast_sched_del(sched, peer->expire);
 		peer->expire = -1;
@@ -9017,9 +9016,9 @@
 	ast_string_field_build(pvt, our_contact, "<%s>", curi);
 
 	/* Make sure it's a SIP URL */
-	if (parse_uri(curi, "sip:", &curi, NULL, &hostport, NULL))
+	if (parse_uri(curi, "sip:", &curi, NULL, &domain, NULL))
 		ast_log(LOG_NOTICE, "Not a valid SIP contact (missing sip:) trying to use anyway\n");
-	ast_vinetsock_str2hp(host, sizeof(host), port, sizeof(port), hostport, 0, NULL);
+	ast_vinetsock_str2hp(host, sizeof(host), port, sizeof(port), domain, 0, NULL);
 	if ( ast_strlen_zero(port) ) {
 		snprintf(port, sizeof(port), "%d", STANDARD_SIP_PORT);
 	}

Modified: team/group/v6/trunk/main/netsock.c
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/main/netsock.c?view=diff&rev=84543&r1=84542&r2=84543
==============================================================================
--- team/group/v6/trunk/main/netsock.c (original)
+++ team/group/v6/trunk/main/netsock.c Wed Oct  3 11:13:02 2007
@@ -303,7 +303,8 @@
 			ns = iterator;
 		ASTOBJ_UNLOCK(iterator);
 	});
-	ASTOBJ_REF(ns);
+
+	if (ns) ASTOBJ_REF(ns);
 	return ns;
 }
 




More information about the asterisk-commits mailing list