[Asterisk-cvs] asterisk/apps app_echo.c,1.18,1.19

russell russell
Sat Nov 19 14:55:22 CST 2005


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

Modified Files:
	app_echo.c 
Log Message:
Update application description to be a bit more accurate, and clean up a little bit of code formatting


Index: app_echo.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_echo.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- app_echo.c	8 Nov 2005 04:48:00 -0000	1.18
+++ app_echo.c	19 Nov 2005 19:44:46 -0000	1.19
@@ -43,12 +43,12 @@
 
 static char *app = "Echo";
 
-static char *synopsis = "Echo audio read back to the user";
+static char *synopsis = "Echo audio, video, or DTMF back to the calling party";
 
 static char *descrip = 
-"  Echo():  Echo audio read from channel back to the channel. \n"
-"User can exit the application by either pressing the '#' key, \n"
-"or hanging up.\n";
+"  Echo(): This application will echo any audio, video, or DTMF frames read from\n"
+"the calling channel back to itself. If the DTMF digit '#' is received, the\n"
+"application will exit.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -56,14 +56,18 @@
 
 static int echo_exec(struct ast_channel *chan, void *data)
 {
-	int res=-1;
+	int res = -1;
+	int format;
 	struct localuser *u;
 	struct ast_frame *f;
+
 	LOCAL_USER_ADD(u);
-	ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
-	ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
-	/* Do our thing here */
-	while(ast_waitfor(chan, -1) > -1) {
+
+	format = ast_best_codec(chan->nativeformats);
+	ast_set_write_format(chan, format);
+	ast_set_read_format(chan, format);
+
+	while (ast_waitfor(chan, -1) > -1) {
 		f = ast_read(chan);
 		if (!f)
 			break;
@@ -79,13 +83,16 @@
 			if (f->subclass == '#') {
 				res = 0;
 				break;
-			} else
+			} else {
 				if (ast_write(chan, f))
 					break;
+			}
 		}
 		ast_frfree(f);
 	}
+
 	LOCAL_USER_REMOVE(u);
+
 	return res;
 }
 




More information about the svn-commits mailing list