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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 5 13:44:55 MST 2007


Author: rizzo
Date: Mon Mar  5 14:44:54 2007
New Revision: 57945

URL: http://svn.digium.com/view/asterisk?view=rev&rev=57945
Log:
merge from trunk up to svn 54372

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=57945&r1=57944&r2=57945
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Mon Mar  5 14:44:54 2007
@@ -3215,6 +3215,8 @@
 		return res;
 	}
 
+	ast_string_field_set(dialog, tohost, peername);
+
 	/* Get the outbound proxy information */
   	dialog->outboundproxy = obproxy_get(dialog, NULL);
   	 
@@ -12142,6 +12144,8 @@
 
 	if (!strcasecmp(colname, "ip")) {
 		ast_copy_string(buf, peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "", len);
+	} else  if (!strcasecmp(colname, "port")) {
+		snprintf(buf, len, "%d", ntohs(peer->addr.sin_port));
 	} else  if (!strcasecmp(colname, "status")) {
 		peer_status(peer, buf, len);
 	} else  if (!strcasecmp(colname, "language")) {
@@ -12195,6 +12199,7 @@
 	.read = function_sippeer,
 	.desc = "Valid items are:\n"
 	"- ip (default)          The IP address.\n"
+	"- port                  The port number\n"
 	"- mailbox               The configured mailbox.\n"
 	"- context               The configured context.\n"
 	"- expire                The epoch time of the next expire.\n"
@@ -16901,6 +16906,11 @@
 					ast_sched_del(sched, peer->expire);
 				peer->expire = -1;
 				ast_clear_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
+				if (ast_get_ip_or_srv(&peer->addr, v->value, global_srvlookup ? "_sip._udp" : NULL)) {
+					unref_peer(peer);
+					return NULL;
+				}
+  	 
 				ast_copy_string(peer->tohost, v->value, sizeof(peer->tohost));
 				if (!peer->addr.sin_port)
 					peer->addr.sin_port = htons(STANDARD_SIP_PORT);
@@ -17404,6 +17414,7 @@
 		my_socket = socket(AF_INET, SOCK_DGRAM, 0);
 		if (my_socket < 0) {
 			ast_log(LOG_WARNING, "Unable to create SIP socket: %s\n", strerror(errno));
+			return -1;
 		} else {
 			/* Allow SIP clients on the same host to access us: */
 			const int reuseFlag = 1;



More information about the asterisk-commits mailing list