[Asterisk-cvs] asterisk/apps app_zapras.c,1.10,1.11

kpfleming at lists.digium.com kpfleming at lists.digium.com
Tue Jul 5 21:33:01 CDT 2005


Update of /usr/cvsroot/asterisk/apps
In directory localhost.localdomain:/tmp/cvs-serv3029/apps

Modified Files:
	app_zapras.c 
Log Message:
ensure buffer policy is restored after RAS is done with a channel (bug #4589, slightly simpler fix)


Index: app_zapras.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_zapras.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- app_zapras.c	6 Jun 2005 22:39:32 -0000	1.10
+++ app_zapras.c	6 Jul 2005 01:41:54 -0000	1.11
@@ -130,8 +130,14 @@
 	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 @@
 			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;
 		}
 	}




More information about the svn-commits mailing list