mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 00:24:05 +00:00
allow multiple exit characters on control_streamfile, allow '1' to skip envelope
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
27
app.c
27
app.c
@@ -411,20 +411,23 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
|||||||
{
|
{
|
||||||
struct timeval started, ended;
|
struct timeval started, ended;
|
||||||
long elapsed = 0,last_elapsed =0;
|
long elapsed = 0,last_elapsed =0;
|
||||||
char breaks[5];
|
char *breaks;
|
||||||
int x=0,res=0;
|
int blen=2;
|
||||||
|
int res=0;
|
||||||
|
|
||||||
|
if (stop)
|
||||||
|
blen += strlen(stop);
|
||||||
|
if (pause)
|
||||||
|
blen += strlen(pause);
|
||||||
|
|
||||||
|
breaks = alloca(blen + 1);
|
||||||
|
breaks[0] = '\0';
|
||||||
|
strcat(breaks, stop);
|
||||||
|
strcat(breaks, pause);
|
||||||
|
|
||||||
if (chan->_state != AST_STATE_UP)
|
if (chan->_state != AST_STATE_UP)
|
||||||
res = ast_answer(chan);
|
res = ast_answer(chan);
|
||||||
|
|
||||||
if (stop != NULL && stop[0]) {
|
|
||||||
breaks[x++] = stop[0];
|
|
||||||
}
|
|
||||||
if (pause != NULL && pause[0]) {
|
|
||||||
breaks[x++] = pause[0];
|
|
||||||
}
|
|
||||||
breaks[x] = '\0';
|
|
||||||
|
|
||||||
if (chan)
|
if (chan)
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
|
||||||
@@ -449,14 +452,14 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
|||||||
if (res < 1)
|
if (res < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (pause != NULL && res == *pause) {
|
if (pause != NULL && strchr(pause, res)) {
|
||||||
gettimeofday(&ended, NULL);
|
gettimeofday(&ended, NULL);
|
||||||
elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000) + last_elapsed);
|
elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000) + last_elapsed);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (chan)
|
if (chan)
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
res = ast_waitfordigit(chan, 1000);
|
res = ast_waitfordigit(chan, 1000);
|
||||||
if (res == -1 || res == *pause || (stop && res == *stop))
|
if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == *pause) {
|
if (res == *pause) {
|
||||||
|
@@ -2737,10 +2737,11 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc
|
|||||||
|
|
||||||
if ((!res)&&(vmu->envelope))
|
if ((!res)&&(vmu->envelope))
|
||||||
res = play_message_datetime(chan, vmu, origtime, filename);
|
res = play_message_datetime(chan, vmu, origtime, filename);
|
||||||
|
|
||||||
if ((!res)&&(vmu->saycid))
|
if ((!res)&&(vmu->saycid))
|
||||||
res = play_message_callerid(chan, vms, cid, context, 0);
|
res = play_message_callerid(chan, vms, cid, context, 0);
|
||||||
|
/* Allow pressing '1' to skip envelope / callerid */
|
||||||
|
if (res == '1')
|
||||||
|
res = 0;
|
||||||
ast_destroy(msg_cfg);
|
ast_destroy(msg_cfg);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
Reference in New Issue
Block a user