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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 18 09:09:18 CDT 2007


Author: simon.perreault
Date: Thu Oct 18 09:09:18 2007
New Revision: 86293

URL: http://svn.digium.com/view/asterisk?view=rev&rev=86293
Log:
Use brackets with IPv6 addresses in From: and To: URIs when registering.

Modified:
    team/group/v6/trunk/channels/chan_sip.c
    team/group/v6/trunk/include/asterisk/netsock.h
    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=86293&r1=86292&r2=86293
==============================================================================
--- team/group/v6/trunk/channels/chan_sip.c (original)
+++ team/group/v6/trunk/channels/chan_sip.c Thu Oct 18 09:09:18 2007
@@ -8509,11 +8509,16 @@
 		else
 			snprintf(to, sizeof(to), "<sip:%s>", r->username);
 	} else {
-		snprintf(from, sizeof(from), "<sip:%s@%s>;tag=%s", r->username, p->tohost, p->tag);
+		char hp[NI_MAXHOST];
+		ast_vinetsock_hp2str(p->tohost, NULL, hp, sizeof(hp));
+
+		snprintf(from, sizeof(from), "<sip:%s@%s>;tag=%s",
+				r->username, hp, p->tag);
 		if (!ast_strlen_zero(p->theirtag))
-			snprintf(to, sizeof(to), "<sip:%s@%s>;tag=%s", r->username, p->tohost, p->theirtag);
+			snprintf(to, sizeof(to), "<sip:%s@%s>;tag=%s",
+					r->username, hp, p->theirtag);
 		else
-			snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, p->tohost);
+			snprintf(to, sizeof(to), "<sip:%s@%s>", r->username, hp);
 	}
 	
 	/* Fromdomain is what we are registering to, regardless of actual

Modified: team/group/v6/trunk/include/asterisk/netsock.h
URL: http://svn.digium.com/view/asterisk/team/group/v6/trunk/include/asterisk/netsock.h?view=diff&rev=86293&r1=86292&r2=86293
==============================================================================
--- team/group/v6/trunk/include/asterisk/netsock.h (original)
+++ team/group/v6/trunk/include/asterisk/netsock.h Thu Oct 18 09:09:18 2007
@@ -134,7 +134,8 @@
 int ast_vinetsock_str2hp(char *hbuf, size_t hostsize, char *sbuf,
 			 size_t portsize, const char *hostport,
 			 int numeric, const char **end);
-int ast_vinetsock_hp2str(char *hbuf, char *sbuf, char *hp, size_t hplen);
+int ast_vinetsock_hp2str(const char *hbuf, const char *sbuf,
+		char *hp, size_t hplen);
 int ast_vinetsock_sa_get_host(const struct sockaddr* sa, socklen_t salen,
 			      char* host, size_t hostlen);
 int ast_vinetsock_get_hostport(const struct ast_vinetsock *ns, char *hostport, 

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=86293&r1=86292&r2=86293
==============================================================================
--- team/group/v6/trunk/main/netsock.c (original)
+++ team/group/v6/trunk/main/netsock.c Thu Oct 18 09:09:18 2007
@@ -856,10 +856,10 @@
  *  \return 0 if success; -1 otherwise
  *  \note
  */ 
-int ast_vinetsock_hp2str(char *hbuf, char *sbuf, char *hp, size_t hplen)
+int ast_vinetsock_hp2str(const char *hbuf, const char *sbuf, char *hp, size_t hplen)
 {
 	char *p1 = 0;
-	size_t sbuflen = strlen(sbuf);
+	size_t sbuflen = sbuf ? strlen(sbuf) : 0;
 
 	if (!hplen)
 		return -1;




More information about the asterisk-commits mailing list