mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 09:10:36 +00:00
convert to use ast_strem_and_wait
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1909,12 +1909,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);
|
snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
|
||||||
RETRIEVE(fn, -1);
|
RETRIEVE(fn, -1);
|
||||||
if (ast_fileexists(fn, NULL, NULL) > 0) {
|
if (ast_fileexists(fn, NULL, NULL) > 0) {
|
||||||
res = ast_streamfile(chan, fn, chan->language);
|
res = ast_stream_and_wait(chan, fn, chan->language, ecodes);
|
||||||
if (res) {
|
|
||||||
DISPOSE(fn, -1);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
res = ast_waitstream(chan, ecodes);
|
|
||||||
if (res) {
|
if (res) {
|
||||||
DISPOSE(fn, -1);
|
DISPOSE(fn, -1);
|
||||||
return res;
|
return res;
|
||||||
@@ -1922,20 +1917,14 @@ static int invent_message(struct ast_channel *chan, char *context, char *ext, in
|
|||||||
} else {
|
} else {
|
||||||
/* Dispose just in case */
|
/* Dispose just in case */
|
||||||
DISPOSE(fn, -1);
|
DISPOSE(fn, -1);
|
||||||
res = ast_streamfile(chan, "vm-theperson", chan->language);
|
res = ast_stream_and_wait(chan, "vm-theperson", chan->language, ecodes);
|
||||||
if (res)
|
|
||||||
return -1;
|
|
||||||
res = ast_waitstream(chan, ecodes);
|
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
res = ast_say_digit_str(chan, ext, ecodes, chan->language);
|
res = ast_say_digit_str(chan, ext, ecodes, chan->language);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = ast_streamfile(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language);
|
res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", chan->language, ecodes);
|
||||||
if (res)
|
|
||||||
return -1;
|
|
||||||
res = ast_waitstream(chan, ecodes);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2459,9 +2448,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
|
|||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
if (!res && !ast_test_flag(options, OPT_SILENT)) {
|
if (!res && !ast_test_flag(options, OPT_SILENT)) {
|
||||||
res = ast_streamfile(chan, INTRO, chan->language);
|
res = ast_stream_and_wait(chan, INTRO, chan->language, ecodes);
|
||||||
if (!res)
|
|
||||||
res = ast_waitstream(chan, ecodes);
|
|
||||||
if (res == '#') {
|
if (res == '#') {
|
||||||
ast_set_flag(options, OPT_SILENT);
|
ast_set_flag(options, OPT_SILENT);
|
||||||
res = 0;
|
res = 0;
|
||||||
@@ -2536,9 +2523,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. */
|
/* Now play the beep once we have the message number for our next message. */
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
/* Unless we're *really* silent, try to send the beep */
|
/* Unless we're *really* silent, try to send the beep */
|
||||||
res = ast_streamfile(chan, "beep", chan->language);
|
res = ast_stream_and_wait(chan, "beep", chan->language, "");
|
||||||
if (!res)
|
|
||||||
res = ast_waitstream(chan, "");
|
|
||||||
}
|
}
|
||||||
if (msgnum < vmu->maxmsg) {
|
if (msgnum < vmu->maxmsg) {
|
||||||
/* assign a variable with the name of the voicemail file */
|
/* assign a variable with the name of the voicemail file */
|
||||||
@@ -2624,9 +2609,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
|
|||||||
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS");
|
||||||
} else {
|
} else {
|
||||||
ast_unlock_path(dir);
|
ast_unlock_path(dir);
|
||||||
res = ast_streamfile(chan, "vm-mailboxfull", chan->language);
|
res = ast_stream_and_wait(chan, "vm-mailboxfull", chan->language, "");
|
||||||
if (!res)
|
|
||||||
res = ast_waitstream(chan, "");
|
|
||||||
ast_log(LOG_WARNING, "No more messages possible\n");
|
ast_log(LOG_WARNING, "No more messages possible\n");
|
||||||
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
||||||
}
|
}
|
||||||
@@ -3574,10 +3557,8 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
|
|||||||
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
|
static int wait_file2(struct ast_channel *chan, struct vm_state *vms, char *file)
|
||||||
{
|
{
|
||||||
int res;
|
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);
|
ast_log(LOG_WARNING, "Unable to play message %s\n", file);
|
||||||
if (!res)
|
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3694,8 +3675,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);
|
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: CID number '%s' matches mailbox number, playing recorded name\n", callerid);
|
||||||
if (!callback)
|
if (!callback)
|
||||||
res = wait_file2(chan, vms, "vm-from");
|
res = wait_file2(chan, vms, "vm-from");
|
||||||
res = ast_streamfile(chan, prefile, chan->language) > -1;
|
res = ast_stream_and_wait(chan, prefile, chan->language, "");
|
||||||
res = ast_waitstream(chan, "");
|
|
||||||
} else {
|
} else {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
|
ast_verbose(VERBOSE_PREFIX_3 "Playing envelope info: message from '%s'\n", callerid);
|
||||||
@@ -6691,8 +6671,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
|||||||
/* Otherwise 1 is to save the existing message */
|
/* Otherwise 1 is to save the existing message */
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
|
ast_verbose(VERBOSE_PREFIX_3 "Saving message as is\n");
|
||||||
ast_streamfile(chan, "vm-msgsaved", chan->language);
|
ast_stream_and_wait(chan, "vm-msgsaved", chan->language, "");
|
||||||
ast_waitstream(chan, "");
|
|
||||||
STORE(recordfile, vmu->mailbox, vmu->context, -1);
|
STORE(recordfile, vmu->mailbox, vmu->context, -1);
|
||||||
DISPOSE(recordfile, -1);
|
DISPOSE(recordfile, -1);
|
||||||
cmd = 't';
|
cmd = 't';
|
||||||
@@ -6702,8 +6681,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
|||||||
/* Review */
|
/* Review */
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
|
ast_verbose(VERBOSE_PREFIX_3 "Reviewing the message\n");
|
||||||
ast_streamfile(chan, recordfile, chan->language);
|
cmd = ast_stream_and_wait(chan, recordfile, chan->language, AST_DIGIT_ANY);
|
||||||
cmd = ast_waitstream(chan, AST_DIGIT_ANY);
|
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
message_exists = 0;
|
message_exists = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user