[asterisk-commits] rizzo: branch rizzo/astobj2 r75527 - /team/rizzo/astobj2/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 18 02:44:55 CDT 2007


Author: rizzo
Date: Wed Jul 18 02:44:55 2007
New Revision: 75527

URL: http://svn.digium.com/view/asterisk?view=rev&rev=75527
Log:
ast_sip_ouraddrfor() never fails, so we can as well make it
void and remove the useless code that checks for errors.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=75527&r1=75526&r2=75527
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Jul 18 02:44:55 2007
@@ -1621,7 +1621,7 @@
 static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
 
 /*--- Internal UA client handling (outbound registrations) */
-static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us);
+static void ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us);
 static int sip_register(char *value, int lineno);
 static const char *regstate2str(enum sipregistrystate regstate) attribute_const;
 static int sip_reregister(void *data);
@@ -2184,7 +2184,7 @@
  * apply it to their address to see if we need to substitute our
  * externip or can get away with our internal bindaddr
  */
-static enum sip_result ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us)
+static void ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us)
 {
 	struct sockaddr_in theirs, ours;
 
@@ -2211,7 +2211,6 @@
 		}
 	} else if (bindaddr.sin_addr.s_addr)
 		*us = bindaddr.sin_addr;
-	return AST_SUCCESS;
 }
 
 static inline int record_history(const struct sip_pvt *p)
@@ -4916,8 +4915,7 @@
 	p->ourip.sin_port = bindaddr.sin_port; /* XXX later, update with stun or similar */
 	if (sin) {
 		p->sa = *sin;
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-			p->ourip.sin_addr = __ourip;
+		ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 	} else
 		p->ourip.sin_addr = __ourip;
 
@@ -6627,8 +6625,7 @@
 	p->ourip.sin_port = bindaddr.sin_port;
 	if (sin) {
 		p->sa = *sin;
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-			p->ourip.sin_addr = __ourip;
+		ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 	} else
 		p->ourip.sin_addr = __ourip;
 
@@ -8231,8 +8228,7 @@
 		  internal network so we can register through nat
 		 */
 		p->ourip.sin_port = bindaddr.sin_port; /* XXX nat... */
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-			p->ourip.sin_addr = bindaddr.sin_addr;
+		ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 		build_contact(p);
 	}
 
@@ -12327,8 +12323,7 @@
 
 		/* Recalculate our side, and recalculate Call ID */
 		p->ourip.sin_port = bindaddr.sin_port; /* XXX nat */
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-			p->ourip.sin_addr = __ourip;
+		ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 		build_via(p);
 		build_callid_pvt(p);
 		ast_cli(fd, "Sending NOTIFY of type '%s' to '%s'\n", argv[2], argv[i]);
@@ -16465,8 +16460,7 @@
 		}
 		/* Recalculate our side, and recalculate Call ID */
 		p->ourip.sin_port = bindaddr.sin_port;
-		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-			p->ourip.sin_addr = __ourip;
+		ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 		build_via(p);
 		build_callid_pvt(p);
 		/* Destroy this session after 32 secs */
@@ -16728,8 +16722,7 @@
 
 	/* Recalculate our side, and recalculate Call ID */
 	p->ourip.sin_port = bindaddr.sin_port;
-	if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-		p->ourip.sin_addr = __ourip;
+	ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 	build_via(p);
 	build_callid_pvt(p);
 
@@ -16905,8 +16898,7 @@
 		ast_string_field_set(p, peername, ext);
 	/* Recalculate our side, and recalculate Call ID */
 	p->ourip.sin_port = bindaddr.sin_port;
-	if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr))
-		p->ourip.sin_addr = __ourip;
+	ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip.sin_addr);
 	build_via(p);
 	build_callid_pvt(p);
 	




More information about the asterisk-commits mailing list