[Asterisk-cvs] asterisk/apps app_transfer.c,1.6,1.7

markster at lists.digium.com markster at lists.digium.com
Sat Feb 19 11:35:19 CST 2005


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

Modified Files:
	app_transfer.c 
Log Message:
Add sip redirect support (bug #3419i, with mods)


Index: app_transfer.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_transfer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- app_transfer.c	21 Jan 2005 07:06:24 -0000	1.6
+++ app_transfer.c	19 Feb 2005 17:34:06 -0000	1.7
@@ -29,7 +29,7 @@
 static char *synopsis = "Transfer caller to remote extension";
 
 static char *descrip = 
-"  Transfer(exten):  Requests the remote caller be transferred to\n"
+"  Transfer([Tech/]dest):  Requests the remote caller be transferred\n"
 "a given extension. Returns -1 on hangup, or 0 on completion\n"
 "regardless of whether the transfer was successful.  If the transfer\n"
 "was *not* supported or successful and there exists a priority n + 101,\n"
@@ -42,14 +42,21 @@
 static int transfer_exec(struct ast_channel *chan, void *data)
 {
 	int res=0;
+	int len;
 	struct localuser *u;
+	char *slash;
 	if (!data || !strlen(data)) {
-		ast_log(LOG_WARNING, "Transfer requires an argument (destination)\n");
+		ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination)\n");
 		res = 1;
 	}
+	if ((slash = strchr((char *)data, '/')) && (len = (slash - (char *)data))) {
+		/* Allow execution only if the Tech/destination agrees with the type of the channel */
+		if (strncasecmp(chan->type, (char *)data, len))
+			return 0;
+	}
 	LOCAL_USER_ADD(u);
 	if (!res) {
-		res = ast_transfer(chan, data);
+		res = ast_transfer(chan, data + strlen(chan->type) + 1);
 	}
 	if (!res) {
 		/* Look for a "busy" place */




More information about the svn-commits mailing list