Articles

Some notes we've thrown together.

Here are a few articles we've prepared on technical topics which other people may find helpful.

Getting Asterisk, Zaptel, and ztdummy working under FreeBSD v6.x :


What follows below are my continuing notes and experiences in regards to setting up the ztdummy driver under FreeBSD v6.x. The installation and testing performed below were all attempted using FreeBSD v6.1.

When first attempting to make use of the MeetMe (conference room) features of the Asterisk PBX software on FreeBSD, a crash would occur, thus disconnecting the telephone. I checked the Asterisk console for clues, and discovered the following messages :

-- Executing MeetMe("SIP/501-b15c", "54321") in new stack
== Parsing '/usr/local/etc/asterisk/meetme.conf': Found
Jul 11 03:13:19 WARNING[1074]: chan_zap.c:916 zt_open: Unable to open '/dev/zap/pseudo': No such file or directory
Jul 11 03:13:19 ERROR[1074]: chan_zap.c:7439 chandup: Unable to dup channel: No such file or directory
Jul 11 03:13:19 WARNING[1074]: app_meetme.c:466 build_conf: Unable to open pseudo channel - trying device
Jul 11 03:13:19 WARNING[1074]: app_meetme.c:469 build_conf: Unable to open pseudo device
-- Playing 'conf-invalid' (language 'en')
== Spawn extension (blah, 555, 1) exited non-zero on 'SIP/501-b15c'

Some additional checking on the internet revealed that the drivers for Zaptel hardware typically need to be installed.

The Zaptel Drivers


When running an Asterisk PBX under FreeBSD, certain telephony features such as conferencing (aka the MeetMe feature) require an external timer in order to function properly. This timer is often provided by the Zaptel hardware drivers. However, if you are using a non-Zaptel configuration, such as on a completely SIP-based telephony setup, you probably won't have the drivers for Zaptel hardware installed and configured. To make matters worse, the Zaptel drivers have only recently been ported to FreeBSD in a stable manner, so they seem to be a recent development on the platform.

A few steps are required to get the drivers running. Below are my experiences adding the Zaptel drivers to an existing FreeBSD-based Asterisk PBX in early July 2006. You should also be aware that some reports indicate the Zaptel drivers for FreeBSD only work correctly under FreeBSD v5.x or v6.x, so you may need to upgrade your base installation.

Step 1 : Install the Zaptel Drivers
Ensuring your ports collection is up to date, you can install the Zaptel drivers from /usr/ports/misc/zaptel.

Step 2 : Copy over the Zaptel startup script
Upon installation, the zaptel drivers install a startup script in /usr/local/etc/rc.d. This will likely be alongside your Asterisk startup script, and any others you may already have installed there. The zaptel installation process asks you to rename zaptel.sh.sample to zaptel.sh in order to have the script start properly now that the drivers have been installed.

Step 3 : Edit the Zaptel startup script
For some reason, the zaptel.sh startup script provided doesn't include the necessary lines in order to load and unload the ztdummy.ko kernel module. For our purposes, this is important, since that ztdummy module is the entire reason for installing these drivers. Supposedly ztdummy provides a suitable dummy device which can be used by Asterisk for the objectives we are seeking here. So, we need to add a few lines to this startup script to ensure that ztdummy kernel module gets loaded and unloaded properly.

The original zaptel.sh file looks like this :

#!/bin/sh

PREFIX=/usr/local
LIBDIR=${PREFIX}/lib/zaptel

case "$1" in
start)
/sbin/kldload ${LIBDIR}/zaptel.ko || exit 1
/sbin/kldload ${LIBDIR}/qozap.ko || exit 1
/sbin/kldload ${LIBDIR}/wcfxo.ko || exit 1
/sbin/kldload ${LIBDIR}/wcfxs.ko || exit 1
/sbin/kldload ${LIBDIR}/wct1xxp.ko || exit 1
/sbin/kldload ${LIBDIR}/wct4xxp.ko || exit 1
/sbin/kldload ${LIBDIR}/wcte11xp.ko || exit 1
${PREFIX}/bin/ztcfg
echo -n " zaptel"
;;

stop)
/sbin/kldunload qozap.ko || exit 1
/sbin/kldunload wcfxs.ko || exit 1
/sbin/kldunload wcfxo.ko || exit 1
/sbin/kldunload wct1xxp.ko || exit 1
/sbin/kldunload wct4xxp.ko || exit 1
/sbin/kldunload wcte11xp.ko || exit 1
/sbin/kldunload zaptel.ko || exit 1
echo -n " zaptel"
;;

*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac

You need to add two additional lines in specific places, so as to allow proper loading and unloading of the ztdummy.ko kernel module. These new lines to be added are shown below in red.

#!/bin/sh

PREFIX=/usr/local
LIBDIR=${PREFIX}/lib/zaptel

case "$1" in
start)
/sbin/kldload ${LIBDIR}/zaptel.ko || exit 1
/sbin/kldload ${LIBDIR}/ztdummy.ko || exit 1
/sbin/kldload ${LIBDIR}/qozap.ko || exit 1
/sbin/kldload ${LIBDIR}/wcfxo.ko || exit 1
/sbin/kldload ${LIBDIR}/wcfxs.ko || exit 1
/sbin/kldload ${LIBDIR}/wct1xxp.ko || exit 1
/sbin/kldload ${LIBDIR}/wct4xxp.ko || exit 1
/sbin/kldload ${LIBDIR}/wcte11xp.ko || exit 1
${PREFIX}/bin/ztcfg
echo -n " zaptel"
;;

stop)
/sbin/kldunload qozap.ko || exit 1
/sbin/kldunload wcfxs.ko || exit 1
/sbin/kldunload wcfxo.ko || exit 1
/sbin/kldunload wct1xxp.ko || exit 1
/sbin/kldunload wct4xxp.ko || exit 1
/sbin/kldunload wcte11xp.ko || exit 1
/sbin/kldunload ztdummy.ko || exit 1
/sbin/kldunload zaptel.ko || exit 1
echo -n " zaptel"
;;

*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac

For whatever reason, the zaptel driver (v0.11) in the ports collection compiles and installs the ztdummy.ko kernel module when you install the port, but the startup script doesn't include reference to it. Adding those lines above seems to do the trick.

After adding those lines, and stopping Asterisk, I successfully started the Zaptel drivers script edited above, and then successfully started Asterisk. No problems were encountered, and Asterisk's MeetMe features (which previously would not work properly) were now all operational.

Configuring the MeetMe features of Asterisk are covered in great detail elsewhere, so I won't repeat that information here. Unfortunately, getting the FreeBSD ztdummy drivers working correctly was not. Hopefully the steps I have outlined above help you get your Asterisk PBX working to full potential on FreeBSD! As to whether or not these drivers actually work on physical Zaptel hardware, I will leave that exercise to others, but everything looks like they should.

Morals of the story


  • Use a modern (v5.x or v6.x) version of FreeBSD to ensure the Zaptel drivers will work properly for you.
  • Make sure your ports collection is updated to ensure you end up with a current version of the Zaptel drivers before installing.
  • Edit the zaptel.sh startup script to include the missing entries for loading and unloading the ztdummy.ko kernel module we're after.

Followup Notes :


Looks like the ported Zaptel drivers are still a bit buggy. On unloading them today, the following was seen :

Jul 11 22:53:36 www1 kernel: ztdummy: unloaded
Jul 11 22:53:36 www1 kernel: Unloaded kld character device driver
Jul 11 22:53:36 www1 kernel: Zapata Telephony Interface Unloaded
Jul 11 22:53:36 www1 kernel: Warning: memory type zaptel leaked memory on destroy (51 allocations, 30784 bytes leaked).
Jul 11 22:53:39 www1 syslogd: kernel boot file is /boot/kernel/kernel
Jul 11 22:53:39 www1 kernel:
Jul 11 22:53:39 www1 kernel:
Jul 11 22:53:39 www1 kernel: Fatal trap 12: page fault while in kernel mode
Jul 11 22:53:39 www1 kernel: fault virtual address = 0xc5e8cbac
Jul 11 22:53:39 www1 kernel: fault code = supervisor read, page not present
Jul 11 22:53:39 www1 kernel: instruction pointer = 0x20:0xc0670e1e
Jul 11 22:53:39 www1 kernel: stack pointer = 0x28:0xd6993b6c
Jul 11 22:53:39 www1 kernel: frame pointer = 0x28:0xd6993b94
Jul 11 22:53:39 www1 kernel: code segment = base 0x0, limit 0xfffff, type 0x1b
Jul 11 22:53:39 www1 kernel: = DPL 0, pres 1, def32 1, gran 1
Jul 11 22:53:39 www1 kernel: processor eflags = interrupt enabled, resume, IOPL = 0
Jul 11 22:53:39 www1 kernel: current process = 3121 (asterisk)
Jul 11 22:53:39 www1 kernel: trap number = 12
Jul 11 22:53:39 www1 kernel: panic: page fault
Jul 11 22:53:39 www1 kernel: Uptime: 62d11h29m44s
Jul 11 22:53:39 www1 kernel: Dumping 511 MB (2 chunks)
Jul 11 22:53:39 www1 kernel: chunk 0: 1MB (155 pages) ... ok
Jul 11 22:53:39 www1 kernel: chunk 1: 511MB (130800 pages) 495 479 463 447 431 415 399 383 367 351 335 319 303 287 271 255 239 223 207 191 175 159 143 127 111 95 79 63 47 31 15 ... ok
Jul 11 22:53:39 www1 kernel:
Jul 11 22:53:39 www1 kernel: Dump complete
Jul 11 22:53:39 www1 kernel: Automatic reboot in 15 seconds - press a key on the console to abort
Jul 11 22:53:39 www1 kernel: Rebooting...

Play slots online for real money https://onlineslots.money/

Get In Touch

Lets talk about your project or online needs!
Contact Us