diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-17 23:18:51 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-17 23:18:51 +0000 |
commit | 9ed9bbabf4b8ff0294c44090db38596e4372f7ab (patch) | |
tree | a3f2ce4fd65d5aa1475c1c2759546c3e95ee294f | |
parent | 9c024540238f1c193d392978b6d7517a75c54e6a (diff) |
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.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47821 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | apps/app_directory.c | 10 | ||||
-rw-r--r-- | apps/app_followme.c | 4 | ||||
-rw-r--r-- | apps/app_voicemail.c | 18 | ||||
-rw-r--r-- | include/asterisk/file.h | 3 | ||||
-rw-r--r-- | main/app.c | 14 | ||||
-rw-r--r-- | main/channel.c | 8 | ||||
-rw-r--r-- | main/file.c | 5 | ||||
-rw-r--r-- | res/res_features.c | 24 |
8 files changed, 42 insertions, 44 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c index 14d5dd61a..3b1d29e11 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -282,17 +282,17 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, #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 @@ static int play_mailbox_owner(struct ast_channel *chan, char *context, 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 @@ static int directory_exec(struct ast_channel *chan, void *data) 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); diff --git a/apps/app_followme.c b/apps/app_followme.c index f83cfa165..27667b22f 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -982,7 +982,7 @@ static int app_exec(struct ast_channel *chan, void *data) 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 @@ static int app_exec(struct ast_channel *chan, void *data) 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; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 14531240f..dbf306ec3 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2147,7 +2147,7 @@ static int invent_message(struct ast_channel *chan, char *context, char *ext, in 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 @@ static int invent_message(struct ast_channel *chan, char *context, char *ext, in } 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 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ 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 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ /* 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 forward_message(struct ast_channel *chan, char *context, struct vm_st 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 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, 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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re /* 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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re /* 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; diff --git a/include/asterisk/file.h b/include/asterisk/file.h index 029bcf25d..81aab3d03 100644 --- a/include/asterisk/file.h +++ b/include/asterisk/file.h @@ -168,8 +168,7 @@ int ast_streamfile(struct ast_channel *c, const char *filename, const char *pref * 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 */ /*! diff --git a/main/app.c b/main/app.c index b00deb885..91365f37d 100644 --- a/main/app.c +++ b/main/app.c @@ -541,7 +541,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, 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 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, 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 @@ int ast_record_review(struct ast_channel *chan, const char *playfile, const char 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 @@ static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, 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 @@ static int ivr_dispatch(struct ast_channel *chan, struct ast_ivr_option *option, 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; } diff --git a/main/channel.c b/main/channel.c index 8dff68a65..a83de5b53 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3599,17 +3599,17 @@ static void bridge_playfile(struct ast_channel *chan, struct ast_channel *peer, } 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); diff --git a/main/file.c b/main/file.c index c6262bf89..cd6afb9bd 100644 --- a/main/file.c +++ b/main/file.c @@ -1118,12 +1118,11 @@ int ast_waitstream_exten(struct ast_channel *c, const char *context) * 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); } diff --git a/res/res_features.c b/res/res_features.c index 5494d5a09..b1d50e59b 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -547,7 +547,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee 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 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p 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 @@ static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *p 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st 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 @@ static int park_exec(struct ast_channel *chan, void *data) 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 @@ static int park_exec(struct ast_channel *chan, void *data) 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); |