[asterisk-commits] trunk r22076 - in /trunk: app.c channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Apr 21 13:39:52 MST 2006


Author: rizzo
Date: Fri Apr 21 15:39:50 2006
New Revision: 22076

URL: http://svn.digium.com/view/asterisk?rev=22076&view=rev
Log:
convert to use ast_stream_and_wait


Modified:
    trunk/app.c
    trunk/channel.c

Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=22076&r1=22075&r2=22076&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Fri Apr 21 15:39:50 2006
@@ -155,10 +155,7 @@
 	struct ast_dsp *sildet;
 	/* Play prompt if requested */
 	if (prompt) {
-		res = ast_streamfile(c, prompt, c->language);
-		if (res < 0)
-			return res;
-		res = ast_waitstream(c,"");
+		res = ast_stream_and_wait(c, prompt, c->language, "");
 		if (res < 0)
 			return res;
 	}
@@ -573,9 +570,7 @@
 	if (playfile) {
 		d = ast_play_and_wait(chan, playfile);
 		if (d > -1)
-			d = ast_streamfile(chan, "beep",chan->language);
-		if (!d)
-			d = ast_waitstream(chan,"");
+			d = ast_stream_and_wait(chan, "beep", chan->language, "");
 		if (d < 0)
 			return -1;
 	}
@@ -749,8 +744,7 @@
 	}
 	if (outmsg > 1) {
 		/* Let them know recording is stopped */
-		if(!ast_streamfile(chan, "auth-thankyou", chan->language))
-			ast_waitstream(chan, "");
+		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
 	}
 	if (sildet)
 		ast_dsp_free(sildet);
@@ -794,9 +788,7 @@
 		if (!beep)
 			d = ast_play_and_wait(chan, playfile);
 		if (d > -1)
-			d = ast_streamfile(chan, "beep",chan->language);
-		if (!d)
-			d = ast_waitstream(chan,"");
+			d = ast_stream_and_wait(chan, "beep",chan->language, "");
 		if (d < 0)
 			return -1;
 	}
@@ -981,8 +973,7 @@
 	}
 	if (outmsg > 1) {
 		/* Let them know it worked */
-		ast_streamfile(chan, "auth-thankyou", chan->language);
-		ast_waitstream(chan, "");
+		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
 	}	
 	return res;
 }
@@ -1205,16 +1196,14 @@
 				cmd = '3';
 				break;
 			} else {
-				ast_streamfile(chan, "vm-msgsaved", chan->language);
-				ast_waitstream(chan, "");
+				ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
 				cmd = 't';
 				return res;
 			}
 		case '2':
 			/* Review */
 			ast_verbose(VERBOSE_PREFIX_3 "Reviewing the recording\n");
-			ast_streamfile(chan, recordfile, chan->language);
-			cmd = ast_waitstream(chan, AST_DIGIT_ANY);
+			cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
 			break;
 		case '3':
 			message_exists = 0;
@@ -1300,19 +1289,15 @@
 	case AST_ACTION_NOOP:
 		return 0;
 	case AST_ACTION_BACKGROUND:
-		res = ast_streamfile(chan, (char *)option->adata, chan->language);
-		if (!res) {
-			res = ast_waitstream(chan, AST_DIGIT_ANY);
-		} else {
+		res = ast_stream_and_wait(chan, (char *)option->adata, chan->language, AST_DIGIT_ANY);
+		if (res < 0) {
 			ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
 			res = 0;
 		}
 		return res;
 	case AST_ACTION_PLAYBACK:
-		res = ast_streamfile(chan, (char *)option->adata, chan->language);
-		if (!res) {
-			res = ast_waitstream(chan, "");
-		} else {
+		res = ast_stream_and_wait(chan, (char *)option->adata, chan->language, "");
+		if (res < 0) {
 			ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
 			res = 0;
 		}
@@ -1341,7 +1326,8 @@
 		c = ast_strdupa(option->adata);
 		if (c) {
 			while((n = strsep(&c, ";")))
-				if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
+				if ((res = ast_stream_and_wait(chan, n, chan->language,
+						(option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
 					break;
 			ast_stopstream(chan);
 		}

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=22076&r1=22075&r2=22076&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Fri Apr 21 15:39:50 2006
@@ -3230,24 +3230,20 @@
 	}
 	
 	if (!strcmp(sound,"timeleft")) {	/* Queue support */
-		ast_streamfile(chan, "vm-youhave", chan->language);
-		ast_waitstream(chan, "");
+		ast_stream_and_wait(chan, "vm-youhave", chan->language, "");
 		if (min) {
 			ast_say_number(chan, min, AST_DIGIT_ANY, chan->language, NULL);
-			ast_streamfile(chan, "queue-minutes", chan->language);
-			ast_waitstream(chan, "");
+			ast_stream_and_wait(chan, "queue-minutes", chan->language, "");
 		}
 		if (sec) {
 			ast_say_number(chan, sec, AST_DIGIT_ANY, chan->language, NULL);
-			ast_streamfile(chan, "queue-seconds", chan->language);
-			ast_waitstream(chan, "");
+			ast_stream_and_wait(chan, "queue-seconds", chan->language, "");
 		}
 	} else {
-		ast_streamfile(chan, sound, chan->language);
-		ast_waitstream(chan, "");
-	}
-
-	check = ast_autoservice_stop(peer);
+		ast_stream_and_wait(chan, sound, chan->language, "");
+	}
+
+	ast_autoservice_stop(peer);
 }
 
 static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct ast_channel *c1,



More information about the asterisk-commits mailing list