[asterisk-dev] problem: EINVAL on write in Zaptel channel file descriptor

Moises Silva moises.silva at gmail.com
Wed Mar 15 12:47:25 MST 2006


Hi. Im having some issues with Unicall libraries trying to receive

phone calls from our telco in Mexico (Avantel). The following is

a description of what i have done to find out the problem.



Installed zaptel drivers version 1.2.1



Installed spandsp-0.0.2pre20



Installed libsupertone-0.0.2



Installed libunicall-0.0.3



Installed libmfcr2-0.0.3



in libunicall comes a test program (testcall.c). I have configured properly

the program to accept calls in zaptel channels from 1 to 10.

setting up debug messages i found that the calls to



fd = open("/dev/zap/channel", O_RDWR | O_NONBLOCK)



are successfull, and that



ioctl(fd, ZT_SPECIFY, &chan)



are successfull too, so the file descriptor seems to be ok until that
moment.

The test program waits for events on the zaptel card, when detects CAS bits

from the telco starts doing its mfcr protocol thing returning other CAS code

to tell te telco to start sending tones. So far, so good. We receive
the tones

just fine, but when attempting to answer with the correct tone,
sometimes, the

call to



write(fd, buf, len)



to send the tone (generated using spandsp and encoded correctly to alaw )



the call returns -1 setting errno to EINVAL. This happens in about 1
of each 10 calls. so the
mfcr2.c code keeps trying to write, but the system call keeps
returning EINVAL.

so it seems that our telco timesout waiting for our tone, and return

to idle status, so our test program detects that and finish the call

with a protocol error because it was a non expected end of call.



Im using kernel 2.6.14 with some patches for quality of service



i will upgrade to the latest version of zaptel, but not sure if is the
right way to go



Any guidelines or advices to follow will be really appreciated.



Best Regards



- Moises Silva

--
"Su nombre es GNU/Linux, no solamente Linux, mas info en http://www.gnu.org"



More information about the asterisk-dev mailing list