<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Open Sourcerer &#187; zaptel</title>
	<atom:link href="http://www.theopensourcerer.com/tag/zaptel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.theopensourcerer.com</link>
	<description>The Magic of Open Source</description>
	<lastBuildDate>Tue, 24 Jan 2012 09:10:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Asterisk, Zaptel, Oslec and Ubuntu Server [Updated]</title>
		<link>http://www.theopensourcerer.com/2009/02/12/asterisk-zaptel-oslec-and-ubuntu-server/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=asterisk-zaptel-oslec-and-ubuntu-server</link>
		<comments>http://www.theopensourcerer.com/2009/02/12/asterisk-zaptel-oslec-and-ubuntu-server/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 18:03:20 +0000</pubDate>
		<dc:creator>Alan Lord</dc:creator>
				<category><![CDATA[Runes and tales]]></category>
		<category><![CDATA[The Open Learning Centre]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[launchpad]]></category>
		<category><![CDATA[low power server]]></category>
		<category><![CDATA[OSLEC]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[zaptel]]></category>

		<guid isPermaLink="false">http://www.theopensourcerer.com/?p=833</guid>
		<description><![CDATA[I have recently migrated my server at home from a custom Linux build to Ubuntu Server (8.10 Intrepid). The main migration went very smoothly and I learned a few new tricks on the way too. One function the server performs is as my telephone system for work and home. It runs Asterisk. I have a [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently migrated my server at home from a custom Linux build to Ubuntu Server (8.10 Intrepid). The main migration went very smoothly and I learned a few <a href="http://www.theopensourcerer.com/2009/02/09/bashscripting-snippets/">new tricks</a> on the way too.</p>
<p>One function the server performs is as my telephone system for work and home. It runs <a href="http://www.asterisk.org/" target="_blank">Asterisk</a>. I have a couple of <a href="http://en.wikipedia.org/wiki/Inter-Asterisk_eXchange" target="_blank">IAX2</a> trunks from our VOIP provider for mine and my wife&#8217;s businesses and I also have a cheap <a href="http://www.voip-info.org/wiki/view/X100P+clone" target="_blank">x100p</a> clone analogue card for PSTN backup purposes. On my old system software, I had compiled the device drivers (zaptel) and kernel modules for the card manually and used a, frankly fantastic, echo canceller called <a href="http://www.rowetel.com/ucasterisk/oslec.html" target="_blank">Oslec</a> (the Open Source Line Echo Canceller). You can read the couple of posts I made about when I first tried it out <a href="http://www.theopensourcerer.com/?s=oslec">here</a>.</p>
<p>On my new server OS, I installed the Asterisk server via Ubuntu&#8217;s package management system <code>sudo apt-get install asterisk</code>. After some digging around on the &#8216;net (and it wasn&#8217;t obvious) I discovered that the zaptel drivers (for the PSTN hardware) need to be installed slightly differently:</p>
<p><del><code>sudo m-a -t build zaptel</code> Which retrieves the zaptel package and builds it for your running kernel.</del> You might have to run <code>m-a prepare</code> in advance of this to retrieve your Linux kernel headers.</p>
<p>The m-a (Module Assistant) command will compile and create a <code>.deb</code> package in the <code>/usr/src</code> directory. On my system the package was called <code>zaptel-modules-2.6.27-11-server_1.4.11~dfsg-2+2.6.27-11.27_i386.deb</code>.</p>
<p><del>It can then be installed using dpkg: <code>sudo dpkg -i zaptel-modules-2.6.27-11-server_1.4.11~dfsg-2+2.6.27-11.27_i386.deb</code>.</del></p>
<p>This went fine and I had read on <a href="https://launchpad.net/ubuntu/+source/zaptel" target="_blank">launchpad</a> that as of an earlier version of the zaptel package the Oslec echo canceller was now the default. Unfortunately this didn&#8217;t quite work as I expected. The zaptel module was in fact using the standard MG2 EC which is not very good with my x100p card at all.</p>
<p>After a bit more digging around in the source code, there is a file in the zaptel package called zconfig.h which is where the chosen EC is defined. It is specified as MG2 in the package. <del datetime="2009-02-13T10:10:44+00:00">What I did to fix it was as follows.</del></p>
<ul>
<li><del>Unpack the <code>zaptel.tar.bz2</code> package that was in <code>/usr/src</code>.</del></li>
<li><del>Edit the <code>kernel/zconfig.h</code> file so the line <code>#define ECHO_CAN_MG2</code> is commented out</del></li>
<li><del>and added in a line that reads <code>#define ECHO_CAN_OSLEC</code> instead.</del></li>
<li><del>Re-assemble the zaptel package: <code>sudo tar jcvf zaptel.tar.bz2 modules</code> (&#8220;modules&#8221; is the directory name where the zaptel package extracts to).</del></li>
<li><del>Delete the existing zaptel-blah-blah.deb file and the modules directory too.</del></li>
<li><del>Re-run the <code>m-a -t build zaptel</code> command.</del></li>
</ul>
<p><strong>Thanks to Tzafir Cohen on the asterisk mailing list for this.</strong> There is a far simpler method to use for the time being although this is a known bug and is now fixed in the development tree so I guess it will be unnecessary once the package has been updated. Do please check first if you are following this in the months to come. Anyway, instead of the commands above, these commands work for me and are far simpler:</p>
<p><code>sudo m-a -f get zaptel-source</code> This simply gets the source package and saves it in <code>/usr/src</code>.<br />
<code>sudo ECHO_CAN_NAME=OSLEC m-a -t a-i zaptel</code> And this builds and installs the modules and tells the build scripts to choose the Oslec EC by default. The <code>-t</code> switch puts the command into text mode so you actually see what is going on. I find the process rather opaque and uninformative without this switch. </p>
<p>After rebuilding, the zaptel module now requires, and loads the Oslec EC by default. The command <code>modinfo zaptel</code> is a good test. The output of it should be something like this:</p>
<p><code>filename:          /lib/modules/2.6.27-11-server/misc/zaptel.ko<br />
version:            1.4.11<br />
license:            GPL<br />
description:      Zapata Telephony Interface<br />
author:             Mark Spencer &lt;markster@digium.com&gt;<br />
srcversion:       4433ADDE0493C798A455677<br />
depends:          oslec,crc-ccitt<br />
vermagic:         2.6.27-11-server SMP mod_unload modversions 686<br />
parm:               debug:int<br />
parm:               deftaps:int</code></p>
<p>Note the &#8220;depends&#8221; line. </p>
<p>You could also type <code>lsmod | grep 'zaptel'</code> once you have reloaded your server:</p>
<p><code>zaptel                199844  5 wcfxo<br />
oslec                  16668  1 zaptel<br />
crc_ccitt              10112  1 zaptel</code></p>
<p>This command shows the oslec ec module installed along with the the zaptel and wcfxo drivers.</p>
<p>One final point to note. If you just want to load a particular telephony hardware driver and not all of them, I think you need a file <code>/etc/default/zaptel</code> like this with the relevant driver(s) uncommented:</p>
<p><code>TELEPHONY=yes<br />
DEBUG=yes</p>
<p># Un-comment as per your requirements; modules to load/unload<br />
#Module Name                      Hardware</p>
<p>#MODULES="$MODULES tor2"            # T400P - Quad Span T1 Card<br />
                                                           #E400P - Quad Span E1 Card</p>
<p>#MODULES="$MODULES wct4xxp"      # TE405P - Quad Span T1/E1 Card (5v version)<br />
                                                           # TE410P - Quad Span T1/E1 Card (3.3v version)<br />
#wct4xxp_ARGS="t1e1override=15"       # Additional parameters for TE4xxP driver</p>
<p>#MODULES="$MODULES wct1xxp"       # T100P - Single Span T1 Card<br />
                                                            # E100P - Single Span E1 Card</p>
<p>#MODULES="$MODULES wcte11xp"      # TE110P - Single Span T1/E1 Card</p>
<p>#MODULES="$MODULES wctdm24xxp"  # TDM2400P - Modular FXS/FXO interface (1-24 ports)</p>
<p>MODULES="$MODULES wcfxo"              # X100P - Single port FXO interface<br />
                                                              # X101P - Single port FXO interface </p>
<p>#MODULES="$MODULES wctdm"           # TDM400P - Modular FXS/FXO interface (1-4 ports)</code></p>
<p>I can&#8217;t recall the exact origins of this file and whether or not it is really necessary, but I had it on my old system and the Ubuntu provided zaptel init script checks for it&#8217;s presence; although it doesn&#8217;t look like it does much with its contents though&#8230;</p>
<p>Hopefully this will help others and also act as a bit of an aide memoir for me when I next build an Ubuntu server with Asterisk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theopensourcerer.com/2009/02/12/asterisk-zaptel-oslec-and-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

