asterisk and zaptel patches

Luigi Rizzo rizzo at
Wed Apr 20 10:27:10 PDT 2005

[sorry for the crosspost to -net, but it's relevant there too;
please followup to multimedia@ only]

following a discussion on developers@, i am posting here some
patches for asterisk and the zaptel drivers.
If someone feels like committing these, please go ahead.
I am attaching a description below.

These patches are useful to make asterisk and the zaptel drivers
work better with FreeBSD.

In particular:

  + The "wilcalu" module has a bug in the use of poll().
    FreeBSD's poll() always checks for exceptions, even if they
    are not in the mask passed to the system call. The code in
    the module however does not handle this condition, resulting
    in an infinite loop around poll() using all available CPU cycles.
    The patch in ast20050420b.diff only implements a workaround --
    if no data is readable, sleep for 1 second and saving the cpu
    for others. I suggest to disable the module, anyways, until a
    better fix is available.
  + The rtp module at times complains about invalid RTP checksums,
    when all it happens is that there is no data on a socket to read.
    I believe this is a perfectly normal event, so the patch in
    ast20050420b.diff removes the (misleading) error message altogether.
  + The chan_oss.c code is working very badly with the FreeBSD, partly
    because of issues in the driver and partly because the module
    itself was not very clean.
    ast20050420a.diff contains the diff wrt/ the version in the port,
    or if you like it better chan_oss.c contains the whole file.
    I have put in some workaround to limit the amount of data
    buffered in the driver (to keep the audio queue short), centralize
    repeated blocks of code, put global variables into the "oss" structure,
    and in general tried to clean the half-duplex support which, however,
    i suspect is still broken and probably useless anyways.

  + the zaptel device driver has bugs in the module loading glue which
    prevent it from probing the card appropriately in FreeBSD 4.x
    The patches patch-zz1 and patch-zz2 (suitable to be put in
    /usr/ports/misc/zaptel/files) fix the problem

-- freebsd audio driver --
  + some of the ioctls are not completely implemented causing unexpected
    results (e.g. setting block sizes etc). On top of this, individual
    device drivers also have issues in the handling of blocksizes,
    with results ranging from no or stuttering sound to large delays
    in the audio playback. While it would be great to fix the driver,
    the problem is that the issues affect so many versions of FreeBSD
    that a solution in user space is still preferable if possible.
    Nevertheless, a simple patch for sys/dev/sound/pci/ich.c is
    attached in ich.c.diff -- this driver (which supports the Intel 82801
    chipset) in most cases defaults to using only 2 8K buffers, which
    at the speeds of interest for telephony result in interrupts being
    250ms apart, way too slow. This patch uses the closest buffer size
    compatible with the request, guaranteeing up to 32 interrupts/s
    if small blocks are used. The driver still has a 500ms delay in
    the output channel at 8KHz, but fixing that requires a more complex

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ast.tgz
Type: application/octet-stream
Size: 18793 bytes
Desc: not available
Url :

More information about the freebsd-multimedia mailing list