[svn-commits] murf: trunk r47821 - in /trunk: apps/ include/asterisk/ main/ res/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Nov 17 16:18:51 MST 2006


Author: murf
Date: Fri Nov 17 17:18:51 2006
New Revision: 47821

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47821
Log:
This update fulfils the request of bug 7109, which claimed the language arg to ast_stream_and_wait() was redundant. Almost all calls just used chan->language, and seeing how chan is the first argument, this certainly seems redundant. A change of language could just as easily be done by simply changing the channel language before calling.

Modified:
    trunk/apps/app_directory.c
    trunk/apps/app_followme.c
    trunk/apps/app_voicemail.c
    trunk/include/asterisk/file.h
    trunk/main/app.c
    trunk/main/channel.c
    trunk/main/file.c
    trunk/res/res_features.c

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Fri Nov 17 17:18:51 2006
@@ -282,17 +282,17 @@
 #endif
 
 	if (ast_fileexists(fn, NULL, chan->language) > 0) {
-		res = ast_stream_and_wait(chan, fn, chan->language, AST_DIGIT_ANY);
+		res = ast_stream_and_wait(chan, fn, AST_DIGIT_ANY);
 		ast_stopstream(chan);
 		/* If Option 'e' was specified, also read the extension number with the name */
 		if (readext) {
-			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
+			ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	} else {
 		res = ast_say_character_str(chan, S_OR(name, ext), AST_DIGIT_ANY, chan->language);
 		if (!ast_strlen_zero(name) && readext) {
-			ast_stream_and_wait(chan, "vm-extension", chan->language, AST_DIGIT_ANY);
+			ast_stream_and_wait(chan, "vm-extension", AST_DIGIT_ANY);
 			res = ast_say_character_str(chan, ext, AST_DIGIT_ANY, chan->language);
 		}
 	}
@@ -303,7 +303,7 @@
 
 	for (loop = 3 ; loop > 0; loop--) {
 		if (!res)
-			res = ast_stream_and_wait(chan, "dir-instr", chan->language, AST_DIGIT_ANY);
+			res = ast_stream_and_wait(chan, "dir-instr", AST_DIGIT_ANY);
 		if (!res)
 			res = ast_waitfordigit(chan, 3000);
 		ast_stopstream(chan);
@@ -622,7 +622,7 @@
 
 	for (;;) {
 		if (!res)
-			res = ast_stream_and_wait(chan, dirintro, chan->language, AST_DIGIT_ANY);
+			res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
 		ast_stopstream(chan);
 		if (!res)
 			res = ast_waitfordigit(chan, 5000);

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Fri Nov 17 17:18:51 2006
@@ -982,7 +982,7 @@
 		ast_mutex_unlock(&f->lock);
 
 		if (targs.followmeflags.flags & FOLLOWMEFLAG_STATUSMSG) 
-			ast_stream_and_wait(chan, targs.statusprompt, chan->language, "");
+			ast_stream_and_wait(chan, targs.statusprompt, "");
 
 		snprintf(namerecloc,sizeof(namerecloc),"%s/followme.%s",ast_config_AST_SPOOL_DIR,chan->uniqueid);
 		duration = 5;
@@ -1022,7 +1022,7 @@
 		if (targs.status != 100) {
 			ast_moh_stop(chan);
 			if (targs.followmeflags.flags & FOLLOWMEFLAG_UNREACHABLEMSG) 
-				ast_stream_and_wait(chan, targs.sorryprompt, chan->language, "");
+				ast_stream_and_wait(chan, targs.sorryprompt, "");
 			res = 0;
 		} else {
 			caller = chan;

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Nov 17 17:18:51 2006
@@ -2147,7 +2147,7 @@
 	snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
 	RETRIEVE(fn, -1);
 	if (ast_fileexists(fn, NULL, NULL) > 0) {
-		res = ast_stream_and_wait(chan, fn, chan->language, ecodes);
+		res = ast_stream_and_wait(chan, fn, ecodes);
 		if (res) {
 			DISPOSE(fn, -1);
 			return res;
@@ -2155,14 +2155,14 @@
 	} else {
 		/* Dispose just in case */
 		DISPOSE(fn, -1);
-		res = ast_stream_and_wait(chan, "vm-theperson", chan->language, ecodes);
+		res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
 		if (res)
 			return res;
 		res = ast_say_digit_str(chan, ext, ecodes, chan->language);
 		if (res)
 			return res;
 	}
-	res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language, ecodes);
+	res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", ecodes);
 	return res;
 }
 
@@ -2929,7 +2929,7 @@
 		res = 0;
 	}
 	if (!res && !ast_test_flag(options, OPT_SILENT)) {
-		res = ast_stream_and_wait(chan, INTRO, chan->language, ecodes);
+		res = ast_stream_and_wait(chan, INTRO, ecodes);
 		if (res == '#') {
 			ast_set_flag(options, OPT_SILENT);
 			res = 0;
@@ -3043,7 +3043,7 @@
 		/* Now play the beep once we have the message number for our next message. */
 		if (res >= 0) {
 			/* Unless we're *really* silent, try to send the beep */
-			res = ast_stream_and_wait(chan, "beep", chan->language, "");
+			res = ast_stream_and_wait(chan, "beep", "");
 		}
 				
 		/* Store information */
@@ -4156,7 +4156,7 @@
 static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
 {
 	int res;
-	if ((res = ast_stream_and_wait(chan, file, chan->language, AST_DIGIT_ANY)) < 0) 
+	if ((res = ast_stream_and_wait(chan, file, AST_DIGIT_ANY)) < 0) 
 		ast_log(LOG_WARNING, "Unable to play message %s\n", file); 
 	return res;
 }
@@ -4287,7 +4287,7 @@
 							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
 						if (!callback)
 							res = wait_file2(chan, vms, "vm-from");
-						res = ast_stream_and_wait(chan, prefile, chan->language, "");
+						res = ast_stream_and_wait(chan, prefile, "");
 					} else {
 						if (option_verbose > 2)
 							ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
@@ -8005,7 +8005,7 @@
 				/* Otherwise 1 is to save the existing message */
 				if (option_verbose > 2)
 					ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
-				ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
+				ast_stream_and_wait(chan, "vm-msgsaved", "");
 				cmd = 't';
 				return res;
 			}
@@ -8013,7 +8013,7 @@
 			/* Review */
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
-			cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
+			cmd = ast_stream_and_wait(chan, recordfile, AST_DIGIT_ANY);
 			break;
 		case '3':
 			message_exists = 0;

Modified: trunk/include/asterisk/file.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/file.h?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/include/asterisk/file.h (original)
+++ trunk/include/asterisk/file.h Fri Nov 17 17:18:51 2006
@@ -168,8 +168,7 @@
  * Return 0 if success, -1 if error, digit if interrupted by a digit.
  * If digits == "" then we can simply check for non-zero.
  */
-int ast_stream_and_wait(struct ast_channel *chan, const char *file,
-	const char *language, const char *digits);
+int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits);
 
 /*! Stops a stream */
 /*!

Modified: trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/trunk/main/app.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Fri Nov 17 17:18:51 2006
@@ -541,7 +541,7 @@
 		if (!beep)
 			d = ast_play_and_wait(chan, playfile);
 		if (d > -1)
-			d = ast_stream_and_wait(chan, "beep", chan->language, "");
+			d = ast_stream_and_wait(chan, "beep", "");
 		if (d < 0)
 			return -1;
 	}
@@ -757,7 +757,7 @@
 		ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
 	}
 	if (outmsg == 2) {
-		ast_stream_and_wait(chan, "auth-thankyou", chan->language, "");
+		ast_stream_and_wait(chan, "auth-thankyou", "");
 	}
 	if (sildet)
 		ast_dsp_free(sildet);
@@ -1015,14 +1015,14 @@
 				cmd = '3';
 				break;
 			} else {
-				ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
+				ast_stream_and_wait(chan, "vm-msgsaved", "");
 				cmd = 't';
 				return res;
 			}
 		case '2':
 			/* Review */
 			ast_verbose(VERBOSE_PREFIX_3 "Reviewing the recording\n");
-			cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
+			cmd = ast_stream_and_wait(chan, recordfile, AST_DIGIT_ANY);
 			break;
 		case '3':
 			message_exists = 0;
@@ -1109,14 +1109,14 @@
 	case AST_ACTION_NOOP:
 		return 0;
 	case AST_ACTION_BACKGROUND:
-		res = ast_stream_and_wait(chan, (char *)option->adata, chan->language, AST_DIGIT_ANY);
+		res = ast_stream_and_wait(chan, (char *)option->adata, 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_stream_and_wait(chan, (char *)option->adata, chan->language, "");
+		res = ast_stream_and_wait(chan, (char *)option->adata, "");
 		if (res < 0) {
 			ast_log(LOG_NOTICE, "Unable to find file '%s'!\n", (char *)option->adata);
 			res = 0;
@@ -1145,7 +1145,7 @@
 		res = 0;
 		c = ast_strdupa(option->adata);
 		while ((n = strsep(&c, ";"))) {
-			if ((res = ast_stream_and_wait(chan, n, chan->language,
+			if ((res = ast_stream_and_wait(chan, n,
 					(option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
 				break;
 		}

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Nov 17 17:18:51 2006
@@ -3599,17 +3599,17 @@
 	}
 	
 	if (!strcmp(sound,"timeleft")) {	/* Queue support */
-		ast_stream_and_wait(chan, "vm-youhave", chan->language, "");
+		ast_stream_and_wait(chan, "vm-youhave", "");
 		if (min) {
 			ast_say_number(chan, min, AST_DIGIT_ANY, chan->language, NULL);
-			ast_stream_and_wait(chan, "queue-minutes", chan->language, "");
+			ast_stream_and_wait(chan, "queue-minutes", "");
 		}
 		if (sec) {
 			ast_say_number(chan, sec, AST_DIGIT_ANY, chan->language, NULL);
-			ast_stream_and_wait(chan, "queue-seconds", chan->language, "");
+			ast_stream_and_wait(chan, "queue-seconds", "");
 		}
 	} else {
-		ast_stream_and_wait(chan, sound, chan->language, "");
+		ast_stream_and_wait(chan, sound, "");
 	}
 
 	ast_autoservice_stop(peer);

Modified: trunk/main/file.c
URL: http://svn.digium.com/view/asterisk/trunk/main/file.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Fri Nov 17 17:18:51 2006
@@ -1118,12 +1118,11 @@
  * Return 0 if success, -1 if error, digit if interrupted by a digit.
  * If digits == "" then we can simply check for non-zero.
  */
-int ast_stream_and_wait(struct ast_channel *chan, const char *file,
-	const char *language, const char *digits)
+int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
 {
         int res = 0;
         if (!ast_strlen_zero(file)) {
-                res =  ast_streamfile(chan, file, language);
+                res = ast_streamfile(chan, file, chan->language);
                 if (!res)
                         res = ast_waitstream(chan, digits);
         }

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=47821&r1=47820&r2=47821
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Fri Nov 17 17:18:51 2006
@@ -547,7 +547,7 @@
 	if (!ast_strlen_zero(courtesytone)) {
 		if (ast_autoservice_start(callee_chan))
 			return -1;
-		if (ast_stream_and_wait(caller_chan, courtesytone, caller_chan->language, "")) {
+		if (ast_stream_and_wait(caller_chan, courtesytone, "")) {
 			ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
 			ast_autoservice_stop(callee_chan);
 			return -1;
@@ -652,7 +652,7 @@
 	memset(xferto, 0, sizeof(xferto));
 	
 	/* Transfer */
-	res = ast_stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
+	res = ast_stream_and_wait(transferer, "pbx-transfer", AST_DIGIT_ANY);
 	if (res < 0) {
 		finishup(transferee);
 		return -1; /* error ? */
@@ -702,7 +702,7 @@
 		if (option_verbose > 2)	
 			ast_verbose(VERBOSE_PREFIX_3 "Unable to find extension '%s' in context '%s'\n", xferto, transferer_real_context);
 	}
-	if (ast_stream_and_wait(transferer, xferfailsound, transferer->language, AST_DIGIT_ANY) < 0 ) {
+	if (ast_stream_and_wait(transferer, xferfailsound, AST_DIGIT_ANY) < 0 ) {
 		finishup(transferee);
 		return -1;
 	}
@@ -751,7 +751,7 @@
 	ast_indicate(transferee, AST_CONTROL_HOLD);
 	
 	/* Transfer */
-	res = ast_stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
+	res = ast_stream_and_wait(transferer, "pbx-transfer", AST_DIGIT_ANY);
 	if (res < 0) {
 		finishup(transferee);
 		return res;
@@ -768,7 +768,7 @@
 	if (res == 0) {
 		ast_log(LOG_WARNING, "Did not read data.\n");
 		finishup(transferee);
-		if (ast_stream_and_wait(transferer, "beeperr", transferer->language, ""))
+		if (ast_stream_and_wait(transferer, "beeperr", ""))
 			return -1;
 		return FEATURE_RETURN_SUCCESS;
 	}
@@ -777,7 +777,7 @@
 	if (!ast_exists_extension(transferer, transferer_real_context, xferto, 1, transferer->cid.cid_num)) {
 		ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
 		finishup(transferee);
-		if (ast_stream_and_wait(transferer, "beeperr", transferer->language, ""))
+		if (ast_stream_and_wait(transferer, "beeperr", ""))
 			return -1;
 		return FEATURE_RETURN_SUCCESS;
 	}
@@ -791,7 +791,7 @@
 		finishup(transferee);
 		/* any reason besides user requested cancel and busy triggers the failed sound */
 		if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY &&
-				ast_stream_and_wait(transferer, xferfailsound, transferer->language, ""))
+				ast_stream_and_wait(transferer, xferfailsound, ""))
 			return -1;
 		return FEATURE_RETURN_SUCCESS;
 	}
@@ -804,7 +804,7 @@
 	res = ast_bridge_call(transferer, newchan, &bconfig);
 	if (newchan->_softhangup || newchan->_state != AST_STATE_UP || !transferer->_softhangup) {
 		ast_hangup(newchan);
-		if (ast_stream_and_wait(transferer, xfersound, transferer->language, ""))
+		if (ast_stream_and_wait(transferer, xfersound, ""))
 			ast_log(LOG_WARNING, "Failed to play transfer sound!\n");
 		finishup(transferee);
 		transferer->_softhangup = 0;
@@ -856,7 +856,7 @@
 	tobj->peer = newchan;
 	tobj->bconfig = *config;
 
-	if (ast_stream_and_wait(newchan, xfersound, newchan->language, ""))
+	if (ast_stream_and_wait(newchan, xfersound, ""))
 		ast_log(LOG_WARNING, "Failed to play transfer sound!\n");
 	ast_bridge_call_thread_launch(tobj);
 	return -1;	/* XXX meaning the channel is bridged ? */
@@ -1794,9 +1794,9 @@
 			int error = 0;
 			ast_indicate(peer, AST_CONTROL_UNHOLD);
 			if (parkedplay == 0) {
-				error = ast_stream_and_wait(chan, courtesytone, chan->language, "");
+				error = ast_stream_and_wait(chan, courtesytone, "");
 			} else if (parkedplay == 1) {
-				error = ast_stream_and_wait(peer, courtesytone, chan->language, "");
+				error = ast_stream_and_wait(peer, courtesytone, "");
 			} else if (parkedplay == 2) {
 				if (!ast_streamfile(chan, courtesytone, chan->language) &&
 						!ast_streamfile(peer, courtesytone, chan->language)) {
@@ -1842,7 +1842,7 @@
 		return res;
 	} else {
 		/*! \todo XXX Play a message XXX */
-		if (ast_stream_and_wait(chan, "pbx-invalidpark", chan->language, ""))
+		if (ast_stream_and_wait(chan, "pbx-invalidpark", ""))
 			ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", "pbx-invalidpark", chan->name);
 		if (option_verbose > 2) 
 			ast_verbose(VERBOSE_PREFIX_3 "Channel %s tried to talk to nonexistent parked call %d\n", chan->name, park);



More information about the svn-commits mailing list