I've been talking about my plans for configuring Asterisk in my home for a few days now. I said that I want users of the system to be able to access voicemail, dial out and make conference calls. The only one of these features that I haven't at least tried out is conference calling. Conference calls in Asterisk can be set up with an application called MeetMe. When reading up on how to set up a MeetMe conference I saw repeated references to a requirement for a timer module.
The reason a timer module is required is that Asterisk needs accurate timing to mix the two voice streams in real time. One method of timing uses special-purpose timer hardware on a PCI card that many Asterisk users have. My Asterisk server has no special hardware yet (though I did order an ATA today - the Linksys PAP2T-NA). The other method of getting a timer to work is by installing the ztdummy module. The module is called ztdummy because it works in lieu of a the real zaptel hardware device.
Today I'm sharing my notes on how I installed the ztdummy timer module. The ideas and some commands might be helpful, but keep in mind my situation is with a test server that's got no live calls. Don't blindly copy what I've done if you care much about keeping your server running.
The instructions I've found for installing ztdummy talk about building the module as part of a new Asterisk installation. I installed and didn't include the module. I have two choices: I could make a backup copy of all the files that I may have customized or created then do a fresh install of Asterisk or I could figure out how to add the module in. Making a backup and restoring it should be pretty easy for my install. I think all the stuff that I have to back up is listed in
/etc/asterisk/asterisk.conf, the directories in mine are the default ones:
[directories]
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run
astlogdir => /var/log/asterisk
So I'll make a quick backup like this:
ruby:/etc/asterisk # mkdir ~/astbackup
ruby:/etc/asterisk # mkdir ~/astbackup/astetcdir
ruby:/etc/asterisk # cp -R /etc/asterisk/* ~/astbackup/astetcdir
ruby:/etc/asterisk # mkdir ~/astbackup/astmoddir
ruby:/etc/asterisk # cp -R /usr/lib/asterisk/modules/* ~/astbackup/astmoddir
ruby:/etc/asterisk # mkdir ~/astbackup/astvarlibdir
ruby:/etc/asterisk # cp -R /var/lib/asterisk/* ~/astbackup/astvarlibdir
ruby:/etc/asterisk # mkdir ~/astbackup/astagidir
ruby:/etc/asterisk # cp -R /var/lib/asterisk/agi-bin/* ~/astbackup/astagidir
ruby:/etc/asterisk # mkdir ~/astbackup/astspooldir
ruby:/etc/asterisk # cp -R /var/spool/asterisk/* ~/astbackup/astspooldir
ruby:/etc/asterisk # mkdir ~/astbackup/astlogdir
ruby:/etc/asterisk # cp -R /var/log/asterisk/* ~/astbackup/astlogdir
Now I could re-install with ztdummy then copy each of those folders back from
/root/astbackup to their correct location (update: as it turns out, this is my only option so make this back up and any others you need now).
I'd rather learn a little more about the Asterisk build and where ztdummy ends up. So to start with I'm going to try just configuring a MeetMe conference room and see what behaviour or error messages I get. I like to know it's not working before I can say that I need to change something. I've also noticed that a lot of date on Asterisk can be dated - the project is still pretty young and it looks like there have been major improvements in the last year or so.
To create a meeting room I grabbed an example from voip-info - I put the line
exten => 500,1,MeetMe(101,,123456)
in my extensions.conf then went to the Asterisk console and issued the
reload command. When I attempt to call extension 500, I see a warning on the console that says
WARNING[16383]: pbx.c:1700 pbx_extension_helper: No application 'MeetMe' for extension (lesnet-incoming, 500, 1)
I think this might mean something about MeetMe not being compiled in to Asterisk. Could be something else though, so I looked at a book I found just today at the
Asterisk Documentation Project. On page 135 they talk about setting up conference rooms. I'm not sure which version of Asterisk they used, but I tried changing meetme.conf to add the conference room for my example. I added the line
conf => 101
under the
[rooms] section. Making the change made no difference to the error message, so I guess that indicates MeetMe isn't available.
Okay, enough farting around, let's get down to building the timer and whatever else we need. Looking back at
how I installed Asterisk on this machine, I started from the
10 minute guide to Asterisk. That guide didn't mention ztdummy but I see what else I would need to do there. I have to grab the Zaptel driver source (currently at 1.2.11) and build it. Then there's more inform
ation over here to work with. It looks a little out of date as I'm reading it and comparing to the README that comes with the zaptel source (btw if anyone that works on that wiki can update it based on this info then please do).
The
README and
README.Linux26 files in the Zaptel source code describe briefly how to build. I'll show here how I interpreted those instructions for my OpenSuSE 10.1 Linux system.
First, I got the source (use the zaptel link from the
Asterisk download page to get the url for the latest source code):
ruby:/home/rob3/work/asterisk # wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.11.tar.gz
ruby:/home/rob3/work/asterisk # tar xvf zaptel-1.2.11.tar.gz
Now, in the README it mentions that with the Linux 2.6 kernel you don't need the entire kernel source any more. I think they mean that you just need the headers and/or symbols for your kernel. I had to get them when I installed the Nvidia driver. If you didn't install source when you installed Linux, you might be in for a kernel upgrade. I found that it was far easier to just pick the new kernel package and kernel source packages in YaST2 and install them than any other method. To find out if you have the kernel source that you need, try this.
ruby:~ # cd /usr/src/
ruby:/usr/src # uname -r
2.6.16.21-0.21-default
ruby:/usr/src # ls -la
... some stuff ...
lrwxrwxrwx 1 root root 20 2006-09-26 12:06 linux -> linux-2.6.16.21-0.21/
... more stuff ...
drwxr-xr-x 20 root root 4096 2006-09-26 12:04 linux-2.6.16.21-0.21/
drwxr-xr-x 3 root root 4096 2006-08-31 15:10 linux-2.6.16.21-0.21-obj/
lrwxrwxrwx 1 root root 24 2006-09-26 12:06 linux-obj -> linux-2.6.16.21-0.21-obj/
ruby:/usr/src #cd /lib/modules/2.6.16.21-0.21-default
ruby:/lib/modules/2.6.16.21-0.21-default # ls -la
... some stuff ...
lrwxrwxrwx 1 root root 46 2006-09-26 11:54 build -> /usr/src/linux-2.6.16.21-0.21-obj/i386/default
drwxr-xr-x 11 root root 4096 2006-09-26 11:54 kernel
... more stuff ...
lrwxrwxrwx 1 root root 29 2006-09-26 11:54 source -> /usr/src/linux-2.6.16.21-0.21
This doesn't exactly match up with what's in README.Linux26, but I think it's what they meant because my make command succeeded with just a few warnings. The
uname -r command tells you what version of the kernel you're using, then the directories I listed should have some the source code and soft links that I've shown. All the links I have were set up by YaST2 as far as I recall.
Anyhow, back to the actual build steps. I just did this:
ruby:/home/rob3/work/asterisk # cd zaptel-1.2.11/
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # make
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # make install
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # make install-udev
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # modprobe ztdummy
It looks like that may have installed more drivers than I need, but I don't know enough to avoid this right now, nor am I too concerned about it. I also wonder if there's installing the udev rules that way breaks some of SuSE's tools. I tried the modprobe before installing the udev rules and I got an error message "line 0: Unable to open master device '/dev/zap/ctl'" and "FATAL: Error running install command for ztdummy."
After all that I can now look at the output from
lsmod to see ztdummy running.
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # lsmod | grep zt
ztdummy 3848 0
zaptel 201732 1 ztdummy
So now I try to call in to my Asterisk server again and dial up my MeetMe conference room at extension 500. Still the same error message as above. So I did a little investigation and I see a flag called "WITHOUT_ZAPTEL" in the apps Makefile. There's a condition in there that prevents the MeetMe application and a few others from being built. There are also similar conditions that change settings in the channels Makefile and the res Makefile. So this kind of sucks for me, I think the best thing to do here is reinstall. Let me repeat that: if you've got a running Asterisk server and you didn't include ztdummy or zaptel, you should build and install those (as I did above), back up your config files (as I did above) then you should rebuild and reinstall Asterisk (you could use the same
method I described the other day).
I tried just building again but it looks like nothing happens in the res directory, so obviously the Makefile change isn't noticed (since it's a compiler flag and not a build target that's changed).
So to reinstall, here's what I'm doing.
ruby:/home/rob3/work/asterisk/zaptel-1.2.11 # cd ../asterisk-1.2.13
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # make clean
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # make
At this point there will be a whole lot of output from the build. There are some warning messages and that's normal, it should be fine as long as there are no errors reported (the build should stop if there's an error). While I'm at it, I'm going to build mpg123 so that I can also get Music On Hold.
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # make mpg123
The Makefile target for mpg123 actually goes out and tries to get the source code for mpg123 over ftp then builds it, so be sure you're online if you try this. Next I'm going to install the newly built Asterisk server. If Asterisk is running then shut it down - the command
stop gracefully on the Asterisk CLI should do it.
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # make install
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # make samples
I ran make samples since most of my stuff is pretty close to the basic Asterisk install. Now I'll just restore my config files since that's all I've edited.
ruby:/home/rob3/work/asterisk/asterisk-1.2.13 # cp -R ~/astbackup/astetcdir/* /etc/asterisk/
I noticed when I restarted Asterisk after this (with
asterisk -vvvc) a line that indicated MeetMe and some other applications were loaded up. I can call in and join the conference that I created by editing extensions.conf and meetme.conf earlier, so that's a start. Then I call in from a second line (my cell phone) and it seems to connect to the same conference. I did have some funny behaviour where I had trouble dialing in, but it seems unrelated to the changes I made today, so I'm calling it a successful test.
remember to restart the server in order udev to take effect