mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 08:11:21 +00:00
allow file arg in ast_control_streamfile to accept trailing :end to indicate an instant seek ti the end.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3824 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
app.c
12
app.c
@@ -416,6 +416,7 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
||||
struct timeval started, ended;
|
||||
long elapsed = 0,last_elapsed =0;
|
||||
char *breaks=NULL;
|
||||
char *end=NULL;
|
||||
int blen=2;
|
||||
int res=0;
|
||||
|
||||
@@ -436,6 +437,13 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
||||
if (chan)
|
||||
ast_stopstream(chan);
|
||||
|
||||
if(file) {
|
||||
end = strchr(file,':');
|
||||
if(!strcasecmp(end,":end")) {
|
||||
*end = '\0';
|
||||
end++;
|
||||
}
|
||||
}
|
||||
for (;;) {
|
||||
gettimeofday(&started,NULL);
|
||||
|
||||
@@ -443,6 +451,10 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
||||
ast_stopstream(chan);
|
||||
res = ast_streamfile(chan, file, chan->language);
|
||||
if (!res) {
|
||||
if(end) {
|
||||
ast_seekstream(chan->stream, 0, SEEK_END);
|
||||
end=NULL;
|
||||
}
|
||||
res = 1;
|
||||
if (elapsed) {
|
||||
ast_stream_fastforward(chan->stream, elapsed);
|
||||
|
||||
Reference in New Issue
Block a user