<?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>KernelCrash &#187; asterisk</title>
	<atom:link href="http://www.kernelcrash.com/blog/category/asterisk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kernelcrash.com/blog</link>
	<description>the difference that is no difference makes no difference</description>
	<lastBuildDate>Mon, 03 May 2010 04:59:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>OpenVZ and Asterisk and PAE</title>
		<link>http://www.kernelcrash.com/blog/openvz-and-asterisk-and-pae/2009/02/03/</link>
		<comments>http://www.kernelcrash.com/blog/openvz-and-asterisk-and-pae/2009/02/03/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 01:29:19 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/?p=150</guid>
		<description><![CDATA[This post started out as a simple howto for installing Asterisk in an OpenVZ container on Debian Lenny. It all started out well, as a test box I used my core2duo server running Debian Lenny, did an apt-get of the openvz kernel image that is already in the Lenny standard repository, downloaded an OpenVZ template [...]]]></description>
			<content:encoded><![CDATA[<p>This post started out as a simple howto for installing <a href="http://www.asterisk.org">Asterisk</a> in an <a href="http://wiki.openvz.org/Main_Page">OpenVZ</a> container on <a href="http://www.debian.org/releases/testing/">Debian Lenny</a>. It all started out well, as a test box I used my core2duo server running Debian Lenny, did an apt-get of the openvz kernel image that is already in the Lenny standard repository, downloaded an OpenVZ template for  a minimal Lenny virtual machine (VM), got a VM running, installed asterisk using apt-get inside the VM, got it configured, then worked out how to install the zaptel modules (usiing the debian repository&#8217;s zaptel-source) in the host machine using module-assistant, and then getting the zaptel stuff recognised within the VM. And it all worked.</p>
<p>However, setting it up on the core2duo box was just a test. I really wanted to set it up on my old Thinkpad T42. It&#8217;s been gathering dust since I bought the Macbook, and it seemed such a shame to have it doing nothing. I&#8217;ve had an old Thinkpad 600X running Asterisk for a while now. It runs natively (ie. not in a VM) and does the job, but it has a hand compiled kernel and Asterisk &#8230; and that kind of set up tends to put me off doing proper updates on it. Hence why I was liking Debian Lenny; modern kernel and Asterisk 1.4.x in the standard repository. And the T42 had a bit of horsepower with a 1GB of RAM and a 100GB drive, so I thought something like Asterisk could be virtualised on it.</p>
<p>So step 1, install Lenny from CD on the T42 and &#8216;apt-get update&#8217; , &#8216;apt-get upgrade&#8217;, then step 2 ; install the openvz kernel image;</p>
<blockquote><p>apt-get install linux-image-2.6.26-1-openvz-686</p></blockquote>
<p>And reboot &#8230; and nothing. It would not boot. Obviously my Thinkpad did not like this kernel. It turns out that the Debian Lenny OpenVZ kernel is compiled with <a href="http://en.wikipedia.org/wiki/Physical_Address_Extension">PAE</a> support compiled in. A core2duo has PAE support. The Pentium M in the Thinkpad does not support PAE.</p>
<p>So what to do? I could go on about the other virtualisation techniques I tried here &#8230; but ultimately I liked the idea of OpenVZ; Simple kernel mod, light overhead, don&#8217;t need dedicated raw files on disk for VMs. I also liked that Lenny had a standard OpenVZ kernel in it&#8217;s repository, which ultimately meant &#8216;easy kernel updates&#8217;.</p>
<p>So I thought I&#8217;d have  a go at trying to recompile the Debian OpenVZ kernel with PAE turned off &#8230; in a supportable way. To me the easy way is to get a vanilla kernel from kernel.org, and add the patches from openvz.org. But I wanted to have a kernel closely approximating the latest apt-get&#8217;able Debian OpenVZ kernel.</p>
<p>I&#8217;ve used make-kpkg to make my own debian kernels before, but that didn&#8217;t really work in this case.</p>
<p>So here&#8217;s what I did (I got a lot of ideas from <a href="http://it.toolbox.com/blogs/locutus/easily-build-a-debian-xen-kernel-package-without-pae-22254">this post about Xen without PAE</a>);</p>
<blockquote><p># get the source<br />
cd /usr/src<br />
apt-get source linux-image-2.6.26-1-openvz-686</p></blockquote>
<p>Now you should end up with a /usr/src/linux-2.6-2.6.26 directory. It looks like a normal kernel extraction directory, but with a debian directory.</p>
<blockquote><p>cd /usr/src/linux-2.6-2.6.26/debian/config/i386<br />
vi config.686-bigmem</p></blockquote>
<p>Now I just searched for PAE in the partial config file and turned it off, as well as disabled the 64GB setting and enabled the 4GB one. Mine looks like this:</p>
<blockquote><p>CONFIG_HIGHMEM4G=y<br />
CONFIG_HIGHMEM64G=n<br />
## end choice<br />
CONFIG_X86_PAE=n</p></blockquote>
<p>Save that. Now do all the steps to apply patches, build the config, and compile to generate the kernel image and headers deb</p>
<blockquote><p>cd /usr/src/linux-2.6-2.6.26<br />
fakeroot debian/rules debian/build debian/stamps</p>
<p># Removing these ABI files below is a cheap hack workaround to errors that are normally produced at the end of the compile</p>
<p>rm debian/abi/2.6.26-1/*<br />
fakeroot make -f debian/rules.gen binary-arch_i386_openvz_686</p></blockquote>
<p>That last fakeroot command will take ten bazillion years to complete. Once complete you should end up with two deb files in /usr/src;</p>
<blockquote><p>linux-headers-2.6.26-1-openvz-686_2.6.26-13_i386.deb<br />
linux-image-2.6.26-1-openvz-686_2.6.26-13_i386.deb</p></blockquote>
<p>Now install both of these;</p>
<blockquote><p>cd /usr/src<br />
dpkg -i linux-headers-2.6.26-1-openvz-686_2.6.26-13_i386.deb<br />
dpkg -i linux-image-2.6.26-1-openvz-686_2.6.26-13_i386.deb</p></blockquote>
<p>And make sure you have the OpenVZ tools installed;</p>
<blockquote><p>apt-get install vzctl</p></blockquote>
<p>And try rebooting</p>
<p>This time it worked for me.</p>
<p>And now (finally) we set up a virtual machine and install Asterisk in it.</p>
<p>Download an OpenVZ template for Lenny from <a href="http://openvz.org/download/template/cache">http://openvz.org/download/template/cache</a>;</p>
<blockquote><p>debian-5.0-i386-minimal.tar.gz</p></blockquote>
<p>You just put the tar.gz file in /var/lib/vz/template/cache (ie. don&#8217;t extract it).</p>
<p>Then its a case of picking a unique id for your VM (eg. 101) and doing  something like;</p>
<blockquote><p>vzctl create 101 &#8211;ostemplate debian-5.0-i386-minimal &#8211;config vps.basic<br />
vzctl set 101 &#8211;onboot yes &#8211;save<br />
vzctl set 101 &#8211;hostname testmachine &#8211;save<br />
vzctl set 101 &#8211;ipadd 10.1.2.3 &#8211;save<br />
vzctl set 101 &#8211;nameserver 1.2.3.4 &#8211;save<br />
vzctl start 101</p></blockquote>
<p>The VM should start quickly and to get a sort of console you enter;</p>
<blockquote><p>vzctl enter 101</p></blockquote>
<p>One thing that confused me initially is how networking works. The basic example above uses venet networking. I wasnt sure whether the IP address I specified should be on a seperate subnet or on the same subnet as my host machine. In the end, I used an IP address that was on the same subnet as my host machine. It doesn&#8217;t use brctl style bridging, but it effectively bridges the interface onto your network. I must admit I couldn&#8217;t find a decent explanation/diagram of how OpenVZ networking works.</p>
<p>Install asterisk in the VM;</p>
<blockquote><p>apt-get install asterisk</p></blockquote>
<p>The install worked fine, but because of problems with Music On Hold in the past I wanted to set up ztdummy properly. This can be done.</p>
<p>In the host machine I <a href="https://www.saruman.biz/wiki/index.php/Installing_and_configuring_Zaptel">installed the zaptel modules per this debian howto</a></p>
<blockquote><p>apt-get install zaptel-source<br />
module-assistant prepare<br />
module-assistant auto-install zaptel</p></blockquote>
<p>Afer you do that, do a &#8216;modprobe ztdummy&#8217;. The first time I tried this it didn&#8217;t work, because Lenny had downloaded the &#8216;official&#8217; package for the OpenVZ kernel headers rather than the one that I generated. If that happens to you, dpkg -r the old package, and then install the headers deb that you created earlier. Then run the auto-install above again and double check that the ztdummy modules inserts cleanly. If you do a dmesg now, you should see something like;</p>
<blockquote><p>ztdummy: High resolution Timer started, good to go</p></blockquote>
<p>So that gets ztdummy working from the host machine. We need to make it accessible from within the virtual machine. I looked at the following two howtos;</p>
<p><a href="http://wiki.openvz.org/Asterisk_in_VE_with_debian_stable">http://wiki.openvz.org/Asterisk_in_VE_with_debian_stable</a><br />
<a href="http://wiki.openvz.org/Asterisk_from_source">http://wiki.openvz.org/Asterisk_from_source</a> (I just used the vzctl example commands they have)</p>
<p>The big test of whether the ztdummy stuff is working from inside the virtual machine is to run zttest and hit ctrl-c after a few lines of output. Here&#8217;s how mine runs;</p>
<p>root@lenny:/# zttest<br />
Opened pseudo zap interface, measuring accuracy&#8230;<br />
99.996582% 99.975983% 99.984177% 99.983887% 99.984070% 99.984467% 99.984375%<br />
99.984177% 99.979492% 99.984467% 99.981735% 99.983208% 99.984581% 99.982819% 99.983978%<br />
99.982811% 99.977448% 99.983971% 99.983971% ^C<br />
&#8212; Results after 19 passes &#8212;<br />
Best: 99.997 &#8212; Worst: 99.976 &#8212; Average: 99.983484, Difference: 99.983484</p>
<p>So the only bit remaining for me was to configure asterisk. I just copied files over from my old Asterisk server and got it going. The only issues I had;</p>
<ul>
<li>I needed to use the <a href="http://asterisk.hosting.lv/">g729 codec from http://asterisk.hosting.lv/</a>. That just requires dropping the library file in the right directory and restarting asterisk.</li>
</ul>
<ul>
<li> I found I had to change the asterisk.conf file so that it had the following change;astdatadir =&gt; /usr/share/asterisk<br />
Debian seems to put all the sounds and music on hold data under /usr/share/asterisk (instead of /var/lib/asterisk). I had some ulaw and g729 sounds on the old server, so I copied those into /usr/share/asterisk/sounds</li>
</ul>
<p>And that is pretty much it. What an endeavour. In hindsight, if I had counted the cost of all the effort put in to get this working on a non-PAE CPU, it would have been easier to just buy a newer system with a PAE CPU.</p>
<p>UPDATE: I used the simple venet networking when I initially set up the Asterisk virtual machine. Unfortunately, the VM would work for a few hours and then either lose its default route or be unable to get responses to DNS requests &#8230; so I ended up converting the VM to veth networking using the notes <a href="http://wiki.openvz.org/Using_veth_and_brctl_for_protecting_HN_and_saving_IP-adresses">here</a> and <a href="http://wiki.openvz.org/Virtual_Ethernet_device">here</a>. It now works much better.</p>
<p>UPDATE: I noticed after doing this, that an apt-get update/upgrade may end up trying to download a kernel with the same name as the one I compiled. There should be a way around this, but for now I&#8217;m doing the following to prevent my kernel and headers being overwritten (NB: You may have to undo the change below in order to install a new self-compiled kernel. You probably just need to change &#8216;hold&#8217; to &#8216;install&#8217; to undo the change below);</p>
<blockquote><p># echo &#8220;linux-headers-2.6.26-1-openvz-686 hold&#8221; | dpkg &#8211;set-selections<br />
# echo &#8220;linux-image-2.6.26-1-openvz-686 hold&#8221; |dpkg &#8211;set-selections</p></blockquote>
<p>UPDATE: I had problems with DNS lookups occasionally hanging from within the OpenVZ virtual machine. If I did a &#8216;cat /proc/user_beancounters&#8217; from inside the virtual machine, the failcnt column would have a non-zero number against the dgramrcvbuf.  Apparently this has something to do with udp buffers. As a quick workaround I did this to double the barrier limit for that parameter;</p>
<blockquote>
<pre>sudo vzctl set 102 --dgramrcvbuf $((262144*2)) --save</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/openvz-and-asterisk-and-pae/2009/02/03/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Asterisk &#124; Music on Hold problems</title>
		<link>http://www.kernelcrash.com/blog/asterisk-music-on-hold-problems/2008/01/07/</link>
		<comments>http://www.kernelcrash.com/blog/asterisk-music-on-hold-problems/2008/01/07/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 03:39:04 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/asterisk-music-on-hold-problems/2008/01/07/</guid>
		<description><![CDATA[I wanted to set up a special extension in Asterisk that would divert to my mobile. A week or two back I found the code to implement the *72* forward function. ie. you enter *72*&#60;some number&#62;. However I could not get it to work very well. So I just added a line to the inbound [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to set up a special extension in Asterisk that would divert to my mobile. A week or two back I found the code to implement the *72* forward function. ie. you enter *72*&lt;some number&gt;. However I could not get it to work very well. So I just added a line to the inbound trunk context to manually do it:</p>
<pre>
   [DID_trunk_3]
   include = default
   exten = s,1,Macro(trunkdial,${trunk_1}/6421....)</pre>
<p>So the call would come in trunk_3 and go out trunk_1. So that kind of worked OK, but there was a bit of a delay because the call had to be accepted first, and then connect out trunk_1. I thought it&#8217;d be good if the person calling heard something like &#8216;transferring your call&#8217; and then some music on hold music until it connected.</p>
<p>To try this out I came up with a new extension; extension 29 (I just use simple two digit extensions) and made it do a Dial with the &#8216;m&#8217; option for Music on Hold</p>
<pre>
   exten =&gt; 29,1,NoOp(Incoming call to ext 29 from ${CALLERID(all)})
   exten =&gt; 29,n,Answer()
   exten =&gt; 29,n,Wait(1)
   exten =&gt; 29,n,Background(transfer)
   exten =&gt; 29,n,Dial(SIP/12345656/00116421....,55,m)
   exten =&gt; 29,n,HangUp()</pre>
<p>If I called &#8216;29&#8242; from an internal extension, I&#8217;d hear the &#8216;please hold &#8230;.&#8217; blurb and some music on hold. So it looked like it was working. However, I tried diverting all of my trunk_1 calls to extension 29. When i dialled the PSTN number for trunk_1, I would hear the &#8216;please hold &#8230;&#8217; and the music on hold. The only problem was the the music on hold seem to cut in and out (softer and louder?) and generally sounded a bit choppy. I was only using the default MOH (music on hold) that comes with asterisk so I wasn&#8217;t trying mp3s or such.</p>
<p>A long time later I think I finally have it working.</p>
<p>Firstly I started reading about asterisk timing sources, and how moh is affected by timing. Through trawling through several sites it seemed that I might need the ztdummy driver to get a proper timing source. ztdummy is a kernel module that comes as part of the zaptel driver. For whatever reasons, I am using a 2.6.24rc6 kernel (ie very very new at the moment) &#8230; and unsurprisingly the zaptel drivers don&#8217;t compile that well or at all against it. The most useful clue I found was in <a href="http://bugs.digium.com/view.php?id=11620">Digium Bug 11620</a>. It talks about some workarounds. I ended up doing something like:</p>
<pre>
   make KBUILD_NOPEDANTIC=1 modules install-modules</pre>
<p>I must admit I had to do a lot of other tweaking as well, most of which I have forgotten &#8230; so &#8216;good luck&#8217; if you&#8217;re doing this yourself. So eventually I had the ztdummy module loaded (NB: this depends on the zaptel module as well). Unfortunately, I still had a problem with music on hold. My dmesg output showed the ztdummy module loading but with:</p>
<pre>
   ztdummy: High Resolution Timer started, good to go</pre>
<p>Of course, I don&#8217;t think you have High Resolution Timers on an old Pentium III ( I could be wrong). So some hacking of the ztdummy source code was required to make sure it used the RTC source instead (I had to manually modprobe rtc first on my debian etch system). Finally I got it to say:</p>
<pre>
   ztdummy: RTC rate is 1024</pre>
<p>But my music on hold was still rubbish from an external phone number.</p>
<p>Then I started reading about the problems around silence suppression. I think the idea is that some providers do silence suppression to save bandwidth, but due to music on hold being sound in one direction only ,it can fool systems into thinking there is silence &#8230; I think. Anyway, I found <a href="http://bugs.digium.com/view.php?id=5374">Digium bug 5374</a> that talks an eternity about it. Eventually towards the bottom of the page it mentions a new parameter called internal_timing.</p>
<p>This internal_timing setting is in your asterisk.conf file in the [options] section. You need to set it:</p>
<pre>
   internal_timing = yes</pre>
<p>I tried that and my music on hold was still rubbish. But then I found a small note (can&#8217;t remember where) that said to double check your asterisk.conf file as the [option] heading is commented out by default. It is. So I just removed the semi-colon from in front of [option] and restarted asterisk.</p>
<p>Now music on hold finally seemed to work. I&#8217;ve tried it a few times now and it seems to be good. I must admit I&#8217;m not sure whether you need the ztdummy stuff at all.</p>
<p>NB: This is with asterisk 1.4.16.2 and whatever is in the zaptel 1.4 svn branch as at early Jan 2008</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/asterisk-music-on-hold-problems/2008/01/07/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk PBX and the SPA 3102</title>
		<link>http://www.kernelcrash.com/blog/asterisk-pbx-and-the-spa-3102/2007/12/27/</link>
		<comments>http://www.kernelcrash.com/blog/asterisk-pbx-and-the-spa-3102/2007/12/27/#comments</comments>
		<pubDate>Thu, 27 Dec 2007 20:06:37 +0000</pubDate>
		<dc:creator>kernel</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kernelcrash.com/blog/2007/12/27/asterisk-pbx-and-the-spa-3102/</guid>
		<description><![CDATA[I&#8217;ve had a Linksys SPA3102 for a while now connected up to a  single VOIP provider. For the most part it works great. You turn it on and it pretty much always works. I like things that &#8216;just work&#8217;.
But part of the reason I bought the SPA is because you can split it into [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a Linksys SPA3102 for a while now connected up to a  single VOIP provider. For the most part it works great. You turn it on and it pretty much always works. I like things that &#8216;just work&#8217;.</p>
<p>But part of the reason I bought the SPA is because you can split it into the FXO (pstn) and FXS(handset) side to work with an <a href="http://www.asterisk.org">Asterisk</a> server. Asterisk  is a very popular computer PBX system. The type of setup I wanted was one where I could get asterisk to route calls out the pstn of the SPA box and also use the handset as a regular extension &#8230; and also have a couple of softphones as extensions, plus also route calls out to my VOIP provider.  I primarily wanted to play around and undestand the IVR, voicemail and other features. This &#8216;free&#8217; PBX stuff is very much crossing over into the domain of Unix Admins, so I have a vested interest in it. I also wanted to be able to have multiple DID (dial in numbers) via multiple VOIP providers and as far as I know you cannot do that with an SPA.</p>
<p>I won&#8217;t go into too much detail about the configuration of Asterisk other than to say it sucks. There seem to be a zillion websites and forum posts out there each describing some little nuance of Asterisk configuration and they don&#8217;t all agree so it tends to be very confusing.  I guess I don&#8217;t just want to know the magic parameter settings in the config files. I want to know what they do and how they relate to other parts of the config.</p>
<p>Initially I started using the v1.2.x Asterisk included in Debian Etch stable and tweaking the sip.conf and extensions.conf files by hand but then I thought maybe the Asterisk GUI that you can get for Asterisk v1.4.x will make things easier so I compiled  v1.4.x of Asterisk as well as the svn of the Asterisk-GUI.  Even with the GUI I got stuck  several times and had to tweak the config files anyway. Admitedly the Oreilly book you can freely download from the asterisk website is actually a reasonably good book (like most Oreilly stuff) &#8230; and is probably worth reading before you try this stuff out. It does actually explain a lot of key things in Asterisk.</p>
<p>I won&#8217;t bore you with any more gripes, but here&#8217;s some helpful things:</p>
<p>- I had trouble setting up the PSTN interface of the SPA using the Asterisk GUI. I just added it in as a custom service provider and the GUI added some lines like the following to users.conf:</p>
<pre>
[trunk_2]
username = pstn
allow = all
context = DID_trunk_2
dialformat = ${EXTEN:1}
hasexten = no
hasiax = no
hassip = yes
port = 5061
registeriax = no
registersip = no
secret = 12345678
trunkname = Custom - telecom
trunkstyle = customvoip</pre>
<p>I set up the spa under the &#8216;PSTN Line&#8217; tab so that it has user id &#8216;pstn&#8217; and the proxy setting was the IP of my asterisk box and the password was set ok. But everytime I rebooted the SPA, the pstn would not register (ie. I would see a message on the asterisk console saying &#8216;failed to register&#8217;). It took a long time to work out that the username the SPA logs in as must be the same as the context name. So now I have something like:</p>
<pre>
<strong>[pstn]</strong>
username = pstn
fromuser=pstn
type = friend
disallow = all
allow = ulaw
allow = alaw
allow = g723.1
allow = gsm
context = DID_trunk_2
dialformat = ${EXTEN:1}
hasexten = no
hasiax = no
hassip = yes
host = dynamic
port = 5061
registeriax = no
registersip = no
secret = 12345678
trunkname = Custom - telecom
trunkstyle = customvoip</pre>
<p>NB: If you manually change the context name from trunk_2 to pstn like I did you&#8217;ll pretty much have to change all the other references to trunk_2 to pstn (or the easy way would have been to change the SPA PSTN config so the login username was &#8216;trunk_2&#8242;)</p>
<p>- When I eventually got the SPA pstn bit setup, I set up a simple echo test dial plan. I would call the PSTN external number, asterisk would pick up and tell me it was an echo test etc. The problem though was that when I hung up, asterisk would not work out that the call had ended. This has to to do with the &#8216;disconnect detection&#8217; in the SPA. In the &#8216;PSTN Line&#8217; tab of the SPA config you&#8217;ll see a &#8216;Disconnect Tone&#8217; setting. Mine was set to the following by default:</p>
<p>480@-30,620@-30;4(.25/.25/1+2)</p>
<p>I&#8217;m in New Zealand, so I needed to set it up for a NZ disconnect tone. I didn&#8217;t find any examples when I did a search, so I had a look at the NZ telepermit specs and tried this:</p>
<p>400@-30,400@-30;1(.250/.250/1+2)</p>
<p>That worked, but to be honest I don&#8217;t understand half of it (NB:I&#8217;ve since found a great reference for world wide  telephone tones at <a href="http://www.3amsystems.com/wireline/tone-search.htm?start=0&amp;kCountry=128&amp;format=Sipura">3amsystems.</a>  It has the disconnect tone as 400@-30,400@-30; 2(0.25/0.25/1+2)  so I was pretty close)</p>
<p>Also, I found a post in a geekzone.co.nz forum suggesting you use &#8216;370+620||310nF&#8217; as the FXO Port Impedance. I&#8217;ve left the gain figures on the SPA to zero &#8230; but I&#8217;m often told by some callers that they can hardly hear me, so maybe I should try some different gains.</p>
<p>- Here are some of the key settings I have in the &#8216;PSTN Line&#8217; tab of the SPA 3102 config to have it work as a SIP trunk with Asterisk:</p>
<pre>
Line Enable: yes
SIP Port: 5061
Proxy:  [address of my asterisk box]
Register: yes
Display Name: pstn
User ID: pstn
Password: [your password you setup on Asterisk]
Dial Plan 2: (S0&lt;:s&gt;)
VOIP-To-PSTN Gateway Enable: yes
PSTN-To-VOIP Gateway Enable: yes
PSTN CID For VOIP CID: yes
PSTN Caller Default DP: 2   (ie. use the dial plan 2 setup earlier)</pre>
<p>- In many of the example for extensions.conf you find on the net it has some examples showing how the dial plans work when dialling between extensions. However, with my asterisk-gui setup there didn&#8217;t seem to be anything in extensions.conf to configure this, yet I could call between extensions just fine. It turns out there is a macro called stdexten that gets used somehow. There is a bit in users.conf that says:</p>
<pre>
;
; Create voicemail mailbox and use use macro-stdexten
;
hasvoicemail = yes</pre>
<p>I&#8217;m not sure why &#8216;hasvoicemail&#8217; would enable this macro. I haven&#8217;t found anything in that Oreilly Asterisk book about it. Anyway, if you search for macro-stdexten in extensions.conf you should find some dial plan stuff that handles the calls between extensions and also sends the caller to voicemail if they don&#8217;t answer or are busy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kernelcrash.com/blog/asterisk-pbx-and-the-spa-3102/2007/12/27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
