diff options
Diffstat (limited to 'apps/app_waitforsilence.c')
-rw-r--r-- | apps/app_waitforsilence.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index fb76f9134..fe4b1e14d 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -125,7 +125,7 @@ static char *app_noise = "WaitForNoise"; static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, int timeout, int wait_for_silence) { struct ast_frame *f = NULL; int dsptime = 0; - int rfmt = 0; + struct ast_format rfmt; int res = 0; struct ast_dsp *sildet; /* silence detector dsp */ time_t now; @@ -134,8 +134,8 @@ static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, int (*ast_dsp_func)(struct ast_dsp*, struct ast_frame*, int*) = wait_for_silence ? ast_dsp_silence : ast_dsp_noise; - rfmt = chan->readformat; /* Set to linear mode */ - if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) { + ast_format_copy(&rfmt, &chan->readformat); /* Set to linear mode */ + if ((res = ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR)) < 0) { ast_log(LOG_WARNING, "Unable to set channel to linear mode, giving up\n"); return -1; } @@ -195,8 +195,8 @@ static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, } - if (rfmt && ast_set_read_format(chan, rfmt)) { - ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name); + if (rfmt.id && ast_set_read_format(chan, &rfmt)) { + ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(&rfmt), chan->name); } ast_dsp_free(sildet); return res; |