[asterisk-commits] trunk r22078 - /trunk/apps/app_voicemail.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Apr 21 13:51:57 MST 2006
Author: rizzo
Date: Fri Apr 21 15:51:55 2006
New Revision: 22078
URL: http://svn.digium.com/view/asterisk?rev=22078&view=rev
Log:
convert to use ast_strem_and_wait
Modified:
trunk/apps/app_voicemail.c
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=22078&r1=22077&r2=22078&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Apr 21 15:51:55 2006
@@ -1909,12 +1909,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_streamfile(chan, fn, chan->language);
- if (res) {
- DISPOSE(fn, -1);
- return -1;
- }
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, fn, chan->language, ecodes);
if (res) {
DISPOSE(fn, -1);
return res;
@@ -1922,20 +1917,14 @@
} else {
/* Dispose just in case */
DISPOSE(fn, -1);
- res = ast_streamfile(chan, "vm-theperson", chan->language);
- if (res)
- return -1;
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, "vm-theperson", chan->language, ecodes);
if (res)
return res;
res = ast_say_digit_str(chan, ext, ecodes, chan->language);
if (res)
return res;
}
- res = ast_streamfile(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language);
- if (res)
- return -1;
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language, ecodes);
return res;
}
@@ -2459,9 +2448,7 @@
res = 0;
}
if (!res && !ast_test_flag(options, OPT_SILENT)) {
- res = ast_streamfile(chan, INTRO, chan->language);
- if (!res)
- res = ast_waitstream(chan, ecodes);
+ res = ast_stream_and_wait(chan, INTRO, chan->language, ecodes);
if (res == '#') {
ast_set_flag(options, OPT_SILENT);
res = 0;
@@ -2536,9 +2523,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_streamfile(chan, "beep", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, "beep", chan->language, "");
}
if (msgnum < vmu->maxmsg) {
/* assign a variable with the name of the voicemail file */
@@ -2624,9 +2609,7 @@
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
} else {
ast_unlock_path(dir);
- res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
- if (!res)
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, "vm-mailboxfull", chan->language, "");
ast_log(LOG_WARNING, "No more messages possible\n");
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
}
@@ -3574,10 +3557,8 @@
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
{
int res;
- if ((res = ast_streamfile(chan, file, chan->language)))
+ if ((res = ast_stream_and_wait(chan, file, chan->language, AST_DIGIT_ANY)) < 0)
ast_log(LOG_WARNING, "Unable to play message %s\n", file);
- if (!res)
- res = ast_waitstream(chan, AST_DIGIT_ANY);
return res;
}
@@ -3694,8 +3675,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_streamfile(chan, prefile, chan->language) > -1;
- res = ast_waitstream(chan, "");
+ res = ast_stream_and_wait(chan, prefile, chan->language, "");
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
@@ -6691,8 +6671,7 @@
/* Otherwise 1 is to save the existing message */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
- ast_streamfile(chan, "vm-msgsaved", chan->language);
- ast_waitstream(chan, "");
+ ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
STORE(recordfile, vmu->mailbox, vmu->context, -1);
DISPOSE(recordfile, -1);
cmd = 't';
@@ -6702,8 +6681,7 @@
/* Review */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\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;
More information about the asterisk-commits
mailing list