[asterisk-commits] dlee: branch dlee/stasis-http r380837 - /team/dlee/stasis-http/apps/app_stasis.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 4 16:13:25 CST 2013


Author: dlee
Date: Mon Feb  4 16:13:22 2013
New Revision: 380837

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380837
Log:
Better loop control

Modified:
    team/dlee/stasis-http/apps/app_stasis.c

Modified: team/dlee/stasis-http/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/apps/app_stasis.c?view=diff&rev=380837&r1=380836&r2=380837
==============================================================================
--- team/dlee/stasis-http/apps/app_stasis.c (original)
+++ team/dlee/stasis-http/apps/app_stasis.c Mon Feb  4 16:13:22 2013
@@ -112,6 +112,7 @@
 {
 	int res = 0;
 	char *parse = NULL;
+	int hungup = 0;
 
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(app_name);
@@ -136,18 +137,19 @@
 		return res;
 	}
 
-	while (ast_waitfor(chan, -1) > -1) {
+	while (!hungup && ast_waitfor(chan, -1) > -1) {
 		RAII_VAR(struct ast_frame *, f, ast_read(chan), ast_frame_free_cached);
 		if (!f) {
 			ast_debug(3, "%s: No more frames. Must be done, I guess.\n", ast_channel_uniqueid(chan));
 			break;
 		}
 
-		ast_log(LOG_DEBUG, "New frame: %d\n", f->frametype);
-
-		if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
-			ast_debug(3, "%s: Received hangup\n", ast_channel_uniqueid(chan));
-			break;
+		switch (f->frametype) {
+		case AST_FRAME_CONTROL:
+			if (f->subclass.integer == AST_CONTROL_HANGUP) {
+				ast_debug(3, "%s: Received hangup\n", ast_channel_uniqueid(chan));
+				hungup = 1;
+			}
 		}
 	}
 




More information about the asterisk-commits mailing list