summaryrefslogtreecommitdiff
path: root/apps/app_zapras.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-07-06 01:41:54 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-07-06 01:41:54 +0000
commit8b19bdba36fdde8e02f689bf0dcdec7ed1172414 (patch)
tree2d8b21febbe517700fdaed57de6aa2b9252000e4 /apps/app_zapras.c
parent9403a6e027d21485cb3c0ee1b0f7edf66e255577 (diff)
ensure buffer policy is restored after RAS is done with a channel (bug #4589, slightly simpler fix)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_zapras.c')
-rwxr-xr-xapps/app_zapras.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index 69900ea44..faed71565 100755
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -130,8 +130,14 @@ static void run_ras(struct ast_channel *chan, char *args)
int status;
int res;
int signalled = 0;
- struct zt_bufferinfo bi;
+ struct zt_bufferinfo savebi;
int x;
+
+ res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &savebi);
+ if(res) {
+ ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
+ return;
+ }
pid = spawn_ras(chan, args);
if (pid < 0) {
@@ -167,20 +173,11 @@ static void run_ras(struct ast_channel *chan, char *args)
x = 1;
ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
- /* Double check buffering too */
- res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &bi);
- if (!res) {
- /* XXX This is ZAP_BLOCKSIZE XXX */
- bi.bufsize = 204;
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.numbufs = 4;
- res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &bi);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
- }
- } else
- ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
+ /* Restore saved values */
+ res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &savebi);
+ if (res < 0) {
+ ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
+ }
break;
}
}