aboutsummaryrefslogtreecommitdiffstats
path: root/app.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-01 18:50:18 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-01 18:50:18 +0000
commit4579b5ca619ff3b55b3f3f8572c2f45854386e44 (patch)
tree68c95d0587a0363b109c7404ed029dc377a557e0 /app.c
parentdfc91a3458edcc04b62ba8a1ba8bc9c9465ac640 (diff)
allow multiple exit characters on control_streamfile, allow '1' to skip envelope
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3123 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'app.c')
-rwxr-xr-xapp.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/app.c b/app.c
index 9b1700125..c3686f12f 100755
--- a/app.c
+++ b/app.c
@@ -411,20 +411,23 @@ 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[5];
- int x=0,res=0;
+ char *breaks;
+ 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)
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)
ast_stopstream(chan);
@@ -449,14 +452,14 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
if (res < 1)
break;
- if (pause != NULL && res == *pause) {
+ if (pause != NULL && strchr(pause, res)) {
gettimeofday(&ended, NULL);
elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000) + last_elapsed);
for(;;) {
if (chan)
ast_stopstream(chan);
res = ast_waitfordigit(chan, 1000);
- if (res == -1 || res == *pause || (stop && res == *stop))
+ if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
break;
}
if (res == *pause) {