[Asterisk-Dev] ZapRAS

Daniel Nyström daniel.nystrom at westel.se
Thu Jun 23 05:24:58 MST 2005


I've finally find the problem with ZapRAS destroying the sound of the 
Zap-channel it's using.
It seems like the buffer info is written with something not quite right 
information.
After saving the buffer info before exec:ing the pppd daemon, and then 
use that values, it doesn't destroy the sound anymore!

This is the section causing the problem:

-- SNIP --
	//* 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);

-- SNIP --


This is what I did:
-- SNIP --

	*struct* zt_bufferinfo bi, bakbi;
	*int* x;

	ioctl(chan->fds[0], ZT_GET_BUFINFO, &bakbi);

	pid = spawn_ras(chan, args);
-- SNIP --

And below:
-- SNIP --
		//* XXX This is ZAP_BLOCKSIZE XXX *//
		bi.bufsize = bakbi.bufsize;
		bi.txbufpolicy = bakbi.txbufpolicy;
		bi.rxbufpolicy = bakbi.rxbufpolicy;
		bi.numbufs = bakbi.numbufs;
		res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &bi);
		*if* (res < 0) {

-- SNIP --

In all haste, I didn't check the zt_bufferinfo. It might only has to change into this as well:

-- SNIP --
		res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &bakbi);
-- SNIP --

All this is in 1.0.6 and 1.0.7.

What do you people think? Why change the buffer at all? Maybe there is a much better way to fix this?
I'm too little into this code myself right now, so please take a look!
--
Daniel





More information about the asterisk-dev mailing list