[Asterisk-cvs] asterisk/channels chan_iax2.c,1.358,1.359

jim jim
Wed Oct 19 14:25:36 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv15338/channels

Modified Files:
	chan_iax2.c 
Log Message:
Allow for obtaining IAX2 call peer (endpoint) IP address with IAXPEER(CURRENTCHAN) function


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- chan_iax2.c	17 Oct 2005 22:26:33 -0000	1.358
+++ chan_iax2.c	19 Oct 2005 18:19:22 -0000	1.359
@@ -9133,6 +9133,13 @@
 		return ret;
 	}
 
+	/* if our channel, return the IP address of the endpoint of current channel */
+	if (!strcmp(peername,"CURRENTCHANNEL")) {
+	        unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
+		ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr) : "", len);
+		return buf;
+	}
+
 	if ((colname = strchr(peername, ':'))) {
 		*colname = '\0';
 		colname++;
@@ -9181,9 +9188,9 @@
 struct ast_custom_function iaxpeer_function = {
     .name = "IAXPEER",
     .synopsis = "Gets IAX peer information",
-    .syntax = "IAXPEER(<peername>[:item])",
+    .syntax = "IAXPEER(<peername|CURRENTCHANNEL>[:item])",
     .read = function_iaxpeer,
-	.desc = "Valid items are:\n"
+	.desc = "If peername specified, valid items are:\n"
 	"- ip (default)          The IP address.\n"
 	"- mailbox               The configured mailbox.\n"
 	"- context               The configured context.\n"
@@ -9194,6 +9201,8 @@
 	"- codecs                The configured codecs.\n"
 	"- codec[x]              Preferred codec index number 'x' (beginning with zero).\n"
 	"\n"
+	"If CURRENTCHANNEL specified, returns IP address of current channel\n"
+	"\n"
 };
 
 




More information about the svn-commits mailing list