<?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>MCB Systems &#187; voip</title>
	<atom:link href="http://www.mcbsys.com/techblog/tag/voip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mcbsys.com/techblog</link>
	<description>Custom Software and I.T. Services</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:53:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting Up QoS for 3CX under Windows 7</title>
		<link>http://www.mcbsys.com/techblog/2011/06/setting-up-qos-for-3cx-under-windows-7/</link>
		<comments>http://www.mcbsys.com/techblog/2011/06/setting-up-qos-for-3cx-under-windows-7/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 21:32:42 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[3cx]]></category>
		<category><![CDATA[qos]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2011/06/setting-up-qos-for-3cx-under-windows-7/</guid>
		<description><![CDATA[As mentioned in the previous post, getting endpoints to apply QoS tagging is only half the battle. We also need the PBX to apply tagging on outbound packets.
  
My current PBX is 3CX version 9, running in a Windows 7 virtual machine. 
I initially planned to use 3CX’s native DSCP tagging capability to apply [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in the <a href="http://www.mcbsys.com/techblog/2011/05/basic-qos-setup-on-a-cisco-sg-200-switch/" target="_blank">previous post</a>, getting endpoints to apply QoS tagging is only half the battle. We also need the PBX to apply tagging on outbound packets.</p>
<p>  <span id="more-800"></span>
<p>My current PBX is 3CX version 9, running in a Windows 7 virtual machine. </p>
<p>I initially planned to use 3CX’s native DSCP tagging capability to apply tags. But that didn’t work. According to <a href="http://www.3cx.com/forums/msrtptos-does-not-add-dscp-tags-under-windows-20435.html#p103252" target="_blank">this 3CX forum thread</a>, this is due to a limitation in Windows 7; the QoS API has been “banned.”</p>
<p>The recommendation is to follow <a href="http://www.3cx.com/blog/voip-howto/qos-windows-2008-server-local-policy/" target="_blank">this blog post</a> to set up QoS through Policy. Sure enough, that works fine. I did modify the instructions a bit for my environment:</p>
<ul>
<li>I used Group Policy rather than Local Policy, simply restricting the scope to the virtual machine running 3CX. </li>
<li>To be consistent with my endpoints, I applied DSCP 46 (Expedited Forwarding) rather than 56 as recommended in the blog post. </li>
<li>Rather than set up one policy covering <em>all</em> traffic from the PBX machine, I set up three policies, each one for a different 3CX executable:
<p><strong>3CXMediaServer.exe</strong> covers standard RTP traffic on any port.       <br /><strong>3CXPhoneSystem.exe</strong> generates the SIP traffic (port 5060 by default).      <br /><strong>3CXTunnel.exe</strong> is used when tunneling from a 3CX softphone (port 5090).      </li>
</ul>
<p>My Group Policy looks like this:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/06/3CX-QoS.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="3CX QoS" border="0" alt="3CX QoS" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/06/3CX-QoS_thumb.png" width="554" height="75" /></a></p>
<p>Now all VoIP traffic inside my network is tagged with DSCP 46.</p>
<p>Next step would be to get calls to and from the VoIP provider to be QoS tagged. Oh, and every Internet switch between me an them to use QoS for prioritizing packets. Yeah, right. At this point, getting QoS to work beyond the firewall seems pretty unlikely for a small business on a standard DSL or cable connection.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2011/06/setting-up-qos-for-3cx-under-windows-7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Basic QoS Setup on a Cisco SG 200 Switch</title>
		<link>http://www.mcbsys.com/techblog/2011/05/basic-qos-setup-on-a-cisco-sg-200-switch/</link>
		<comments>http://www.mcbsys.com/techblog/2011/05/basic-qos-setup-on-a-cisco-sg-200-switch/#comments</comments>
		<pubDate>Fri, 27 May 2011 23:34:21 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[qos]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/?p=795</guid>
		<description><![CDATA[I recently purchased a Cisco SG 200-26 gigabit switch to upgrade the office infrastructure. This is a “lightly-managed” switch with a web interface. Here’s what I’ve learned so far about setting up basic Quality of Service (QoS) for Voice over IP (VoIP).

First, this is a small business environment with a simple router. Since there is [...]]]></description>
			<content:encoded><![CDATA[<p>I recently purchased a <a href="http://www.cisco.com/cisco/web/solutions/small_business/products/routers_switches/200_series_switches/index.html-tab-Models" target="_blank">Cisco SG 200-26</a> gigabit switch to upgrade the office infrastructure. This is a “lightly-managed” switch with a web interface. Here’s what I’ve learned so far about setting up basic Quality of Service (QoS) for Voice over IP (VoIP).</p>
<p><span id="more-795"></span></p>
<p>First, this is a small business environment with a simple router. Since there is no VLAN-aware router or Layer 3 switch, we won’t use a separate VLAN for VoIP traffic (since there would be no way for the traffic to jump from the Voice VLAN to the main VLAN and out onto the Internet). Instead, we have two goals:</p>
<ul>
<li>Get VoIP traffic coming from two endpoints tagged with QoS headers. The endpoints are a SIP phone (Polycom IP 430) and an Analog Terminal Adapter (Cisco/Linksys SPA3102).</li>
<li>Get the switch to prioritize that VoIP traffic ahead of other traffic.</li>
</ul>
<p>At this point, the router and the ISP do not support QoS, so we’re really only concerned with traffic inside the office. However packets leaving the switch for the router should remain tagged in case the router and ISP eventually support QoS.</p>
<h3>Checking the Default Headers</h3>
<p>We’ll use Wireshark to check the headers for DSCP tags. (This <a href="http://blogs.msdn.com/b/wndp/archive/2007/09/07/detecting-802-1p-priority-tags.aspx" target="_blank">MSDN article</a> explains why you can’t see Class of Service/802.1p tags in Wireshark very easily.)</p>
<p>To be able to see the packets in Wireshark, use the switch to mirror a port. My phone is on port g17 and my PC is on port g1, so under Administration &gt; Diagnostics &gt; Port and VLAN Mirroring, here’s how I set up the mirroring:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 7" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-7.png" border="0" alt="SG 200 QoS 7" width="329" height="140" /></p>
<p><strong>Note</strong> <em>You will lose network connectivity on the destination port!</em> To reconnect to the network (including the switch’s web management UI), plug the network cable from your PC into a different port on the switch.</p>
<p>With Wireshark running and the mirrored port active, from the SIP phone, make an outbound call (e.g. check your voicemail). Hang up, stop Wireshark, and review an outbound RTP packet. In the Internet Protocol section, the Differentiated Services Field should show Default (0&#215;00):</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-8.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 8" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-8_thumb.png" border="0" alt="SG 200 QoS 8" width="354" height="72" /></a></p>
<p>While we’re at it, let’s check the packets coming from the ATA. Set up the appropriate port mirror and start Wireshark. Assuming you have an analog phone connected to the ATA, make an outbound call from your analog phone. Again review an outbound RTP packet:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-9.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 9" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-9_thumb.png" border="0" alt="SG 200 QoS 9" width="354" height="43" /></a></p>
<p>Interesting:&nbsp; the SPA3102 (with firmware 5.1.10) is apparently automatically tagging packets with a DSCP value of Expedited Forwarding (0&#215;2e = 46).</p>
<p>I should perhaps mention that the SPA3102 itself has a QOS Settings section in its advanced Wan Setup page. The options for QOS QDisc are NONE and TBF. As best I can tell, this only applies when the SPA3102 is used as a router, i.e. it lets you enable basic QoS prioritization for traffic passing <em>through</em> the SPA3102. Since I’m using the SPA3102 as an endpoint only, that doesn’t apply, so I’ve left my QOS QDisc value set to NONE.</p>
<p>Since the SPA3102 is already tagging packets appropriately, we only need to worry about adding those packets to traffic coming from the phone.</p>
<h3>Setting Up the Switch</h3>
<p>According to Cisco support, the preferred way to set up QoS for VoIP is using LLDP MED to tell endpoints how to tag the traffic. The Polycom phone does support LLDP MED, so let’s try it:</p>
<p>1. In the switch’s web interface, under Administration &gt; Discovery – LLDP &gt; LLDP MED Network Policy, define this policy:</p>
<p>Network Policy Number:&nbsp; 1<br />
Application:&nbsp; Voice&nbsp;<br />
VLAN ID:&nbsp; 1 (the default VLAN)<br />
VLAN Type:&nbsp; Tagged<br />
User Priority:&nbsp; 5 (the Class of Service if using old 802.1p tagging)<br />
DSCP Value:&nbsp; 46 (also called EF for <a href="http://www.cisco.com/en/US/tech/tk543/tk757/technologies_tech_note09186a00800949f2.shtml#expeditedforwarding" target="_blank">Expedited Forwarding</a>)</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-1.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 1" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-1_thumb.png" border="0" alt="SG 200 QoS 1" width="354" height="186" /></a></p>
<p>2. Under Administration &gt; Discovery – LLDP &gt; LLDP MED Port Settings, tell the switch to enable LLDP MED on the port to which the phone is attached:</p>
<p>Port:&nbsp; Port to which phone is attached<br />
LLDP MED Status:&nbsp; Enable<br />
System Log Notification:&nbsp; Enable<br />
Available Optional TLVs:&nbsp; choose Network Policy<br />
Available Network Policies:&nbsp; choose 1<br />
Location Coordinate:&nbsp; blank<br />
Location Civic Address:&nbsp; blank<br />
Location ECS ELIN:&nbsp; blank</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-2.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 2" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-2_thumb.png" border="0" alt="SG 200 QoS 2" width="354" height="424" /></a></p>
<p>3. Now let’s check the Quality of Service settings. Most of these are default values. The following screen shots are from Quality of Service &gt; General:</p>
<p><strong>QoS Properties:</strong></p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 3" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-3.png" border="0" alt="SG 200 QoS 3" width="269" height="144" /></p>
<p>If desired, from this screen, you can manually assign CoS 5 to the SPA3102 port. Since the SPA312 is already assigning (at least) DSCP, I won’t bother with CoS.</p>
<p><strong>Interface Settings:</strong>&nbsp; all enabled</p>
<p><strong>Queue:</strong></p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-4.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 4" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-4_thumb.png" border="0" alt="SG 200 QoS 4" width="354" height="197" /></a></p>
<p><strong>CoS/802.1p:</strong>&nbsp; Note that CoS 5 maps to Queue 4:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 5" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-5.png" border="0" alt="SG 200 QoS 5" width="197" height="264" /></p>
<p><strong>DSCP to Queue:</strong>&nbsp; Note that DSCP 46 (EF) also maps to Queue 4:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-6.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 6" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-6_thumb.png" border="0" alt="SG 200 QoS 6" width="354" height="278" /></a></p>
<p>Save your changes to the switch by clicking this link at the top of the screen:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 11" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-11.png" border="0" alt="SG 200 QoS 11" width="58" height="36" /></p>
<h3>Checking the Modified Headers</h3>
<p>With the changes to the switch complete, reboot the phone to force it to check for LLDP MED values. Then use Wireshark again to trap an outbound RTP packet during a call:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-10.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 10" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-10_thumb.png" border="0" alt="SG 200 QoS 10" width="354" height="43" /></a></p>
<p>Ta da! The phone is now tagging the packets with Expedited Forwarding (0&#215;2e = 46).</p>
<h3>Checking for Prioritized Packets</h3>
<p>If everything is working, the switch should be prioritizing VoIP traffic into Queue 4. To check this, we need to count packets that are <em>leaving</em> the switch (after prioritization).</p>
<p>Go to Quality of Service &gt; QoS Statistics &gt; Queues Statistics and add a counter to monitor Queue 4 on an outbound port (e.g. the one going to your PBX, g10 in my case):</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-12.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 12" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-12_thumb.png" border="0" alt="SG 200 QoS 12" width="309" height="243" /></a></p>
<p>On the main Queue Statistics page, click Clear Counters, then set a 15-second Refresh Rate. Call your PBX from the SIP or analog phone to generate some VoIP traffic. You should see the count of Total Packets increase as the prioritized packets flow through the switch:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-13.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="SG 200 QoS 13" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/05/SG-200-QoS-13_thumb.png" border="0" alt="SG 200 QoS 13" width="354" height="157" /></a></p>
<h3>Only Half Done</h3>
<p>Hooray, our switch is now prioritizing packets with DSCP 46 ahead of other traffic, and we’ve used the switch to tell the Polycom phone to add DSCP 46 to its headers (the SPA3102 was doing that already). However because we’re using an in-house PBX, that’s only half the traffic:&nbsp; packets coming <em>from</em> the PBX <em>to</em> the endpoints still have DSCP 0, as do packets leaving the PBX for the router. Fixing that will be the subject of the <a href="http://www.mcbsys.com/techblog/2011/06/setting-up-qos-for-3cx-under-windows-7/" target="_self">next post</a>.</p>
<p><strong>Note</strong> Remember to remove any port mirroring settings from your switch setup! (Administration &gt; Diagnostics &gt; Port and VLAN Mirroring)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2011/05/basic-qos-setup-on-a-cisco-sg-200-switch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PBX in a Flash as a Virtual Machine, Take 2: Hyper-V</title>
		<link>http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/</link>
		<comments>http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 20:21:20 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[hyper-v]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/PBX-in-a-Flash-as-a-Virtual-Machine-Take-2-Hyper-V.aspx</guid>
		<description><![CDATA[Back in November 2008, I blogged&#160; about Setting Up PBX in a Flash, Part 1: Configuring a Virtual Machine. That article discussed running PBX in a Flash (PiaF) under Microsoft Virtual PC or Virtual Server 2005. Within a couple weeks, I abandoned the virtual machine approach and published Moving PBX in a Flash from a [...]]]></description>
			<content:encoded><![CDATA[<p>Back in November 2008, I blogged&nbsp; about <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx" target="_blank">Setting Up PBX in a Flash, Part 1: Configuring a Virtual Machine</a>. That article discussed running PBX in a Flash (PiaF) under Microsoft Virtual PC or Virtual Server 2005. Within a couple weeks, I abandoned the virtual machine approach and published <a href="http://blogs.mcbsys.com/mark/post/Moving-PBX-in-a-Flash-from-a-Virtual-to-a-Physical-Machine.aspx">Moving PBX in a Flash from a Virtual to a Physical Machine</a>.</p>
<p>Recently I&#8217;ve been testing Microsoft&#8217;s free bare-metal hypervisor, <a href="http://www.microsoft.com/hyper-v-server/en/us/default.aspx">Microsoft Hyper-V Server 2008 R2</a>. Especially now that <a href="http://www.microsoft.com/windowsserver2008/en/us/hyperv-supported-guest-os.aspx" target="_blank">Hyper-V supports Red Hat Enterprise Linux</a>, could Hyper-V be the answer to virtualizing PiaF on a Microsoft platform?</p>
<p>Let&#8217;s try it and see what happens.</p>
<p><span id="more-13"></span></p>
<h1>Setting Up CentOS under Hyper-V Server 2008 R2</h1>
<p>I&#8217;ll assume you have Hyper-V Server installed and running. Follow these steps to set up CentOS under Hyper-V Server using the PiaF installation ISO:</p>
<ol>
<li>Set up a new virtual machine with 512MB of memory, a 10GB virtual IDE hard disk (for servers, I&#8217;m told that fixed disks perform better than dynamic disks), and a connected <em>legacy</em> network card. Note that the fixed disk and legacy card cannot be configured through the New Virtual Machine Wizard; you&#8217;ll have to modify the settings once the virtual machine exists.</li>
<li><a href="http://www.pbxinaflash.com/downloads/" target="_blank">Download</a> the PBX in a Flash 1.4 ISO file. Attach the ISO to the virtual machine&#8217;s DVD-ROM drive (Media &gt; DVD Drive) and start the machine.</li>
<li>At the first install prompt, type <code>ksalt</code>. This starts the install in text mode, which avoids an issue with 24-bit video. It also does not use the LVM file system, which apparently adds unnecessary overhead (according to <a href="http://pbxinaflash.com/forum/showthread.php?t=2469" target="_blank">jroper</a>). I deliberately chose a very simple root password during the setup so I could take this virtual machine to client sites one day if needed.</li>
<li>Toward the end of the installation, you&#8217;ll see that CentOS is &#8220;Installing bootloader,&#8221; then the install reboots. As soon as the reboot starts, quickly select Media &gt; DVD Drive &gt; Eject. If you miss this, the install will start over.</li>
<li>After the boot completes, you&#8217;ll be prompted about which PiaF &#8220;payload&#8221; to use. Choose &#8220;A&#8221; for the latest stable release via the Internet. The download goes quickly but it does take awhile to compile Zaptel, Asterisk, etc. Once that completes, the system reboots again.</li>
<li>When this reboot completes (you&#8217;ll see the &#8220;pbx login&#8221; prompt), shut down the machine by sending a Ctrl-Alt-Del from Hyper-V Server and stopping the machine when it is at the BIOS startup stage. Use Hyper-V Manager to Export a copy of your virtual machine at this point, so you can come back to this point if you encounter problems with the steps below. (A snapshot would also work but an export can be imported at another location.) I&#8217;m testing the free <a href="http://www.7-zip.org/" target="_blank">7-Zip</a> for creating a compressed copy of the exported virtual machine. (To install the 64-bit version of 7-Zip 4.65 under Hyper-V Server 2008 R2, run the installer on the server by typing <code>msiexec /i 7z465-x64.msi</code>&nbsp; at a command prompt.) Name the compressed file something like &#8220;PiaF.1.Immediately after CentOS Install.zip&#8221;.</li>
<li>Start the virtual machine and log on to CentOS. Make sure that CentOS is connected to the network. At a command prompt:<br />
<code>/sbin/ifconfig</code> # check whether an IP address has been assigned; if so, skip the rest of this step<br />
<code>system-config-network</code> # if you need to check the network setup<br />
<code>nano -w /etc/sysconfig/network-scripts/ifcfg-eth0</code> # view network setup in text form<br />
<code>service network restart</code> # restart with updated network setup if you made changes<br />
<code>/sbin/ifconfig</code> # check that an IP address has now been assigned</li>
<li>Add the kernel options. I tried using <a href="http://kb.vmware.com/kb/1006427" target="_blank">VMWare&#8217;s recommendations</a>, since they have specific advice on CentOS 5.2. The <a href="http://bugs.centos.org/view.php?id=2189" target="_blank">CentOS bug report</a> seems to confirm that the kernel options <code>divider=10 clocksource=acpi_pm</code> should take care of the clock cycle issue without the need for a &#8220;vm&#8221; kernel (compiled with a 100Hz clock instead of 1000Hz). However, after making that change, I was getting <em>lots</em> of messages reading, &#8220;rtc lost some interrupts at 1024hz&#8221;. So I&#8217;m going back to my <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx" target="_blank">original procedure posted in November 2008</a>:<br />
<code>nano -w /boot/grub/menu.lst</code>&nbsp;<br />
At the end of the &#8220;kernel&#8221; line, add this string:<br />
<code><code>clocksource=pit nosmp noapic nolapic</code></code></li>
<li>Update the kernel with the CentOS Virtual Machine kernel. This is <a href="http://www.pbxinaflash.com/vm/">outlined on the PiaF site</a>, but do <em>not</em> recompile Zaptel as instructed there. The &#8220;vm&#8221; kernels are available <a href="http://dev.centos.org/%7Etru/kernel-vm/5/RPMS/i386/">here</a>. Note:&nbsp; choose the version that matches your current kernel. Here are the download and install commands:<br />
<code>cd /root</code><br />
<code>uname -r</code> # Check your Linux version. Modify the next two lines to match.<br />
<code>wget http://dev.centos.org/~tru/kernel-vm/5/RPMS/i386/kernel-vm-2.6.18-92.1.22.el5.i686.rpm</code><br />
<code>wget http://dev.centos.org/~tru/kernel-vm/5/RPMS/i386/kernel-vm-devel-2.6.18-92.1.22.el5.i686.rpm</code><br />
<code>rpm -ivh kernel-vm*.rpm</code></li>
<li>Edit grub to make the new kernel load by default.<br />
<code>nano -w /boot/grub/menu.lst</code><br />
In this file, set <code>default=0</code> if the .e15vm kernel is listed first. After saving the file, reboot.<br />
<code>shutdown -r now<br />
</code></li>
<li>After the reboot, check the Linux version to make sure it ends in &#8220;vm&#8221;:<br />
<code>uname -r<br />
</code></li>
<li>You can confirm that the <code>clocksource</code> is set to <code>pit</code> using the method suggested in <a href="http://fixunix.com/hardware/243541-what-clock-source-my-kernel-using.html" target="_blank">this thread</a>:<br />
<code>cat /sys/devices/system/clocksource/clocksource0/current_clocksource</code></li>
</ol>
<p>After these changes, I no longer have any time errors appearing on the virtual machine console, even when left on overnight.</p>
<h1>Installing Microsoft Linux Integration Components for Windows Server 2008 Hyper-V R2</h1>
<p>You&#8217;ll need to <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c299d675-bb9f-41cf-b5eb-74d0595ccc5c&amp;displaylang=en" target="_blank">download</a> and install the Linux Integration Components for Windows Server 2008 Hyper-V R2. There are some significant differences here from the old VM Additions for Linux that worked with Virtual Server. Two notable changes are that the Integration Components for Hyper-V no longer include time synchronization or shutdown integration. However, we should benefit from the enhanced network and disk drivers.</p>
<p><span style="color: #0000ff;">Update 9/30/2010:</span>&nbsp; This article was written using V2 of the Linux Integration Components. See the comments for links to later version(s).</p>
<p>One &#8220;gotcha&#8221; right out of the gate:&nbsp; to extract the ISO needed to install the Integration Components, you must run the downloaded Linux_IC_v2.EXE file. In spite of its claim to be a Win32 Cabinet Self-Extractor, when I tried to run it on my 32-bit XP machine, it tells me that is is not &#8220;not a valid Win32 application.&#8221; Windows 7 (32-bit) gives a similar error. Once I copied the file to my 64-bit Hyper-V Server 2008 R2 machine, I was able to extract the ISO.</p>
<p>The package includes a helpful readme in PDF format. Since CentOS is based on Red Hat, follow the section titled, &#8220;Installing the Linux Integration Components Version 2 on Red Hat Enterprise Linux 5.&#8221; Here&#8217;s the trimmed-down version:</p>
<ol>
<li>Normally you would need to run <code>yum update kernel</code>, reboot, then run <code>yum install kernel-devel gcc</code> to get the kernel source. However, it seems that the PiaF already includes the kernel source, so this step is not needed with PiaF.</li>
<li>From Hyper-V Manager, start your PiaF virtual machine. Then select Media &gt; DVD Drive &gt; Insert Disk and load the extracted LinuxIC_v2.ISO file.</li>
<li>Log on to the virtual machine. Mount the drive and copy the files to a new directory as follows:<br />
<code>mkdir /media/cdrom</code><br />
<code>mount /dev/cdrom /media/cdrom</code><br />
<code>mkdir /usr/src/linux_ic_v2</code><br />
<code>cp /media/cdrom/* /usr/src/linux_ic_v2 -R</code> # -R to recursively copy directories<br />
<code>umount /dev/cdrom</code><br />
You can eject the ISO image from the virtual machine at this point.</li>
<li>Install the synthetic drivers. No reboot is required here.<br />
<code>cd /root&nbsp; </code># install won&#8217;t run if you are in the source folder, so make sure we&#8217;re at root folder<br />
<code>/usr/src/linux_ic_v2/setup.pl drivers<br />
</code></li>
<li>Verify that the installation succeeded.<br />
<code>/sbin/lsmod | grep vsc</code><br />
The output should look something like this:<br />
<code>netvsc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 45616&nbsp; 0</code><br />
<code>storvsc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 37028 0</code><br />
<code>vmbus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 56520&nbsp; 2 netvsc,storvsc</code><br />
<code>scsi_mod&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 134605&nbsp; 3 storvsc,libata,sd_mod</code></li>
<li>Configure the synthetic network card (seth0).<br />
<strong>Note:</strong>&nbsp; do this from the Hyper-V Manager connection directly, not through a remote connection like Putty.<br />
So far you probably have one Legacy Network Adapter configured for the VM. From Hyper-V Manager, set that adapter to &#8220;Not connected&#8221;, then set a <em>non</em>-legacy network adapter to an active connection. (You can do this while the VM is online, but you&#8217;ll have to wait until shutdown to actually remove the legacy adapter.) Finally, make the corresponding changes inside the virtual machine.<br />
<code>nano -w /etc/sysconfig/network-scripts/ifcfg-eth0</code> #<br />
Disable the legacy card:&nbsp; set<br />
<code>ONBOOT=no<br />
</code>After saving the file:<br />
<code>service network restart</code> # restart with updated network setup<br />
<code>/sbin/ifconfig</code> # eth0 should be gone; check that an IP address has now been assigned to seth0</li>
<li>Check the Fastpath boot setup. When you run the following command, you should see that <code>hda=noprobe</code> and <code>hdb=noprobe</code> have been added to your kernel boot options. Copy these options to the non-vm kernel line in case you ever need to boot from it:<br />
<code>nano -w /boot/grub/menu.lst</code>&nbsp;</li>
</ol>
<p>As mentioned, the Linux Integration Components don&#8217;t support shutdown from the Hyper-V host. However Hyper-V is able to <em>save</em> a PiaF guest within a few seconds. I plan to try that as my Automatic Stop Action in Hyper-V Settings. Restarting a saved machine may cause problems until the clock is resynchronized (see NTP below), but it seems preferable to just &#8220;pulling the plug&#8221; if, for example, the UPS needs to shut down the host due to a power outage.</p>
<h1>Tweaking NTP</h1>
<p>With Virtual Server 2005, I disabled NTP and relied on the time to sync to the host. The Hyper-V extensions do not include time synchronization, so follow the instructions near the bottom of <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1006427" target="_blank">this VMWare document</a> for doing so:</p>
<p>Since we have conflicting advice, and nothing definitive for Microsoft Virtual Server, I&#8217;ve decided to try the following:</p>
<ol>
<li>Open the NTP configuration file:<br />
<code>nano -w /etc/ntp.conf</code></li>
<li>Add the following as the first line in the file (&#8220;instructs NTP not to give up if it sees a large jump in time&#8221;):<br />
<code>tinker panic 0</code></li>
<li>Comment out these two lines (prevent fallback to the &#8220;undisciplined local clock&#8221;):<br />
<code>#server 127.127.1.0 # local clock</code><br />
<code>#fudge 127.127.1.0 stratum 10</code></li>
<li>Restart the NTP daemon:<br />
<code>service ntpd restart</code></li>
</ol>
<p>At this point you should have a working CentOS installation under Hyper-V that can more or less tell time. Check the time by typing <code>date</code> at the command prompt and comparing it to the clock on your host system.</p>
<p>On startup I do see some NTP messages reading, &#8220;ntpd[1970]: frequency error 512 PPM exceeds tolerance 500 PPM,&#8221; but this does not seem to keep NTP from syncing the time. I&#8217;ll have to check this occasionally to make sure the clock isn&#8217;t drifting too much. This command will show the last 100 ntpd messages:</p>
<p><code>tail -100 /var/log/messages | grep ntpd --color</code></p>
<h1>Moving from Physical to Virtual</h1>
<p>Most of the remaining setup steps have been covered in other posts, but there&#8217;s a huge shortcut if you are just moving from one PiaF machine to another. Here are the steps you&#8217;ll want to follow.</p>
<h2>Finishing the CentOS Configuration</h2>
<p>Follow the steps in <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx">Setting Up PBX in a Flash, Part 2:&nbsp; Before Running FreePBX</a> to complete the CentOS configuration. A few tips to keep in mind:</p>
<ul>
<li>You may want to temporarily give the new machine its own IP address in your router so you can have both the old and new machines online during the steps below. There should be no issue giving the new machine the same host name as the old machine.</li>
<li>You can use the temporary IP address to access the new machine, so you don&#8217;t need to set up a special name in your DNS server.</li>
<li>If you want to save your work as you go, shut down the virtual machine and user Hyper-V Manager to either take a snapshot and/or export the virtual machine.</li>
</ul>
<h2>Copying the tftp Setup</h2>
<p>If you&#8217;re using tftp, review <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-a-Polycom-IP-430-Phone-with-FreePBX.aspx">Setting Up a Polycom IP 430 Phone with FreePBX</a> for details on the tftp setup. Since my system is not open to the network, I allow writing to the tftpboot folder. Follow these steps to copy the tftp setup:</p>
<ol>
<li>Open access to tftpboot:<br />
<code>chmod 777 /tftpboot</code></li>
<li>Use <a href="http://winscp.net" target="_blank">WinSCP</a> to copy the contents of the tftp configuration file, <code>/etc/xinetd.d/tftp</code>, from your physical your Windows desktop, then paste it into the same file on the virtual machine.</li>
<li>Use WinSCP to copy all the files in <code>/tftpboot</code> from the physical machine to the virtual machine.</li>
</ol>
<h2>Updating the FreePBX Configurations</h2>
<p>The shortcut will be to copy the configuration from the old, physical machine to the new, virtual machine. To make sure this goes smoothly, let&#8217;s first get the base configuration of the two machines to match.</p>
<h3>Update the Physical Machine</h3>
<p>On the old, physical machine, update all installed modules to the latest versions:</p>
<ol>
<li>In a browser, open the IP address or DNS name of the old PBX.</li>
<li>From the PBX in a Flash menu, in the lower left corner, click on Admin. This adds a few buttons to the screen.</li>
<li>Click on the FreePBX Administration button. Type <code>maint</code> as the user name. Use the password that you assigned using <code>passwd-master</code> near the end of <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx">part 2</a>. This loads the main FreePBX administration screen, which will be our starting point for the rest of the tasks this article. You might want to bookmark this page so you can return here directly without going through the PiaF button top-level screen.</li>
<li>The left column has two tabs, Setup and Tools. From the Setup tab, click on Module Admin. This shows the list of currently-installed modules.</li>
<li>At the top of the Module Administration page, click on the link Check for Updates Online. Now you will see <em>all</em> modules that are available.</li>
<li>Click on the Upgrade All link (<em>not</em> Download All). This simply selects all upgradable modules; it doesn&#8217;t start the download and upgrade process.</li>
<li>Scroll to the bottom of the page. Click on Process. Scroll to the bottom of <em>that</em> page. Click on Confirm. An orange popup window appears where you can monitor the progress of the installations. After a few minutes, when you scroll to the bottom of the orange popup, you&#8217;ll see a Return link. Click on Return.</li>
</ol>
<h3>Update the Virtual Machine</h3>
<p>Log on to the new, virtual machine, and follow the steps in the first section of the <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx" target="_blank">Step 3</a> article, &#8220;Updating and Adding FreePBX modules.&#8221; <em>Install the same modules on the new machine as are installed on the old machine.</em></p>
<p><strong>Tip:</strong>&nbsp; I found it simplest to install <em>all</em> the modules on the new machine, then go back and uninstall the ones that are not installed on the old machine.</p>
<p>Now that both machines have the same FreePBX modules installed, we are ready to copy the configuration.</p>
<h2>Copy the Configuration from Old to New</h2>
<p>Follow these steps to use the FreePBX Backup &amp; Restore utility to copy your entire configuration from the old to the new machine:</p>
<ol>
<li>On the old machine, from the FreePBX administration screen, go to the Tools tab, Backup &amp; Restore. Add a Backup Schedule named OnDemand. Back up all sections (Voice Mail, System Recordings, System Configuration, CDR, and Oeprator Panel). Set the Run Backup time to Now and click on Submit Changes.</li>
<li>Using WinSCP, copy the new backup file from <code>/var/lib/asterisk/backups/OnDemand</code> to your Windows desktop. The file will have a timestamp as its name and end in <code>.tar.gz.</code><br />
<strong>Note:</strong>&nbsp; Do not rename the backup file! I thought I would be clever and give it a more meaningful name. This caused the restore to fail, probably because the restore expects the <code>.tar</code> file inside the <code>.tar.gz</code> file to have the same name as the <code>.tar.gz</code> file.</li>
<li>On the new machine, from the FreePBX administration screen, also create a backup called OnDemand. This is mostly done so FreePBX will create the OnDemand directory and will know to look for backups in that directory.</li>
<li>Use WinSCP to copy the old machine&#8217;s backup file from your Windows desktop to <code>/var/lib/asterisk/backups/OnDemand</code> on the new machine.</li>
<li>On the new machine, from the FreePBX administration screen, , go to the Tools tab, Backup &amp; Restore. Click on Restore from Backup and navigate down to the OnDemand directory and to the old machine&#8217;s backup file (make sure the time stamp matches the backup from the old machine.) Choose Restore Entire Backup Set, and confirm that you want to overwrite all FreePBX and Asterisk files.</li>
<li>When the restore completes, click on the orange Apply Configuration Changes. Your new system should now match your old system exactly! In the Setup tab, check some known values (Extensions, Trunks, Inbound Routes) to be sure.</li>
<li>For some reason, the configuration backup/restore does not include the <code>/etc/amportal.conf</code> file. If you&#8217;ve customized this file (e.g. to specify the AMPWEBADDRESS or to send backups to an FTP server), copy the file from the old machine to the new machine using WinSCP.</li>
</ol>
<h2>Cut Over from Physical to Virtual</h2>
<p>If you manage your IP addresses through your router, this last bit is easy:</p>
<ol>
<li>Shut down both your old, physical machine and your new, virtual machine.</li>
<li>Optional:&nbsp; in Hyper-V Manager, Export the fully-configured virtual machine. Back up this export so you can return to this state later.</li>
<li>In your router, in the list that maps MAC addresses to IP addresses, note down the IP address of the physical machine and then delete it from the (or assign it an IP that is not in use).</li>
<li>Also in the router&#8217;s address map, update the MAC address of the virtual machine to map to the IP address that had heretofore been used by the physical machine.</li>
<li>Use Hyper-V Manager to start the new, virtual machine.</li>
<li>After the virtual machine is running, reboot or cycle power on your other telephony devices (SPAs, IP phones) to force them to register with the new machine. Note that as far as these devices are concerned, the PBX server hasn&#8217;t moved, since it has the same IP address as the old, physical machine.</li>
</ol>
<p>Now you are finally ready to make some test calls and see how they sound! In my initial tests, I hear no echo or jittery &#8220;cell phone&#8221; audio and can detect no difference from a physical machine. Maybe Hyper-V finally allows running Asterisk in a Window virtual environment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Keeping Asterisk Traffic Inside the VPN</title>
		<link>http://www.mcbsys.com/techblog/2009/01/keeping-asterisk-traffic-inside-the-vpn/</link>
		<comments>http://www.mcbsys.com/techblog/2009/01/keeping-asterisk-traffic-inside-the-vpn/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 16:38:11 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[dtmf]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">/mark/post/Keeping-Asterisk-Traffic-Inside-the-VPN.aspx</guid>
		<description><![CDATA[No DTMF
I&#8217;m setting up a new PBX in a Flash (PiaF) machine running Asterisk 1.4.21.2. I&#8217;m testing it by calling in with SJPhone across a VPN (the PiaF machine is at a client site). When I dial 7777, I get my top-level IVR, but when I press a number, nothing happens. If I dial into [...]]]></description>
			<content:encoded><![CDATA[<h1>No DTMF</h1>
<p>I&#8217;m setting up a new PBX in a Flash (PiaF) machine running Asterisk 1.4.21.2. I&#8217;m testing it by calling in with SJPhone across a VPN (the PiaF machine is at a client site). When I dial 7777, I get my top-level IVR, but when I press a number, nothing happens. If I dial into a voicemail box, the * and # keys have no effect. It seems PiaF is not hearing my DTMF tones at all.<br />
<h1>Unexpected Public Traffic</h1>
<p><span id="more-45"></span></p>
<p>I ran Ethereal to make sure the DTMF digits were being generated, and sure enough, they were. But what&#8217;s this? In spite of using a VPN, the RTP traffic was re-routed to the public Internet address, i.e. to 180.12.12.12. Since the hardware firewall in front of the PiaF machine does not allow inbound RTP traffic from the public Internet, no tones were getting through. But how does it even know to re-route the traffic to the external IP?</p>
<p>I remembered that, based on the <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx" target="_blank">Part 2</a> of the setup instructions, the section &#8220;Getting Rid of One-Way Audio&#8221; calls for the following modification to /etc/asterisk/sip_custom.conf:</p>
<p><code>externip=180.12.12.12</code></p>
<p>I don&#8217;t really need that now, since I&#8217;m only using analog lines. Commenting out the &#8220;externip&#8221; line does solve the DTMF problem, but what if I want to use a VoIP provider in the future?</p>
<h1>Keep It Inside the VPN</h1>
<p>A glance at Voip-Info&#8217;s <a href="http://www.voip-info.org/wiki/index.php?page=Asterisk+SIP+externip" target="_blank">Asterisk SIP externip</a> article gave me the clue I needed:&#160; all that is required is to add a second localnet line identifying the IP range of the computers at the other end of the VPN. That allows the RTP traffic to stay inside the VPN, and PiaF was again able to &#8220;hear&#8221; DTMF digits. So my sip_custom.conf now looks like this:</p>
<p><code>externip=180.12.12.12<br />
localnet=192.168.1.0/255.255.255.0 ; address range of local computers<br />
localnet=192.168.2.0/255.255.255.0 ; address range of VPN-connected computers</code></p>
<p>If I decide to add VoIP providers in the future, &#8220;all&#8221; I&#8217;ll have to do is to get the firewall set up to allow external (encrypted?) VoIP traffic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2009/01/keeping-asterisk-traffic-inside-the-vpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving PBX in a Flash from a Virtual to a Physical Machine</title>
		<link>http://www.mcbsys.com/techblog/2008/11/moving-pbx-in-a-flash-from-a-virtual-to-a-physical-machine/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/moving-pbx-in-a-flash-from-a-virtual-to-a-physical-machine/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 17:45:28 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[v2p]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vm]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Moving-PBX-in-a-Flash-from-a-Virtual-to-a-Physical-Machine.aspx</guid>
		<description><![CDATA[After running PBX in a Flash (PiaF) in a virtual machine for a few days, I had a couple issues:
The system would generate an occasional message &#8220;TSC appears to be running slowly. Marking it as unstable.&#8221; This issue did not keep the PBX from running.
Voice quality was sometimes jittery. In a call, it would sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>After running PBX in a Flash (PiaF) in a virtual machine for a few days, I had a couple issues:</p>
<p>The system would generate an occasional message &#8220;TSC appears to be running slowly. Marking it as unstable.&#8221; This issue did not keep the PBX from running.</p>
<p>Voice quality was sometimes jittery. In a call, it would sometimes &#8220;cut out&#8221; (like a bad cell connection). In voicemail, even listening to the pre-recorded prompts, there was frequently some garbled-sounding audio.</p>
<p><span id="more-47"></span></p>
<h1>Workarounds</h1>
<p>The jittery voice seemed to be a horsepower issue. It&#8217;s like it couldn&#8217;t read the virtual disk fast enough and/or it couldn&#8217;t process the audio stream fast enough.</p>
<p>I was running PiaF under Microsoft Virtual Server 2005. The host was an old Dell Optiplex GX260, a Pentium 4 2GHz with 1GB of RAM. I dedicated 512MB of RAM to the virtual machine.</p>
<p>I found that if I moved the virtual machine to my IBM T60p laptop (T5300 Dual Core), still with 512MB of RAM, the jittery voice problem went away. I still got the &#8220;TSC&#8221; message, though.</p>
<p>Another workaround is to get Asterisk out of the audio stream altogether. I blogged this <a href="http://blogs.mcbsys.com/mark/post/Getting-Asterisk-to-Bridge-Audio.aspx">here</a>. That solves the problem when two endpoints are talking, but it doesn&#8217;t solve the voicemail problem, and it does limit some of Asterisk&#8217;s features (call recording and transfer, for example).</p>
<h1>Getting Physical</h1>
<p>I concluded that I needed to convert to a physical setup to see if I could permanently solve these issues.</p>
<p>I hated to convert my fully-configured Windows XP machine to a dedicated PiaF box. I noticed in the PiaF status window that it was consistently using less than 40% of the 512MB RAM. Could it possibly run on the old Dell PowerEdge 2400 that has been sitting in the garage collecting dust? That&#8217;s a Pentium III 733 MHz with a whopping 256MB of RAM. Well, doesn&#8217;t hurt to try.</p>
<p>Following the instructions in my earlier posts, skipping the parts relating to virtual machines, I was able to get PiaF installed on the PE 2400 in a little over an hour (it took quite a while to compile Asterisk!). Transferring my setup from the virtual to the physical machine using the FreePBX Backup &#038; Restore functionality was a snap. I forgot the tftp setup at first, but was able to quickly add that, simply copying the contents of /tftpboot from the virtual to the physical machine. </p>
<p>Somewhat to my astonishment, it works great! This old clunker, destined for the <a href="http://www.dell.com/content/topics/global.aspx/corp/pressoffice/en/2008/2008_11_12_rr_000" target="_blank">free Dell recycling at Staples</a>, now has new life. Even without bridging the audio, the jittery voice is gone. I wouldn&#8217;t try this in a large office, but for a home office, it seems fine. In fact, my <a href="http://www.p3international.com/products/special/P4400/P4400-CE.html" target="_blank">Kill A Watt</a> tells me that this old PowerEdge only uses about 75 &#8211; 90 watts of power, not much more than the Optiplex workstation (53 &#8211; 80 watts).</p>
<h1>Conclusions</h1>
<p>I still love the idea of using a virtual machine for a PBX, and with a strong enough host, it&#8217;s probably a viable alternative for production. It&#8217;s definitely a great way to test various configurations and features. And if my physical machine fails, I can boot the virtual machine and have phone service again in about three minutes. But based on the hardware I already have and the Asterisk features I like, it looks like I&#8217;ll be running physical for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/moving-pbx-in-a-flash-from-a-virtual-to-a-physical-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Asterisk to Bridge Audio</title>
		<link>http://www.mcbsys.com/techblog/2008/11/getting-asterisk-to-bridge-audio/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/getting-asterisk-to-bridge-audio/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 19:38:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[canreinvite]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Getting-Asterisk-to-Bridge-Audio.aspx</guid>
		<description><![CDATA[In my original PBX in a Flash setup, Asterisk is set to &#8220;listen in&#8221; on calls. One advantage of this is that it can then respond to commands sent from a phone keypad during the call, e.g. to transfer or record the call. However, it does add processing overhead. If your devices support it, you [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx">original PBX in a Flash setup</a>, Asterisk is set to &#8220;listen in&#8221; on calls. One advantage of this is that it can then respond to commands sent from a phone keypad during the call, e.g. to transfer or record the call. However, it does add processing overhead. If your devices support it, you can tell Asterisk to butt out of your conversations, allowing connections to &#8220;bridge&#8221; directly between endpoints and avoid going through Asterisk. Here&#8217;s how.</p>
<p><span id="more-48"></span></p>
<h1>Set Up General Settings</h1>
<p>Log in to the FreePBX administration page and make the following changes:</p>
<ol>
<li>In the left column under Basic, click on General Settings.</li>
<li>At the top of the page, under Dialing Options, set these values:<br />
- Asterisk Dial command options:&nbsp; r<br />
- Asterisk Outbound Dial command options:&nbsp; <em>leave blank</em></li>
<li>Click on Submit.</li>
</ol>
<p>You have now told Asterisk not to listen for DTMF commands to transfer or record calls. Note that this means you will not be able to do any transfers from an analog phone connected to an FXS port. However, a SIP phone can &#8220;break in&#8221; to a call to do a transfer, put the call on hold, etc.</p>
<h1>Set Up Extensions</h1>
<p>Log in to the FreePBX administration page and make the following changes:</p>
<ol>
<li>In the left column under Basic, click on Extensions.</li>
<li>From the list at the right side of the page, click on each extension that is connected to a device that supports the &#8220;reinvite&#8221; command. (I&#8217;m using a Linksys SPA3102 and a Polycom IP430, both of which support reinvites.) Under Device Options, set this value:<br />
<span style="font-family: Courier New;">canreinvite=nonat</span></li>
<li>Click on Submit after changing each extension.</li>
</ol>
<p>This tells Asterisk that the device can handle a reinvite as long as the device is not behind a NAT.</p>
<h1>Set Up Trunks</h1>
<p>Log in to the FreePBX administration page and make the following changes:</p>
<ol>
<li>In the left column under Basic, click on Trunks.</li>
<li>From the list at the right side of the page, click on each trunk is connected to a device that supports the &#8220;reinvite&#8221; command. (The Linksys SPA3102 also supports reinvites on the trunk or PSTN side.) In the PEER Details box, add this line:<br />
<code>canreinvite=nonat</code></li>
</ol>
<p>This tells Asterisk that the trunk can handle a reinvite as long as the device is not behind a NAT.</p>
<h1>Apply Your Changes</h1>
<p>Once you have updated the General Settings, Extensions, and Trunks, click on the orange bar at the top of the FreePBX administration page, then confirm. That&#8217;s it! Asterisk will now get out of the way whenever possible.</p>
<h1>Testing</h1>
<p>If you know how to use a packet sniffer, you should be able to see the difference in how the RTP (audio) packets are routed:&nbsp; the source and destination will no longer include the Asterisk server.</p>
<p>A simpler method:&nbsp; once the dial plans have been updated as described above, start the Asterisk Command Line Interface (CLI) with a verbosity of 3 (<code>asterisk -r -vvv</code>). Call in from an outside line and answer the internal extension. Right after you answer, you should see a message like this:</p>
<p style="padding-left: 30px;"><code>Native bridging SIP/Personal-12345678 and SIP/20-abcdefgh</code></p>
<p>If instead you see this:</p>
<p style="padding-left: 30px;"><code>Packet2Packet bridging SIP/Personal-12345678 and SIP/20-abcdefgh</code></p>
<p>then Asterisk is still &#8220;in&#8221; the media stream, but the RTP packets are not going through the Asterisk core.</p>
<p><strong>Tip:</strong>&nbsp; to reduce the level of verbosity, while still in the Asterisk CLI, type</p>
<p style="padding-left: 30px;"><code>core set verbose 0</code></p>
<p>That makes it easier to use the <code>sip show</code> commands described below.</p>
<h1>References</h1>
<p>Voip-Info has a long and informative article titled <a href="http://www.voip-info.org/wiki/view/Asterisk+sip+canreinvite" target="_blank">Asterisk sip canreinvite</a>. It even includes instructions on how to use the <code>tcpdump</code> packet sniffer from the Linux command line.</p>
<p>The <a href="http://www.asterisk.org/doxygen/trunk/Config_sip.html" target="_blank">default sip.conf from Digium</a> explains the <code>canreinvite=nonat</code> option, new in Asterisk 1.4:</p>
<blockquote><p>An additional option is to allow media path redirection (reinvite) but only when the peer where the media is being sent is known to not be behind a NAT (as the RTP core can determine it based on the apparent IP address the media arrives from).</p></blockquote>
<p>From Joshua Colp, Software Developer at Digium, comes <a href="http://lists.digium.com/pipermail/asterisk-users/2007-March/181854.html" target="_blank">this explanation</a> of bridging:</p>
<blockquote><p>Packet2Packet Bridging = Audio is not going through the Asterisk core, it comes into the RTP stack and goes directly out. This decreases the amount of memory allocation that happens, and things require less processing.</p>
<p>Native Bridging = Audio was reinvited between the two endpoints so it (should) go direct.</p></blockquote>
<p>as well as <a href="http://lists.digium.com/pipermail/asterisk-users/2007-March/181915.html" target="_blank">this helpful note</a> on checking for how Asterisk is handling audio:</p>
<blockquote><p>During the call, run <code>sip show channel xxxyyzz</code> and check &#8220;Audio IP&#8221;. If the audio IP doesn&#8217;t belong to your Asterisk server, media is handled through the native bridge.</p></blockquote>
<p>To get the channel name for that command, while in a call, type <code>sip show channels</code>. Both commands are executed from the Asterisk CLI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/getting-asterisk-to-bridge-audio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up a Polycom IP 430 Phone with FreePBX</title>
		<link>http://www.mcbsys.com/techblog/2008/11/setting-up-a-polycom-ip-430-phone-with-freepbx/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/setting-up-a-polycom-ip-430-phone-with-freepbx/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 15:19:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[polycom]]></category>
		<category><![CDATA[soundpoint]]></category>
		<category><![CDATA[tftp]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Setting-Up-a-Polycom-IP-430-Phone-with-FreePBX.aspx</guid>
		<description><![CDATA[I want to use a true SIP phone for my office phone. I was initially attracted to the Polycom SoundPoint IP 430 because of its support for electronic hookflash with my Jabra GN9350 wireless headset. By using a special adapter cable, I can answer the phone from the wireless headset without the need for a [...]]]></description>
			<content:encoded><![CDATA[<p>I want to use a true SIP phone for my office phone. I was initially attracted to the <a href="http://www.polycom.com/usa/en/products/voice/desktop_solutions/soundpoint/desk_phones/soundpoint_ip430.html" target="_blank">Polycom SoundPoint IP 430</a> because of its support for electronic hookflash with my <a href="http://www.jabra.com/Sites/Jabra/NA-US/Headsets/Pages/JabraGN9350e.aspx" target="_blank">Jabra GN9350 wireless headset</a>. By using a special <a href="http://www.jabra.com/Sites/Jabra/NA-US/campaigns/polycom/Pages/EHSAdapter.aspx" target="_blank">adapter cable</a>, I can answer the phone from the wireless headset without the need for a <a href="/mark/admin/Pages/v" target="_blank">mechanical handset lifter</a>.</p>
<h1>Things I Wish I&#8217;d Known</h1>
<p><span id="more-49"></span></p>
<p>Here are some things that would have helped me:</p>
<ul>
<li>Every time a Polycom phone powers up, it attempts to contact a &#8220;boot server&#8221; where it looks for BootRom software, the phone software, and then generic and phone-specific configuration files. If it can&#8217;t find a boot server, it uses the configuration information stored from the previous boot.</li>
<li>I bought my phone on eBay and was stuck with having to clear the old configuration without knowing the previous owner&#8217;s password. Pressing and holding 1357 during boot prompted me for a password. Entering the MAC address of the phone as the password worked, and the phone did a factory reset. But as soon as the phone finished booting, it re-loaded its old, custom configuration files from flash memory, locking me out again. I finally got around this by setting up a local boot server and downloading a blank <code>000000000000.cfg</code> configuration file during boot. Since I was initially having trouble getting the phone to see the Trivial FTP (tftp) server on the PBX in a Flash (PiaF) machine, I did this part by setting up an FTP server on my Windows Small Business Server 2003. I got the phone to connect to the server as user &#8220;anonymous&#8221; with the password &#8220;guest&#8221;. This <a href="http://www.trixbox.org/forums/vendor-moderated-forums/polycom/reset-polycom-completely" target="_blank">Trixbox thread</a> has the rest of the information I needed to reset the phone. I went ahead and updated to the latest BootRom (4.1.2.0037) and phone software (3.1.1.0137), downloaded from the <a href="http://www.polycom.com/usa/en/support/voice/soundpoint_ip/soundpoint_ip430.html" target="_blank">Polycom support site</a>.</li>
<li>Because my DHCP server can&#8217;t respond to Type 66 requests, I had to manually set a Fixed address in the phone to look for the tftp server on the PiaF machine. I went ahead and set the gateway and DNS as well. This allowed the phone to successfully connect to tftp on the the PiaF machine.</li>
</ul>
<p>If all you want to do is configure one phone, you might just want to use the phone&#8217;s web interface. <a href="http://pbxinaflash.com/forum/showpost.php?p=6814&amp;postcount=10" target="_blank">This post</a> has helpful instructions.</p>
<p>However, if you have a lot of phones to configure, or even if you just want to have the configurations stored on your server, you&#8217;ll need to set up a boot server (we&#8217;ll use tftp) and create configuration files.</p>
<h1>Setting Up tftp</h1>
<p>Although the Polycom phones default to using FTP, all we need for our basic purposes is Trivial FTP (tftp).</p>
<p>By default, PiaF comes with tftp not installed. to install it, type <code>setup-tftp</code>. This creates the /tftpboot directory and starts the tftp service.</p>
<h2>Allow Writing via tftp</h2>
<p>By default, tftp is set up to disallow file creation and overwrites. This is a good thing, since you usually don&#8217;t want your server to allow anonymous users to create and change files. However, the Polycom phone will, if permitted, upload some log files and create backups of locally-configured settings on the tftp server. We also would like more detailed tftp logging in /var/log/messages than is provided by default. (<a href="http://www.pbxinaflash.com/forum/showthread.php?t=2411" target="_blank">This post</a> explains how to do that.) To allow writing and enhance logging, I made the following changes.</p>
<ol>
<li>Change permissions to allow any user to write to the tftpboot folder:<br />
<code>chmod 777 /tftpboot</code></li>
<li>Edit the file <code>/etc/xinetd.d/tftp</code>, changing the server-args line to read as follows (-c to allow creating files, -vv to increase logging):<br />
<code>server_args = -c -s /tftpboot -vv</code></li>
<li>Restart tftp:<br />
<code>/etc/init.d/xinetd restart</code></li>
<li>Optionally monitor the log in real time:<br />
<code>tail -0f /var/log/messages</code><br />
(Press Ctrl-C to exit the real-time monitoring.)</li>
</ol>
<p>When you&#8217;ve finished the Polycom setup, and especially if your PiaF machine is exposed to the Internet, you may want to disable writing and verbose logging as follows:</p>
<ol>
<li>Change tftpboot permissions back to disallow writing my users other than the owner (root):<br />
<code>chmod 755 /tftpboot</code></li>
<li>Edit the file <code>/etc/xinetd.d/tftp</code>, changing the server-args line back to the default:<br />
<code>server_args = -s /tftpboot</code></li>
<li>Restart tftp:<br />
<code>/etc/init.d/xinetd restart</code></li>
</ol>
<h1>Setting Up the Phone</h1>
<p>Once I had a &#8220;clean&#8221; phone (reset to factory defaults), I followed these steps to get the phone set up and &#8220;linked&#8221; to the tftp boot server on my PiaF machine:</p>
<ol>
<li>The phone gets its IP address using DHCP. I used the phone&#8217;s MAC address (printed on the back of the phone) to assign it an IP address in my router.</li>
<li>Copy the default configuration files (that come with the firmware) to the /tftpboot directory on the PiaF machine. You don&#8217;t need all the files, just the ones relevant to your phone. My /tftpboot directory has these files:<br />
<code>SoundPointIPLocalization </code>(directory; contains only the English_United_States subdirectory)<code><br />
000000000000.cfg<br />
000000000000-directory~.xml<br />
2345-11402-001.sip.ld </code>(the phone software for the IP 430)<code><br />
phone1.cfg<br />
sip.cfg<br />
sip.ld<br />
sip.ver</code></li>
<li>Power up the phone. While the phone is booting, press Setup. Enter 456 as the password. Then make these changes:<br />
- In the DHCP menu, change Boot Server to Static.<br />
- In the Server menu, set Server Type to TrivialFTP and Server Address to the IP address of your PiaF machine. You can set Server User and Server Password to empty but leaving them as their defaults works too.<br />
Exit from the setup, choosing Save &amp; Reboot. The phone will get its IP address from your router (DHCP server) and then download configuration information from the tftpboot directory on the PiaF machine. You may want to watch the /var/log/messages file as described in the previous section.</li>
</ol>
<p>Once you know the phone is talking to the tftp server, set up the custom configuration files. Note that we use these custom files only to define <em>exceptions</em>. That means that they must appear first in the CONFIG_FILES list (in <code>000000000000.cfg</code>), followed by the generic files that were included with the firmware package. The idea is that when you update the firmware, you replace the <code>sip.cfg</code> and <code>phone1.cfg</code> files with the files from the new firmware package, but you use the same custom exception files. For more information, see this 5-page <a href="http://www.polycom.com/common/documents/support/technical/products/voice/white_paper_configuration_file_management_on_soundpoint_ip_phones.pdf" target="_blank">Polycom white paper</a>.</p>
<ol>
<li>Change <code>000000000000.cfg</code> so that the first non-commented line reads as follows :<br />
<code>&lt;APPLICATION APP_FILE_PATH="sip.ld"  CONFIG_FILES="phone1_[PHONE_MAC_ADDRESS].cfg, phone1.cfg,  sip_custom.cfg, sip.cfg" MISC_FILES="" MISC_FILES=""  LOG_FILE_DIRECTORY="" OVERRIDES_DIRECTORY="" CONTACTS_DIRECTORY=""  LICENSE_DIRECTORY=""&gt;</code><br />
Note that we are using the new <a href="http://knowledgebase.polycom.com/kb/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=12009&amp;sliceId=SAL_PUBLIC_1_2&amp;dialogID=8440380&amp;stateId=1%200%208436874" target="_blank">Variable Substitution</a> supported as of BootRom 4.0. <code>[PHONE_MAC_ADDRESS]</code> will be replaced when the phone looks for its custom file.</li>
<li>Create a <code>sip_custom.cfg</code> file. This specifies how to get SNTP (time) values. The <a href="http://www.mcbsys.com/techblog/wp-content/uploads/2008/11/sip_custom.cfg" target="_blank">attached example</a> uses a local Windows Small Business Server 2003 as a time server, and sets the offset to GMT-8 (that is, -28800 minutes).</li>
<li>Create a <code>phone1_</code><code>&lt;mac_address&gt;</code><code>.cfg</code> file, substituting the phone&#8217;s MAC address in the file name. This file contains the setup for the phone&#8217;s extensions, i.e. these are the settings that let the phone find your PiaF machine and register with Asterisk.&nbsp; The <a href="http://www.mcbsys.com/techblog/wp-content/uploads/2008/11/phone1_mac_address.cfg" target="_blank">attached example</a> configures two extension and *97 for message retrieval.</li>
</ol>
<p>Now, when you reboot the phone, it should come up with the correct time and its extensions registered. If the user makes changes to the configuration (ring tones, headset settings, etc.), and if the tftp server allows writing, the phone will upload a file named <code>&lt;mac_address&gt;</code><code>-phone.cfg</code> to the /tftpboot directory. This file contains user-specified configuration overrides. If the user creates speed-dial contacts, those are uploaded as <code>&lt;mac_address&gt;</code><code>-directory.cfg</code> to the /tftpboot directory. Using these files, even if a phone is completely wiped (including its flash memory), it should be able to reboot to its fully-configured state as long as it can access the boot server.</p>
<p><a rel="enclosure" href="http://www.mcbsys.com/techblog/wp-content/uploads/2008/11/sip_custom.cfg">sip_custom.cfg (459.00 bytes)</a></p>
<p><a rel="enclosure" href="http://www.mcbsys.com/techblog/wp-content/uploads/2008/11/phone1_mac_address.cfg">phone1_mac_address.cfg (1.96 kb)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/setting-up-a-polycom-ip-430-phone-with-freepbx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up PBX in a Flash, Part 4: Configuring a Linksys SPA3102</title>
		<link>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-4-configuring-a-linksys-spa3102/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-4-configuring-a-linksys-spa3102/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 18:19:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[spa3102]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-4-Configuring-a-Linksys-SPA-3102-ATA.aspx</guid>
		<description><![CDATA[I&#8217;ve just posted a series of articles on selecting a VoIP PBX and setting it up under Microsoft Virtual Server. To read the series from the beginning, see Getting Into VoIP.
Setting up an Analog Terminal Adapter (ATA) for a VoIP system is normally something you do while configuring the PBX. However, since it is configured [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just posted a series of articles on selecting a VoIP PBX and setting it up under Microsoft Virtual Server. To read the series from the beginning, see <a href="http://blogs.mcbsys.com/mark/post/Getting-Into-VoIP.aspx">Getting Into VoIP</a>.</p>
<p>Setting up an Analog Terminal Adapter (ATA) for a VoIP system is normally something you do while <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx">configuring the PBX</a>. However, since it is configured as a separate device using its own web interface, it seemed to warrant its own blog entry.</p>
<p><span id="more-50"></span></p>
<h1>Getting Connected</h1>
<p>Unless you plan to exclusively use SIP phones and VoIP providers for your VoIP installation, you need to find a way to connect to analog telephone lines. You need hardware that has &#8220;FXO&#8221; ports to connect to the phone company&#8217;s lines (called PSTN lines). You may also need hardware that has &#8220;FXS&#8221; ports to connect to your existing analog phones. (It&#8217;s amazing what an analog phone can do when connected to an Asterisk VoIP system&#8211;there are feature codes like *97 for almost any imaginable function.)</p>
<p>My initial Trixbox installation a couple years ago runs on a physical machine and uses a <a href="http://www.digium.com" target="_blank">Digium</a> PCI card to provide 2 FXO and 2 FXS ports. That&#8217;s been working pretty well, though it would probably benefit from some updated drivers .</p>
<p>This time, encouraged by <a href="http://www.3cx.com" target="_blank">3CX</a>&#8217;s decision to rely exclusively on network-attached devices, I decided to buy some ATAs. In fact, this is the only option when running in a virtual environment&#8211;there is no way that I know of to plug PCI cards directly into a virtual machine.</p>
<p>At first I tested the <a href="http://www.grandstream.com/" target="_blank">Grandstream</a> <a href="http://www.grandstream.com/ht503.html" target="_blank">HandyTone HT503</a>. This device provides one FXO and one FXS port and is very reasonably priced&#8211;under $50 each. Unfortunately, I was unable to get past some Caller ID issues with these devices (Caller ID is a new capability in this relatively new model), so I ultimately returned the units.</p>
<p>I then chose to use the <a href="http://www.linksys.com" target="_blank">Linksys by Cisco</a> <a href="http://www.linksys.com/servlet/Satellite?c=L_Product_C2&amp;childpagename=US%2FLayout&amp;cid=1146582257191&amp;pagename=Linksys%2FCommon%2FVisitorWrapper" target="_blank">SPA3102</a> instead. This product also supplies one FXO and one FXS port. It&#8217;s been on the market for some time so it is hopefully fairly mature. You can buy them new for about $75; sometimes they are available for less on eBay.</p>
<h1>Configuring the SPA-3102</h1>
<p>Aside from some basic WAN and LAN setup which applies to the entire device, the SPA3102 is really treated as two devices when setting it up for use with a PBX. The &#8220;Line 1&#8243; settings are used to configure the FXS side, which is used to connect an analog telephone. The &#8220;PSTN Line&#8221; setting are used to configure the FXO side, which are used to connect to the phone company line. Either side may be disabled if you only need part of the functionality.</p>
<p>Since both sides of the SPA3102 share the same IP address, each side must have its own port. By default, the Line 1 setup uses port 5060, while the PSTN Line uses port 5061.</p>
<p>One thing that I discovered in my testing is that often I could use the same or a very similar setup for different PBXs that I tested. The primary entries below refer to the PBX in a Flash (PiaF) settings, but there are also notes in [brackets] pointing out some differences for 3CX and sipXecs. One difference is that under 3CX and PiaF, both internal phones (FXS devices) and external PSTN lines (FXO) register with the PBX. Under sipXecs, only endpoints, that is, only FXS devices register with the PBX.</p>
<p>Here are the SPA3102 settings that I changed from the default to get them to work with the various PBXs. Of course your settings may differ depending on your environment. I&#8217;m indebted to the <a href="http://www.3cx.com/voip-gateways/linksys-3102.html" target="_blank">3CX SPA3102 configuration guide</a> for pointing out most of the necessary changes:</p>
<h1>Router tab</h1>
<h2>Wan Setup tab</h2>
<h3>Internet Connection Settings</h3>
<p>- Connection Type:&nbsp; DHCP&nbsp; (use router to assign an IP address based on the device&#8217;s MAC address)</p>
<h3>Optional Settings</h3>
<p>- Primary NTP Server:&nbsp; 192.168.1.2 (the Windows server on my network that provides NTP server service)&nbsp;<br />
- Remote Management</p>
<h3>Remote Management</h3>
<p>- Enable WAN Web Server:&nbsp; Yes</p>
<h2>Lan Setup tab</h2>
<p>Networking Service:&nbsp; Bridge (use external router)</p>
<h1>Voice tab</h1>
<h2><span style="color: #000080;">SIP tab</span></h2>
<h3><span style="color: #000080;">RTP Parameters</span></h3>
<p><span style="color: #000080;">- RTP Packet Size:&nbsp; 0.020 &#8211; added 1/21/09 &#8211; see comments </span></p>
<h2>Regional tab</h2>
<h3>Ring and Call Waiting Tone Spec</h3>
<p>- Ring Waveform:&nbsp; Sinusoid (default is Trapezoid)<br />
- Ring Frequency:&nbsp; 25 (default is 20) <span style="color: #000080;">- 1/21/09:&nbsp; now back to 20 &#8211; see comments<br />
</span>- Ring Voltage:&nbsp; 80 (default is 85) <span style="color: #000080;">- 1/21/09:&nbsp; now back to 85 &#8211; see comments</span></p>
<h3>Miscellaneous</h3>
<p>- Daylight Saving Time Rule:&nbsp; start=3/8/7/02:0:0;end=11/1/7/02:0:0;save=1<br />
&nbsp; (should handle the new Daylight Saving rules; default was start=4/1/7;end=10/-1/7;save=1)</p>
<h2>Line 1 tab</h2>
<h3><span style="color: #000080;">Network Settings</span></h3>
<p><span style="color: #000080;">- Network Jitter Level:&nbsp; Very High (was High) &#8211; added 7/6/09 for fax&nbsp; &#8211; see <a href="http://www.3cx.com/sip-phones/linksys-spa-3102-fax.html" target="_blank">3CX article</a></span><span style="color: #000080;"><br />
- Jitter Buffer Adjustment:&nbsp; Disabled (was Up and Down) &#8211; added 7/6/09 for fax&nbsp; &#8211; see <a href="http://www.3cx.com/sip-phones/linksys-spa-3102-fax.html" target="_blank">3CX article</a></span></p>
<h3>Proxy and Registration</h3>
<p>- Proxy:&nbsp; 192.168.1.100 (the IP address that the router assigns to mypbx.mydomain.local)</p>
<h3>Subscriber Information</h3>
<p>- Display Name:&nbsp; Personal [SipX:&nbsp; 200 if using 3-digit extensions]<br />
- User ID:&nbsp; 20 [SipX:&nbsp; 200 if using 3-digit extensions]<br />
- Password:&nbsp; (phone extension password)<br />
- Use Auth ID:&nbsp; no</p>
<h3><span style="color: #000080;">Audio Configuration</span></h3>
<p><span style="color: #000080;">- Echo Canc Enable:&nbsp; No (was Yes) &#8211; added 7/6/09 for fax&nbsp; &#8211; see <a href="http://www.3cx.com/sip-phones/linksys-spa-3102-fax.html" target="_blank">3CX article</a></span><span style="color: #000080;"><br />
- Fax Passthru Method:&nbsp; ReINVITE (was NSE)- added 7/6/09 for fax &#8211; see <a href="http://www.3cx.com/sip-phones/linksys-spa-3102-fax.html" target="_blank">3CX article</a></span></p>
<h2>PSTN Line tab</h2>
<h3>SIP Settings</h3>
<p>- SIP Port:&nbsp; 5061 [3CX:&nbsp; change the PSTN line in the 3CX web UI to use 5061, not 5060]</p>
<h3>Proxy and Registration</h3>
<p>- Proxy:&nbsp; 192.168.1.100 (the IP address that the router assigns to mypbx.mydomain.local) [SipX:&nbsp; leave blank]<br />
- Register:&nbsp; Yes [SipX:&nbsp; No]<br />
- Make Call Without Reg:&nbsp; No [SipX:&nbsp; Yes]<br />
- Ans Call Without Reg:&nbsp; No [SipX:&nbsp; Yes?]</p>
<h3>Subscriber Information</h3>
<p>- Display Name:&nbsp; Personal [SipX:&nbsp; leave blank]<br />
- User ID:&nbsp; Personal [SipX:&nbsp; leave blank]<br />
- Password:&nbsp; (trunk password) [SipX:&nbsp; leave blank]</p>
<h3>Dial Plans</h3>
<p>- Dial Plan 8:&nbsp; S0&lt;:Personal&gt; (dial trunk &#8220;Personal&#8221;)<br />
&nbsp; [SipX:&nbsp; Dial Plan 8:&nbsp; S0&lt;:200@192.168.1.100&gt; (set to ring thru to ext. 200)]</p>
<h3>PSTN-To-VoIP Gateway Setup</h3>
<p>- PSTN Ring Thru Line 1:&nbsp; No<br />
- PSTN CID For VoIP CID:&nbsp; Yes<br />
- PSTN Caller Default DP:&nbsp; 8 (points to Dial Plan 8 above)</p>
<h3>FXO Timer Values (Sec)</h3>
<p>- PSTN Answer Delay:&nbsp; 5 (allow time for Caller ID and/or fax detection)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-4-configuring-a-linksys-spa3102/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting Up PBX in a Flash, Part 3: Configuring FreePBX</title>
		<link>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-3-configuring-freepbx/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-3-configuring-freepbx/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 17:49:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx</guid>
		<description><![CDATA[If you&#8217;ve been&#160;following along through the introduction, part 1, and part 2, you now have a PBX in a Flash (PiaF) setup running under Microsoft Virtual Server. It&#8217;s keeping time, it knows who it is and can send out mail. Now it is finally time to configure the PBX itself!
Setting up the PBX involves a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been&nbsp;following along through the <a href="http://blogs.mcbsys.com/mark/post/Getting-Into-VoIP.aspx">introduction</a>, <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx">part 1</a>, and <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx">part 2</a>, you now have a PBX in a Flash (PiaF) setup running under Microsoft Virtual Server. It&#8217;s keeping time, it knows who it is and can send out mail. Now it is finally time to configure the PBX itself!</p>
<p>Setting up the PBX involves a few steps:</p>
<p><a href="#Updating_and_Adding_FreePBX_modules">Updating and Adding FreePBX modules</a><br />
<a href="#Configuring_Trunks_Extensions_and_Routes">Configuring Trunks, Extensions, and Routes</a><br />
<a href="#Configuring_Other_Features">Configuring Other Features</a></p>
<p><span id="more-51"></span></p>
<p>As in <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx" target="_blank">part 2</a>, I&#8217;ll be following Ward Mundy&#8217;s &#8220;knol,&#8221; the <a href="http://knol.google.com/k/ward-mundy/pbx-in-a-flash/3uqc77rg9tgar/2#" target="_blank">Nerd Vittles Step-by-Step 1.3 Tutorial</a>, starting at the section <a href="http://knol.google.com/k/ward-mundy/pbx-in-a-flash/3uqc77rg9tgar/2#H8-Updating-and-Configuring-FreePBX" target="_blank">Updating and Configuring FreePBX</a>. This time, however, my instructions will relate much more specifically to the installation that I&#8217;m implementing, so I&#8217;ll be skipping some of Ward&#8217;s recommendations and pulling together a few of my own. Let&#8217;s get started!</p>
<h1><a title="Updating_and_Adding_FreePBX_modules" name="Updating_and_Adding_FreePBX_modules"></a>Updating and Adding FreePBX modules</h1>
<p>FreePBX comes pre-loaded with several basic modules. It also provides an online repository of about two dozen additional modules that can make it one very powerful phone system indeed. Follow these steps to update the current modules and get all the new ones.</p>
<ol>
<li>In a browser, open the IP address or DNS name of your PBX.</li>
<li>From the PBX in a Flash menu, in the lower left corner, click on Admin. This adds a few buttons to the screen.</li>
<li>Click on the FreePBX Administration button. Type <code>maint</code> as the user name. Use the password that you assigned using <code>passwd-master</code> near the end of <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx" target="_blank">part 2</a>. This loads the main FreePBX administration screen, which will be our starting point for the rest of the tasks this article. You might want to bookmark this page so you can return here directly without going through the PiaF button top-level screen.</li>
<li>The left column has two tabs, Setup and Tools. From the Setup tab, click on Module Admin. This shows the (relatively short) list of currently-installed modules.</li>
<li>At the top of the Module Administration page, click on the link Check for Updates Online. Now you will see <em>all</em> modules that are available.</li>
<li>Click on the Download All link. Then click on the Upgrade All link. This simply selects everything for downloading and upgrading; it doesn&#8217;t start the download and upgrade process. If you want, you can deselect specific modules that you know you won&#8217;t be using.</li>
<li>According to Ward (and he should know), a couple modules need to be installed last.<br />
- Under CID &amp; Number Management, change Speed Dial Functions to No Action.<br />
- Under System Administration, change PHPAGI Config to No Action.</li>
<li>Scroll to the bottom of the page. Click on Process. Scroll to the bottom of <em>that</em> page. Click on Confirm. An orange popup window appears where you can monitor the progress of the installations. After a few minutes, when you scroll to the bottom of the orange popup, you&#8217;ll see a Return link. Click on Return.</li>
<li>Now we can download and install the two modules that we skipped above. Click on Check for Updates Online, Download All, Process, and Confirm. (In addition to Speed Dial Functions and PHPAGI Config, I see that it still needs to install two options under Inbound Call Control:&nbsp; Blacklist and Caller ID Lookup. Maybe those modules depend on the two that we skipped before. I&#8217;ll leave them all selected this time.) When the orange popup finishes the installs, click on Return.</li>
<li>Scroll down the list of modules to the Maintenance section. Click on ConfigEdit, Sys Info, and phpMyAdmin. Under each one choose Install. (Don&#8217;t install A2Billing Admin unless you need it.) Scroll to the bottom of the window, click on Process, and Confirm. The orange popup gives you the option to Return almost immediately.</li>
<li>At the top of the Module Administration section, you should see a thin orange bar that says &#8220;Apply Configuration Changes.&#8221; Click on that link and an orange popup appears. Click on Continue with Reload to finish reloading the Asterisk configuration files.<br />
<strong>Note:</strong>&nbsp; This two-step apply/continue process is necessary after any change to the Asterisk configuration. Whenever you see that orange bar, make sure no one is on the phone and then click on it to apply the changes! From now on, I&#8217;ll simply say &#8220;Apply and Continue&#8221; to indicate this procedure.</li>
<li>Ward recommends updating the system modules now. Oops! We did that in step 6 already when we selected Upgrade All. Seems to work fine that way too!</li>
<li>Any time you want to disable or uninstall modules (maybe you don&#8217;t need call queuing for your home office), come back to the Module Administration page, click on the module, and choose Disable or Uninstall. Then go through the by-now-familiar Process, Confirm, Return, Apply, Continue steps.</li>
</ol>
<h1><a title="Configuring_Trunks_Extensions_and_Routes" name="Configuring_Trunks_Extensions_and_Routes"></a>Configuring Trunks, Extensions, and Routes</h1>
<p>I hope Ward doesn&#8217;t mind me quoting an <a href="http://knol.google.com/k/ward-mundy/pbx-in-a-flash/3uqc77rg9tgar/2#H10-Setting-Up-FreePBX-to-Make-Your-First-Call" target="_blank">entire paragraph</a> verbatim, but there is no better way to put this:&nbsp; &#8220;There are four components in FreePBX that need to be configured before you can place a call or receive one from outside your PBX in a Flash system. So here&#8217;s FreePBX for Dummies in less than 50 words. You need to configure <em>Trunks, Extensions, Outbound Routes,</em> and <em>Inbound Routes</em>. <em>Trunks</em> are hosting provider specifications that get calls delivered to and transported from your PBX to the rest of the world. <em>Extensions</em> are internal numbers on your PBX that connect your PBX to telephone hardware or softphones. <em>Inbound Routes</em> specify what should be done with calls coming in on a Trunk. <em>Outbound Routes</em> specify what should be done with calls going out to a Trunk. Everything else is bells and whistles.&#8221;</p>
<p>Let&#8217;s take those one at a time. Note that I&#8217;ll only show setting up one analog trunk and one analog extension to connect to my Linksys SPA3102 ATA. You&#8217;ll want to set up the ATA at the same time as the PBX. However, to keep this post focused on the PBX, I&#8217;ve split out the ATA instructions into a separate post titled <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-4-Configuring-a-Linksys-SPA-3102-ATA.aspx">Setting Up PBX in a Flash, Part 4: Configuring a Linksys SPA3102</a>. My setup will use one SPA3102 for the incoming business line and the analog business phone, and another SPA3102 for the personal line and phone. These steps use the personal line and phone as an example. All configurations are for a system operating in San Diego, California.</p>
<h2>Set Up a Trunk</h2>
<p>Follow these steps to set up a trunk to connect to the FXO (PSTN) port of the SPA3102:</p>
<ol>
<li>From the FreePBX main menu, click on the Setup tab. Under Basic, click on Trunks. From the Add a Trunk page, click on Add SIP Trunk.</li>
<li>Under Outgoing Dial Rules &gt; Dial Rules, add the following lines. Change &#8220;619&#8243; to your area code. By the time it reaches the trunk, numbers will be formatted as 7 or 10 digits (more on that under Set Up Outbound Routes below). These lines instruct the trunk to strip off &#8220;619&#8243; or &#8220;1619&#8243; if dialed with the number, and to prepend &#8220;1&#8243; to any other ten-digit number.<br />
<code>619|NXXXXXX<br />
1619|NXXXXXX<br />
1+NXXNXXXXXX</code></li>
<li>Under Outgoing Settings &gt; Trunk Name, enter &#8220;Personal&#8221; (for example).</li>
<li>Under Outgoing Settings &gt; PEER Details, remove the default text and enter these lines, replacing the &#8220;secret&#8221; value with a secure password:<br />
<code>context=from-trunk<br />
host=dynamic<br />
username=Personal<br />
secret=</code><code>&lt;same password as configured as password spa3102 PSTN Line  tab&gt; </code><br />
<code> type=friend<br />
dtmfmode=RFC2833</code></li>
<li>Under Incoming Settings &gt; USER Details, remove the default text. Leave this box empty.</li>
<li>Scroll to the bottom of the screen and click on Submit Changes. At the top of the window, click on Apply Configuration Changes, then in the orange popup window, click on Continue with Reload.</li>
<li>Now that you have configured a trunk, you can delete the default Zaptel trunk, since we aren&#8217;t using Zaptel. In the upper right corner, click on Trunk ZAP/g0. Then at the top of the screen click on Delete Trunk g0. Apply and Continue.</li>
</ol>
<p>Congratulations, your trunk is set up! You may want to <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-4--Configuring-a-Linksys-SPA-3102-ATA.aspx" target="_blank">set up the PSTN Line tab in the SPA3102</a> before continuing.</p>
<h2>Set Up an Extension</h2>
<p>Follow these steps to set up an extension so you can connect an analog phone to the FXS (Line 1) port of the SPA3102:</p>
<ol>
<li>From the FreePBX main menu, click on the Setup tab. Under Basic, click on Extensions. From the Add an Extension page, from the Device drop-down, select Generic SIP Device, then click on Submit.</li>
<li>Under Add Extension &gt; User Extension, enter &#8220;20&#8243; (for example&#8211;I&#8217;ll use 2-digit extensions for my home office setup).</li>
<li>Under Add Extension &gt; Display Name, enter &#8220;Personal&#8221;.</li>
<li>Under Device Options &gt; Secret, enter a password for the extension. This is <em>not</em> the voicemail password! It is the password that you configure in the SPA3102 Line 1 tab so that the SPA3102 can register with Asterisk. Make it a secure one so anyone who gains access to your network will not be able to also use your PBX.</li>
<li>Under Voicemail and Directory:<br />
- Set Status to Enabled.<br />
- Set Voicemail Password to a numeric password.<br />
- Set Email Address to the address where you want to receive voicemail by email.<br />
- Set Email Attachment to Yes.<br />
- Optionally set Play Envelope to Yes.<br />
- Under VM Options, enter &#8220;callback=from-internal&#8221;. This will allow you to call back the caller by choosing Advanced Options when listening to a message. See the NerdVittles article <a href="http://nerdvittles.com/index.php?p=147" target="_blank">Tricking Out Your Trixbox</a> for more information.<br />
<strong>Note:</strong>&nbsp; Hover the mouse over any of the options with a dotted underline for an explanation of what the option does.</li>
<li>Scroll to the bottom of the screen and click on Submit Changes. Apply and Continue.</li>
</ol>
<p>Your first extension is now configured! Again, you should <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-4--Configuring-a-Linksys-SPA-3102-ATA.aspx" target="_blank">make the corresponding setup in the SPA3102 Line 1 tab</a> before continuing.</p>
<h2>Check for SPA3102 Registration</h2>
<p>At this point, your SPA3102 should be successfully registering with FreePBX/Asterisk. To check this, from the FreePBX administration screen, click on the Setup tab, then click on FreePBX System Status. Under FreePBX Statistics, you should see one IP Phone and one IP Trunk online. Sometimes these values are not completely accurate (e.g. if the SPA3102 was registered, then powered down).</p>
<p>To double-check, go to the SPA3102&#8217;s web interface. Under the Voice &gt; Info tab, look for the Registration State values in the Line 1 Status and PSTN Status sections. Both should say &#8220;Registered&#8221;.</p>
<p>If the SPA3102 isn&#8217;t registering, try forcing a reboot of the SPA3102 by unplugging it and plugging it back in, then check the above values again. If registration is still failing, review the steps above.</p>
<h2>Set Up Outbound Routes</h2>
<p>Even though your SPA3102 is registering, you won&#8217;t be able to call out until you tell FreePBX how you want your calls routed. For that you need at least one Outbound Route.</p>
<p>If you read the <a href="http://blogs.mcbsys.com/mark/post/Getting-Into-VoIP.aspx" target="_blank">introduction</a> to this series, you know that one of the things I wanted to do was set up least-cost routing. Asterisk has very flexible rules that allow me to do that. At this point, we are only setting up one outbound line, so the routing is rather dull&#8211;everything must go out on the same line (trunk). To spice things up, we&#8217;ll add in a few extra routes so that when we add additional trunks in the future, we can ensure that some calls always go out on the Personal trunk.</p>
<ol>
<li>From the FreePBX main menu, click on the Setup tab. Under Basic, click on Outbound Routes.</li>
<li>First let&#8217;s delete the default route. In the upper right corner of the Add Route page, click on 0 9_outside. Click on Delete route 9_outside, then Apply and Continue.</li>
<li>Let&#8217;s assume we want all calls to x11 (211, 611, 911) to route to the Personal trunk. (This is actually desirable because this trunk goes to my an analog home phone line. This is the number the pops up my address for the 911 operators.) Set up the first outbound route as follows:<br />
- Route Name: 211-Thru-911<br />
- Dial Patterns:&nbsp; <code>N11</code><br />
- Trunk Sequence:&nbsp; SIP/Personal<br />
Click on Submit Changes. We&#8217;ll Apply and Continue later.</li>
<li>Next, let&#8217;s set up a route that allows selecting this specific trunk by dialing &#8220;98&#8243; before making the call. This isn&#8217;t really necessary with only one trunk, but after adding more trunks, it is sometimes desirable to be able to override the least-cost defaults and dial out on a specific trunk. Click on Add Route and set up this route as follows:<br />
- Route Name: 98-UsePersonal<br />
- Dial Patterns (only pass along 7- or 10-digit number to trunk):&nbsp;<br />
<code>&nbsp; 981|NXXNXXXXXX<br />
&nbsp; 98|NXXNXXXXXX<br />
&nbsp; 98|NXXXXXX</code><br />
- Trunk Sequence:&nbsp; SIP/Personal<br />
Click on Submit Changes.</li>
<li>The next route is for local and toll-free numbers. Even if we had a separate ATA to handle long-distance, we want these local numbers to dial out on the Personal line, which includes unlimited free local calls. &#8220;Local&#8221; in my area means numbers within a certain radius, and can include prefixes in both the 619 and 858 area codes. Click on Add Route and set up this route as follows:<br />
- Route Name: LocalOrTollFree<br />
- Dial Patterns Wizards:&nbsp; select TollFree and you&#8217;ll see this fill in the Dial Patterns. Put a pipe (|) after each &#8220;1&#8243; so the &#8220;1&#8243; (if dialed) will be stripped off before the number is passed to the trunk:<br />
<code>&nbsp; 1|800NXXXXXX<br />
&nbsp; 1|888NXXXXXX<br />
&nbsp; 1|877NXXXXXX<br />
&nbsp; 1|866NXXXXXX</code><br />
- Dial Patterns Wizards:&nbsp; select TollFree again. This time, remove the leading &#8220;1&#8243;s so that you can dial the number without dialing the 1:&nbsp;<br />
<code>&nbsp; 800NXXXXXX&nbsp;<br />
&nbsp; 888NXXXXXX&nbsp;<br />
&nbsp; 877NXXXXXX&nbsp;<br />
&nbsp; 866NXXXXXX</code></li>
<li>- Dial Patterns Wizards:&nbsp; select Lookup Local Prefixes. In the popup box, enter your area code + prefix and click on OK. Then sit back and watch the magic! That&#8217;s right, FreePBX just filled in every area code and prefix that is a free call for you. Feel free to double-check these against the phone book <img src='http://www.mcbsys.com/techblog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Actually, you may find that there are prefixes that you dial regularly that need to be added to this list.<br />
- Trunk Sequence:&nbsp; SIP/Personal<br />
Click on Submit Changes.</li>
<li>Our last outbound route will be for all long distance calls. Click on Add Route and set up this route as follows:<br />
- Route Name: LongDistance<br />
- Dial Patterns (capture international and all remaining 10-digit numbers):&nbsp;<br />
<code>&nbsp; 011.&nbsp;<br />
&nbsp; 1|NXXNXXXXXX&nbsp;<br />
&nbsp; </code>- Trunk Sequence:&nbsp; SIP/Personal.<br />
Click on Submit Changes. Note that if you add a cheaper long-distance trunk later on, you can adjust the Trunk Sequence to make this route use the cheaper trunk first.</li>
<li>You should now see four routes listed in the upper right corner of the Edit Route page. Use the up and down arrows to adjust their precedence if necessary. When you&#8217;re satisfied, click on Apply, then Continue.</li>
</ol>
<p>The downside to having this huge list of local prefixes defined in step 5 is that it now takes considerably longer to Apply Configuration Changes. If you prefer, you could change this rule to remove all those local prefixes and only include the toll-free numbers, all 7-digit numbers (<code>NXXXXXX</code>), and all 858 numbers (<code>1|858NXXXXXX</code>).</p>
<h2>Set Up an Inbound Route</h2>
<p>Our last step in this section is to set up an inbound route:</p>
<ol>
<li>From the FreePBX main menu, click on the Setup tab. Under Inbound Call Control, click on Inbound Routes, then Add Incoming Route.</li>
<li>Under Add Incoming Route, set these values:<br />
- Description:&nbsp; Personal<br />
- DID Number:&nbsp; Personal (corresponds to the User ID configured in the SPA3102 PSTN line)</li>
<li>Under Options, set this value:<br />
- CID Name Prefix:&nbsp; P- (this adds a &#8220;P-&#8221; prefix to Caller IDs that come from the Personal trunk)</li>
<li>Under Fax Handling, if you are setting up faxing as described in this <a href="http://nerdvittles.com/index.php?p=237" target="_blank">Nerd Vittles article</a>, set these values:<br />
- Fax Extension:&nbsp; FreePBX default (use value from General Settings&#8211;see below)<br />
- Fax Email:&nbsp; [leave blank] (use value from General settings&#8211;see below)<br />
- Fax Detection Type:&nbsp; NVFax<br />
- Pause After Answer:&nbsp; [leave blank]<br />
<strong>Note:</strong>&nbsp; These values differ from those used in the Nerd Vittles article. In particular, leaving Pause After Answer blank, indicating that no pause is needed, seems to work fine. If you follow call progress in the Asterisk Command Line Interface (<code>asterisk -r -vv</code> at a CentOS prompt), you&#8217;ll see that NVFaxDetect adds its own 4-second delay. An additional delay here is apparently not needed.</li>
<li>Under Set Destination, select this value so this route will immediately ring extension 20:<br />
- Extensions: &lt;20&gt; Personal</li>
<li>Scroll to the bottom of the screen and click on Submit Changes. You&#8217;ll see a popup message warning you that you have entered a non-standard DID pattern. Click on OK. Then Apply and Continue.</li>
</ol>
<p>That&#8217;s it! One you connect your telco and analog phone lines to the SPA3102, you should now be able to make and receive calls. Try dialing 611 to test the first route. (If you want to test 911, call the <em>non</em>-emergency police or dispatch number first to ask permission.)</p>
<p>Don&#8217;t be surprised that FreePBX takes a few seconds to start ringing the internal extension. That&#8217;s due to the 5-second PSTN Answer Delay that we set in the SPA3102. That allows the SPA3102 to detect the incoming Caller ID, which is delivered between the first and second rings. If you don&#8217;t care about Caller ID, you can set PSTN Answer Delay to zero.</p>
<h1><a title="Configuring_Other_Features" name="Configuring_Other_Features"></a>Configuring Other Features</h1>
<p>As you can imagine, there are tons of additional things that you can set up in FreePBX!</p>
<h2>General Settings</h2>
<p>It&#8217;s worth making the following changes to General Settings now:</p>
<ol>
<li>From the FreePBX main menu, click on the Setup tab. Under Basic, click on General Settings.</li>
<li>To enable call transfers and call recording under Dialing Options, set these values:<br />
- Asterisk Dial Command Options:&nbsp; tTrwW (default is &#8220;tr&#8221; if you want to revert later)<br />
- Asterisk Outbound Dial Command Options:&nbsp; TwW (default is blank if you want to revert later)</li>
<li>Under Voicemail, I&#8217;ve found that I prefer these settings:<br />
- Optional Voicemail Recording Gain:&nbsp; 10<br />
- Do Not Play &#8220;please leave message after tone&#8221; to caller:&nbsp; checked</li>
<li>Under Fax Machine, make these settings:<br />
- Extension of fax machine for receiving faxes:&nbsp; system (sends to email address)<br />
- Email address to have faxes emailed to:&nbsp; myname@mydomain.com<br />
- Email address that faxes appear to come from:&nbsp; pbx@mypbx.mydomain.local</li>
<li>Under Online Updates, make this setting:<br />
- Update Email:&nbsp; myname@mydomain.com</li>
<li>Click on Submit Changes, then Apply and Continue.</li>
</ol>
<h2>Voicemail</h2>
<p>One thing you&#8217;ll want to do is record your voicemail greetings. Dial *97 from your extension and follow the prompts. To manage your voicemails (and lots more) in a browser, from the FreePBX main menu, click on the small Recordings tab at the top of the screen, then log in with your extension number and voicemail password.</p>
<p>On the topic of web management of voicemail, when you receive voicemails via email, you&#8217;ll notice a link that includes the string AMPWEBADDRESS. Here&#8217;s how to update that:</p>
<ol>
<li>From the FreePBX main menu, click on the Tools tab, then under Maintenance, click on Config Edit. This opens a window in the right pane where you will see all of the nitty-gritty Asterisk configuration files.</li>
<li>In the gray bar at the top of this pane, click on the <code>/etc/asterisk</code> directory. The files in this directory are listed.</li>
<li>Click on the <code>vm_email.inc</code> file to open that file.</li>
<li>Scroll to the right until you see &#8220;AMPWEBADDRESS&#8221;. Replace that string with the IP address or DNS name of your FreePBX machine, e.g. mypbx.mydomain.local.</li>
<li>At the bottom of the edit window, click on Update.</li>
<li>In the gray bar at the top of the pane, click on the link at the far right side:&nbsp; <code>Re-Read Configs</code>. This reloads the configuration files.</li>
</ol>
<p>The next time you get a voicemail by email, you can click on the link to load the voicemail web interface!</p>
<h2>Internal and Outbound Faxing</h2>
<p>See the <a href="http://nerdvittles.com/index.php?p=237" target="_blank">Nerd Vittles article on faxing</a> if you want to set up extensions for internal and outbound faxing. One thing worth doing now is to to use the Config Edit tool described just above to edit the [faxit] context at the bottom of <code>/etc/asterisk/extensions_custom.conf.</code> Change the <code>LOCALHEADERINFO</code> value to the name to be displayed on outbound faxes. Change the <code>LOCALSTATIONID</code> value to the fax number to be displayed on outbound faxes.</p>
<h2>Going Further</h2>
<p>A few suggestions on where to go from here:</p>
<ul>
<li>Many features are accessible via feature codes. From the main FreePBX menu, click on the Setup tab, then under Basic, click on Feature Codes to see the whole list.</li>
<li>The list of installed modules under the FreePBX Setup tab should also give you some ideas about built-in capabilities. Set up an auto-attendant (IVR). Create speed dial numbers. Blacklist numbers by Caller ID. Set up groups of phones to ring at the same time. Change which phones ring during business hours and afterwards.</li>
<li>While you were setting up the extension above, you may have noticed the VmX Locator™ option at the bottom of the extension screen. FreePBX has some amazing abilities for automatically hunting you down&#8211;if you want it to. Setting that up is beyond the scope of this article, but for more information. see the FreePBX article <a href="http://www.freepbx.org/news/2007-09-13/follow-me-or-vmx-locater-which-one-is-for-you" target="_blank">Follow Me or VmX Locater™ &#8211; Which One is for You?</a></li>
<li>One of the advantages of having an Asterisk-based systems is that its use is so widespread that lots of people develop add-ons for it. A good resource for those add-ons is the <a href="http://nerdvittles.com/" target="_blank">Nerd Vittles</a> site. They have enough tips for FreePBX and Asterisk to keep you occupied for months! Want to set up automatic backups? How about getting weather by zip code? Click-to-dial any number you see in a Firefox browser? The list seems endless.</li>
</ul>
<p>Before going too far, make one more backup of your working, configured PBX in a Flash virtual machine. Call it something like &#8220;PiaF.4.With installation-specific updates, after FreePBX configuration.zip&#8221;. Finally, you may want to turn off Undo Disks in Virtual Server to make things run a bit faster.</p>
<p>Enjoy your new PBX!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-3-configuring-freepbx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up PBX in a Flash, Part 2: Before Running FreePBX</title>
		<link>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-2-before-running-freepbx/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-2-before-running-freepbx/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 17:33:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx</guid>
		<description><![CDATA[The first article in this series, Getting Into VoIP, gave an overview of VoIP systems that I tested and why I chose to implement PBX in a Flash (PiaF). The next post, Setting Up PBX in a Flash, Part 1: Configuring a Virtual Machine talked about setting up PiaF under Microsoft Virtual Server. In this [...]]]></description>
			<content:encoded><![CDATA[<p>The first article in this series, <a href="http://blogs.mcbsys.com/mark/post/Getting-Into-VoIP.aspx">Getting Into VoIP</a>, gave an overview of VoIP systems that I tested and why I chose to implement PBX in a Flash (PiaF). The next post, <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx">Setting Up PBX in a Flash, Part 1: Configuring a Virtual Machine</a> talked about setting up PiaF under Microsoft Virtual Server. In this post, we&#8217;ll finish all the steps needed to complete our basic installation before configuring the PBX itself. </p>
<p><span id="more-52"></span> </p>
<h1>Completing the Generic Setup</h1>
<p>These two steps will take us as far as we can go before we start entering information about our specific environment. </p>
<ol>
<li>Update PBX in a Flash by typing these two commands and following the prompts.<br />
<code>update-scripts</code><br />
<code>update-fixes</code> </p>
<li>In <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx">part 1</a>, we changed to the CentOS &#8220;vm&#8221; kernel. Zaptel is a kernel service and has not been compiled against this kernel, so it fails to load. You could compile it and get it to load, but in my environment, that still led to choppy voice and error messages, so I decided to simply disable it. (I don&#8217;t need the MeetMe conferencing and IAS trunking provided by Zaptel&#8217;s ztdummy driver.)<br />
&#160;<br />
Zaptel normally starts when /etc/rc.d/rc3.d/S09zaptel calls the init script at /etc/rc.d/init.d/zaptel. To keep Zaptel from loading automatically, rename /etc/rc.d/init.d/zaptel to /etc/rc.d/init.d/zaptel.disabled. Note that this does not uninstall Zaptel, it keeps it from trying to loading at startup.<br />
<code>cd /etc/rc.d/init.d</code><br />
<code>mv zaptel zaptel.disabled</code> </li>
</ol>
<h2>Optional:&#160; Adding Fax Capability</h2>
<p>If you want your system to be able to send and receive faxes, this would be a good time to install the software. This <a href="http://nerdvittles.com/index.php?p=237" target="_blank">Nerd Vittles article</a> tells you all about it. All you need to do now is install the fax software by typing these commands: </p>
<p><code>cd /root<br />
wget http://pbxinaflash.net/source/fax/fax.pbx<br />
chmod +x fax.pbx<br />
./fax.pbx</code> </p>
<p>We&#8217;ll cover the FreePBX configuration in the <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx">Part 3</a>. </p>
<h2>Saving Your Setup</h2>
<p>This is a great time to shutdown the CentOS machine (<code>shutdown -h now</code>), merge your undo disks, and make a backup of your virtual machine. This is the last snapshot opportunity before you start customizing the machine for your environment. That means that <em>this</em> is the virtual machine you would want to take with you if you started to do a new PBX installation at another location. You might call it &#8220;PiaF.2.With CentOS VM Kernel, Microsoft VM Additions, and Generic PiaF Updates.zip&#8221;. </p>
<h1>Completing the Installation-Specific Setup</h1>
<p>This section is really just a series of notes on Ward Mundy&#8217;s excellent &#8220;knol&#8221;, the <a href="http://knol.google.com/k/ward-mundy/pbx-in-a-flash/3uqc77rg9tgar/2#" target="_blank">Nerd Vittles Step-by-Step 1.3 Tutorial</a>. I&#8217;ll use the same headings that he does to make it easier to match up. Note that these are the settings specific to my installation; you will need to adjust your settings accordingly. </p>
<h2>Four Steps to Complete the Install</h2>
<p><strong>genzaptelconf.</strong> Not needed because we&#8217;ve disabled Zaptel, above. </p>
<p><strong>IP address.</strong> I like controlling IP addresses on my network from a central location, namely my DHCP server, which is part of my router. So in Virtual Server, I set the virtual machine&#8217;s network card to use a static MAC address. Then I went into my router setup and told the router to always give out the same IP address to that MAC address. That way I can leave DHCP running on the client, but still have a &#8220;fixed&#8221; IP (or a DNS entry pointing to the IP) when configuring phones and ATAs. </p>
<h2>Getting Rid of One-Way Audio</h2>
<p>This is probably not needed since I won&#8217;t be using external VoIP providers right away, but it can&#8217;t hurt to set it now.&#160; My external IP is fixed, so I edited <code>/etc/asterisk/sip_custom.conf</code> to contain these two lines (adjust for your network): </p>
<p><code>externip=180.12.12.12</code><br />
<code>localnet=192.168.1.0/255.255.255.0</code> </p>
<p><code></code>Then I rebooted (<code>shutdown -r now</code>). See Ward&#8217;s article if you need instructions on handling dynamic external IP addresses. </p>
<h2>Getting Your System Up to Date</h2>
<p>We already ran <code>update-scripts</code> and <code>update-fixes</code> above, so there is no need to do that here. </p>
<h2>Activating Email Delivery of Voicemail Messages </h2>
<p>I don&#8217;t use dynamic DNS, and I host my own mail and DNS servers, so my approach here deviates slightly from Ward&#8217;s. First, I decided to change the name of the Asterisk box from the default &#8220;pbx.local&#8221; to an actual name on my .local network. <a href="http://www.geocities.com/rlcomp_1999/hostname.html" target="_blank">This post</a> has detailed instructions. Here&#8217;s what I did: </p>
<p><code>nano -w /etc/hosts </code># Change the first line to read as follows: </p>
<p><code>&#160;&#160;&#160; 127.0.0.1&#160;&#160;&#160;&#160;&#160;&#160; mypbx.mydomain.local mypbx localhost.localdomain localhost</code><br />
<code>&#160;&#160;&#160; ::1&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; localhost6.localdomain6 localhost6</code> </p>
<p><code>nano -w /etc/sysconfig/network </code># Change the last line as shown: </p>
<p><code>&#160;&#160;&#160; NETWORKING=yes</code><br />
<code>&#160;&#160;&#160; NETWORKING_IPV6=no</code><br />
<code>&#160;&#160;&#160; HOSTNAME=mypbx.mydomain.local</code> </p>
<p><code>shutdown -r now</code>&#160; # Reboot to make sure changes are applied properly </p>
<p><code>cat /proc/sys/kernel/hostname</code>&#160; # Check that this matches &#8220;mypbx.mydomain.local&#8221; </p>
<p>I also added mypbx to my DNS server. I set up an &#8220;A&#8221; record pointing to the IP that the router assigns, and I let DNS set up a reverse lookup record as well. </p>
<p>Send a test email: </p>
<p><code>echo "test" | mail -s testmessage myemail@mydomain.com</code> </p>
<p>At this point, mail is successfully traveling through my external Google Postini filter and my Exchange 2003 IMF filter, but Outlook 2007 is dropping it in the Junk E-mail folder. Run this command: </p>
<p><code>setup-mail</code> </p>
<p>Enter &#8220;mypbx.mydomain.com&#8221; as the FQDN. Use &#8220;.com&#8221; so Postini can confirm the sending domain.&#160; (Later, in WebMin&#8217;s Sendmail configuration, I saw that this command configured &#8220;mypbx.mydomain.com&#8221; under Domain Masquerading.) A test message at this point sometimes goes to junk mail, sometimes not. We&#8217;ll make one more change to email, below, but first we must set up passwords and WebMin. </p>
<h1>Setting Passwords and Other Stuff </h1>
<p>Back in <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx" target="_blank">Part 1</a>, I recommended using a simple password for root. This was to allow saving and even sharing the virtual machine image with different sites. Now it&#8217;s time to lock that down. </p>
<p><code>passwd</code> # This is a Linux command that resets the root password. Make it a complex password this time! </p>
<p><code>passwd-master</code> # This is a PiaF script. Follow the prompts to set the WebMin password to match root&#8217;s password, then create one password for maint, wwwadmin, and meetme. Although the script recommends using the root password, I chose to create a different, secure password here. </p>
<h1>Use My Local SMTP Server </h1>
<p>This is one item that is not covered in the Ward&#8217;s article. So far, mail is traveling from my PBX box to the offsite Google Postini filters, then back to my mail server and finally to my Inbox. I think that email sent by my own PiaF box can safely skip the Postini filtering process, so I want PiaF to relay mail directly to my SMTP (Exchange) server. </p>
<p>Log in to WebMin (http://mypbx.mydomain.local:9001), open Servers > Sendmail Mail Server, and click on Sendmail Options.&#160; Change the first option, &#8220;Send outgoing mail via host&#8221;, to your SMTP server&#8217;s name, e.g. &#8220;mailserver.mydomain.local&#8221;, then click on Save and Apply.&#160; That should relay mail through my SMTP server, avoiding Postini for local delivery.&#160; This time, a test message is delivered to my Inbox. Looking at its headers confirms that it was delivered locally without going through Postini.</p>
<p><strong>Update 2/17/2010:</strong> While you&#8217;re in the Sendmail configuration, take a moment to forward the <em>root</em> user&#8217;s mail to a legitimate email address. Once this is set up, you&#8217;ll start receiving a helpful daily &#8220;Logwatch&#8221; email summarizing system status and activity, including disk space. </p>
<p>In WebMin, from Servers > Sendmail Mail Server, click on Mail Aliases. In the lower right corner, click on the <em>root</em> user. Forward email to the administrative email address of your choice. Be sure to set Enabled = Yes before clicking on Save.</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/WindowsLiveWriter/SettingUpPBXinaFlashPart2BeforeRunningFr_E4DE/Sendmail%20root%20alias_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="160" alt="Sendmail root alias" src="http://www.mcbsys.com/techblog/wp-content/uploads/WindowsLiveWriter/SettingUpPBXinaFlashPart2BeforeRunningFr_E4DE/Sendmail%20root%20alias_thumb_1.png" width="260" border="0"></a> </p>
<p><strong>Update 10/12/2008:</strong>&#160; If you want your PBX to respond to ping requests, you can set that up now. This may be desirable if you have a server that runs monitoring software and needs to ping the PBX to see if it is running. Under WebMin, find the Linux Firewall. It may be under Networking or Un-used Modules. In the Add column, click on the down-arrow next to the rule &#8220;If protocol is ICMP and ICMP type is source-quench&#8221;. In the Add Rule screen, select &#8220;Network protocol&#8221; = &#8220;ICMP&#8221; and &#8220;ICMP packet type&#8221; = &#8220;echo-request&#8221;. At the top of the Add Rule screen, set the Action to Accept. If your PBX is open to the public Internet, you may want to use &#8220;Source address or network&#8221; to restrict the ping requests to your internal network. </p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/WindowsLiveWriter/SettingUpPBXinaFlashPart2BeforeRunningFr_E4DE/PiaF%20Firewall%20PING%20Rule_4.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="260" alt="PiaF Firewall PING Rule" src="http://www.mcbsys.com/techblog/wp-content/uploads/WindowsLiveWriter/SettingUpPBXinaFlashPart2BeforeRunningFr_E4DE/PiaF%20Firewall%20PING%20Rule_thumb_1.png" width="248" border="0"></a> </p>
<h1>Ready for Part 3</h1>
<p>You might want to take another snapshot of your virtual machine at this point. Although this version is now specific to your installation, it&#8217;s a good fallback point in case you decide you want to start from scratch with part 3, the PBX configuration. Call it something like &#8220;PiaF.3.With installation-specific updates, before FreePBX configuration.zip&#8221;. </p>
<p>Then get ready to actually start configuring the PBX! <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx">Setting Up PBX in a Flash, Part 3:&#160; Configuring FreePBX</a> is next. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-2-before-running-freepbx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up PBX in a Flash, Part 1: Configuring a Virtual Machine</title>
		<link>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-1-configuring-a-virtual-machine/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-1-configuring-a-virtual-machine/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 16:16:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[virtual server]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx</guid>
		<description><![CDATA[The introduction to this series, Getting Into VoIP, explained some of the requirements and testing that went into choosing a VoIP environment and application. One really-want (if not must-have) requirement is getting it to run in a virtual machine. There are so many advantages to virtualization:&#160; easy backups and moving VMs to different hosts, to [...]]]></description>
			<content:encoded><![CDATA[<p>The introduction to this series, <a href="http://blogs.mcbsys.com/mark/post/Getting-Into-VoIP.aspx">Getting Into VoIP</a>, explained some of the requirements and testing that went into choosing a VoIP environment and application. One really-want (if not must-have) requirement is getting it to run in a virtual machine. There are so many advantages to virtualization:&nbsp; easy backups and moving VMs to different hosts, to name two. However&#8230;</p>
<p><span id="more-53"></span></p>
<h1>Danger Will Robinson!</h1>
<p>&#8220;Don&#8217;t do it!&#8221; That was the most consistent response I got in the PBX in a Flash (PiaF) forum when I asked about running PiaF in a virtual machine. Why would you want to run a real-time application in a virtual machine? It&#8217;s fine for testing but don&#8217;t use it in production!</p>
<p>Well I&#8217;m a stubborn nut and when someone says it can&#8217;t be done, I feel more compelled to do it. Besides, we&#8217;re talking about my home office here, not some huge enterprise installation. How much power could the virtual machine need? How hard could it be?</p>
<h1>Plenty Hard</h1>
<p>It turns out that there are <em>lots</em> of variables to test when running a Linux guest in a virtual machine. PiaF uses CentOS 5.2, so all of my testing was done with that flavor of Linux. Even with that constant, there are a lot of variables, which made finding a workable solution quite a lot of work:</p>
<ul>
<li>VMWare or Microsoft?</li>
<li>VMWare Player, VMWare Server, Virtual PC, or Virtual Server?</li>
<li>With or without the Linux VM Additions offered by each vendor?</li>
<li>What kernel options to use? clocksource? nosmp? noapic?</li>
<li>CentOS &#8220;standard&#8221; with its 1000 Hz clock frequency, or the special &#8220;vm&#8221; kernel with its 100 Hz frequency?</li>
<li>If CentOS &#8220;vm&#8221;, will the recompiled Zaptel drivers run?</li>
<li>How to install CentOS when the installer uses 24-bit video and makes the screen illegible?</li>
</ul>
<h1>Choosing a Virtual Platform</h1>
<h2>Environment</h2>
<p>I want to use an old PC to run my home-office PBX. It&#8217;s a Pentium 4, 2 GHz, 1 GB RAM, 80GB IDE hard drive, running Windows XP Professional. I&#8217;ll be installing the 32-bit version of PBX in a Flash 1.3, which installs CentOS 5.2 with the 2.6.18-92.1.6.el5 Linux kernel. During the install, I selected the Asterisk 1.4 over the newer 1.6. I read that Asterisk 1.4 is still the recommended version for production use.</p>
<h2>It&#8217;s about Time</h2>
<p>The biggest issue with Linux virtual machines, it turns out, is time. The clock runs too fast or too slow, or it requests so many interrupts that CPU usage on the host stays very high, or it doesn&#8217;t provide an accurate time source to Zaptel and throws errors. When the time is messed up, the audio usually sounds choppy. Finding the right virtual host has a lot to do with finding a host that can properly handle timing issues.</p>
<h2>VMWare</h2>
<p>You have to hand it to VMWare, they know about Linux. Just look through their documentation and you&#8217;ll see all the flavors of Linux they&#8217;ve tested.</p>
<p>Interestingly, running PiaF in the free VMWare Player with the standard CentOS kernel, pre-built Zaptel drivers, no kernel switches, and no VM additions, works pretty well! I actually followed the <a href="http://www.pbxinaflash.com/vm/" target="_blank">instructions</a> on the PiaF web site for running in a Virtual Machine, but I didn&#8217;t realize that I needed to manually select the alternate kernel when booting, so I was using the standard kernel. However the clock did seem to drift in this scenario.</p>
<p>I wanted to run a server product so I can get the virtual machine to stop and start when the host machine needs to be rebooted. I downloaded and tested the enormous VMWare Server. I figured I needed to get the VM extensions installed to solve the clock drift issue, plus they would be required for shutdown and startup synchronized with the host. But the VM additions would not install when I told VMWare Server that the client was Red Hat Enterprise Linux 5 (which CentOS 5 is based on).</p>
<p>Since I got stuck here, and since it looked like the Microsoft platform would work, I did not test the &#8220;vm&#8221; kernel or recompiling Zaptel under VMWare.</p>
<h2>Microsoft</h2>
<p>On the Virtual PC/Server side, a &#8220;bare install&#8221; of PiaF leads to choppy audio and to host CPU usage consistently above 30%, even when the guest is idle. Installing the CentOS &#8220;vm&#8221; kernel drops CPU usage to under 15%, and the audio sounds good! A combination of VM Additions for Linux and some kernel parameters seems to keep the clock fairly accurate (still to test on a long-term basis).</p>
<p>The drawback is that after recompiling and running Zaptel, I was getting &#8220;rtc: lost some interrupts at 1024 Hz&#8221; errors, and I was back to choppy-sounding audio. The <code>zttest</code> command showed terrible results. Since I&#8217;m not using Zaptel hardware, the only Zaptel driver in question is ztdummy. ztdummy is only needed for &#8220;MeetMe&#8221; conferencing and IAX trunking, both of which I can do without for now. So I will simply disable Zaptel.</p>
<p>Like VMWare Server, Microsoft Virtual Server runs as a service so it can keep the guest OS running even when no one is logged on to the host. With the help of the Microsoft VM Additions for Linux, Virtual Server will let me reboot the guest OS when I reboot the host. So I&#8217;ll go with Virtual Server as the platform for now. The rest of this entry explains how to set that up.</p>
<h1>Setting Up CentOS under Virtual Server</h1>
<p>Follow these steps to set up CentOS under Virtual Server using the Piaf installation ISO:</p>
<ol>
<li>Set up a new virtual machine with 512MB of memory, an 8GB virtual IDE hard disk, and a connected network card.</li>
<li>Download the PBX in a Flash 1.3 ISO file. Attach the ISO to the virtual machine&#8217;s CD-ROM drive and boot the machine.</li>
<li>At the first install prompt, type <code>ksalt</code>. This starts the install in text mode, which avoids the issue with the 24-bit video. It also does not use the LVM file system, which apparently adds unnecessary overhead (according to <a href="http://pbxinaflash.com/forum/showthread.php?t=2469" target="_blank">jroper</a>). I deliberately chose a very simple root password during the setup so I could take this virtual machine to client sites one day if needed.</li>
<li>After the install completes, it will reboot. Quickly detach the ISO file or it will go back into the installation again. After the boot completes (you&#8217;ll see the &#8220;User&#8221; prompt), shut down the machine by sending a Ctrl-Alt-Del from Virtual Server and stopping the machine when it is at the BIOS startup stage. Make a copy of your virtual machine at this point, and/or turn on Undo Disks, so you can come back to this point if you encounter problems with the steps below. (<a href="http://www.winzip.com" target="_blank">WinZip</a> is great for creating a compressed snapshot of the virtual machine. Name it something like &#8220;PiaF.1.Immediately after CentOS Install.zip&#8221;)</li>
<li>Start the virtual machine and log on to CentOS. Make sure that CentOS is online. At a command prompt:<br />
<code>/sbin/ifconfig</code> # check whether an IP address has been assigned; if so, go to the next step<br />
<code>system-config-network</code> # if you need to check the network setup<br />
<code>nano -w /etc/sysconfig/network-scripts/ifcfg-eth0</code> # view network setup in text form<br />
<code>service network restart</code> # restart with updated network setup if you made changes<br />
<code>/sbin/ifconfig</code> # check that an IP address has now been assigned</li>
<li>Add the kernel options. Regarding the clock source, see <a href="http://support.microsoft.com/kb/918461/en-us" target="_blank">Microsoft KB 918461</a>, but note that <code>clocksource</code> is now preferred to <code>clock</code> (see <a href="http://www.to-tech.com/blog/2007/08/23/virtual-serverpc-tip-clocktip-deprecated/" target="_blank">this post</a>). <code>nosmp</code> disables Symmetric MultiProcessing. <code>noapic</code> and <code>nolapic</code> were recommended in other posts.<br />
<code>nano -w /boot/grub/menu.lst</code>&nbsp;<br />
At the end of the &#8220;kernel&#8221; line, add this string:<br />
<code>clocksource=pit nosmp noapic nolapic</code></li>
<li>Update the kernel with the CentOS Virtual Machine kernel. This is <a href="http://www.pbxinaflash.com/vm/" target="_blank">outlined on the PiaF site</a>, but do <em>not</em> recompile Zaptel as instructed there. For some wonderfully arcane discussion of what the &#8220;vm&#8221; kernel does and why it is needed, see this <a href="http://bugs.centos.org/view.php?id=2189">CentOS bug report</a>. The &#8220;vm&#8221; kernels are available <a href="http://dev.centos.org/%7Etru/kernel-vm/5/RPMS/i386/">here</a>. Note:&nbsp; choose the version that matches your current kernel.<br />
<code>cd /root</code><br />
<code>uname -r</code> # Check your Linux version. Modify the next two lines to match.<br />
<code>wget http://dev.centos.org/~tru/kernel-vm/5/RPMS/i386/kernel-vm-2.6.18-92.1.6.el5.i686.rpm</code><br />
<code>wget http://dev.centos.org/~tru/kernel-vm/5/RPMS/i386/kernel-vm-devel-2.6.18-92.1.6.el5.i686.rpm</code><br />
<code>rpm -ivh kernel-vm*.rpm</code></li>
<li>Edit grub to make the new kernel load by default.<br />
<code>nano -w /boot/grub/menu.lst</code> In this file, set <code>default=0</code> if the .e15vm kernel is listed first. After saving the file, reboot.<br />
<code>shutdown -r now<br />
</code></li>
<li>After the reboot, check the Linux version to make sure it ends in &#8220;vm&#8221;:<br />
<code>uname -r<br />
</code></li>
<li>You may also want to confirm that the <code>clocksource</code> is set to <code>pit</code> using the method suggested in <a href="http://fixunix.com/hardware/243541-what-clock-source-my-kernel-using.html" target="_blank">this thread</a>):<br />
<code>cat /sys/devices/system/clocksource/clocksource0/current_clocksource</code></li>
</ol>
<h1>Installing Microsoft Virtual Machine Additions for Linux</h1>
<p>You&#8217;ll need to <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bf12642f-77dc-4d45-ae4e-e1b05e0a2674&amp;DisplayLang=en" target="_blank">download</a> and install the Microsoft Virtual Machine Additions for Linux. Besides the Readme file that is installed with that package, I&#8217;d like to acknowledge two helpful posts that pointed me in the right direction:&nbsp; <a href="http://www.buit.org/2007/04/02/installing-vm-additions-on-linux/" target="_blank">Installing VM Additions on Linux</a> by Erik Luppers, and a forum thread titled <a href="http://www.aspdeveloper.net/Virtual_Server_2005/rn-738-18143_best_free_linux_that_has_real_additions_support.aspx" target="_blank">best &#8220;free&#8221; linux that has real additions support</a>, in particular Alexander Kaufmann&#8217;s post.</p>
<ol>
<li>Normally you would need to run <code>yum update kernel</code>, reboot, then run <code>yum install kernel-devel gcc</code> to get the kernel source. However, it seems that the PiaF already includes the kernel source, so this step is not needed with PiaF.</li>
<li>From Virtual Server, attach &#8220;VMAdditionsForLinux.iso&#8221; to the CD drive. Then inside the virtual machine, mount the drive and copy the files to a new directory as follows:<br />
<code>mkdir /media/cdrom</code><br />
<code>mount /dev/cdrom /media/cdrom</code><br />
<code>mkdir /usr/src/vmadd</code><br />
<code>cp /media/cdrom/*.* /usr/src/vmadd</code><br />
<code>umount /dev/cdrom</code><br />
You can release the ISO image from the virtual machine at this point.</li>
<li>Install individual VM Additions modules, skipping X11 and SCSI (which we aren&#8217;t using):<br />
<code>cd /usr/src/vmadd</code><br />
<code>rpm -ivh vmadd-kernel-module-RHEL-2.0-1.i386.rpm</code><br />
<code>tail -100 /var/log/vmadd-kernel-module.log | more</code> # Make sure the main install/make worked<br />
<code>rpm -ivh vmadd-heartbeat-2.0-1.i386.rpm</code><br />
<code>rpm -ivh vmadd-shutdown-2.0-1.i386.rpm</code><br />
<code>rpm -ivh vmadd-timesync-2.0-1.i386.rpm</code><br />
A note on SCSI:&nbsp; although it&#8217;s a simple matter in Virtual Server to change the hard drive to SCSI, it looked like a fair amount of effort to get the (faster) SCSI drivers from VM Additions configured. Since some contend that IDE is just as fast in a Linux virtual machine, I&#8217;ll just stick with IDE.</li>
<li>You could start services manually as below, but I just rebooted:<br />
<code>shutdown -r now</code></li>
</ol>
<p>Here are the commands to start the VM Additions services manually:<br />
<code>/etc/init.d/vmadd start</code><br />
<code>/etc/init.d/vmadd-heartbeat start</code><br />
<code>/etc/init.d/vmadd-timesync start</code><br />
<code>/etc/init.d/vmadd-shutdown start</code></p>
<p>If you ever need to uninstall, uninstall in this order:<br />
<code>cd /usr/src/vmadd</code><br />
<code>rpm -e vmadd-heartbeat</code><br />
<code>rpm -e vmadd-shutdown</code><br />
<code>rpm -e vmadd-timesync</code><br />
<code>rpm -e vmadd-kernel-module-RHEL</code></p>
<h1>Disabling NTP</h1>
<p>According to the <a href="http://support.ntp.org/bin/view/Support/KnownOsIssues#Section_9.2.2." target="_blank">NTP support site</a>, &#8220;NTP was not designed to run inside of a virtual machine. It requires a high resolution system clock, with response times to clock interrupts that are serviced with a high level of accuracy. No known virtual machine is capable of meeting these requirements.&#8221; Their recommendation is to &#8220;Run NTP on the base OS of the machine, and then have your various guest OSes take advantage of the good clock that is created on the system.&#8221; In other words, <em>don&#8217;t</em> run NTP on the guest.</p>
<p>There does not seem to be universal agreement on this, however. Here is an <a href="http://www.novell.com/support/php/search.do?cmd=displayKC&amp;docType=kc&amp;externalId=3858673&amp;sliceId=1&amp;docTypeID=DT_TID_1_1&amp;dialogID=3682916&amp;stateId=0%200%203684630" target="_blank">article</a> by Novell on how to configure NTP when running under VMWare ESX. One of the recommendations is to comment out the local clock source in <code>/etc/ntp.conf</code>:</p>
<p style="padding-left: 30px;"><code>#server 127.127.1.0 # local clock</code><br />
<code>#fudge 127.127.1.0 stratum 10</code></p>
<p>Since we have conflicting advice, and nothing definitive for Microsoft Virtual Server, I&#8217;ve decided to try the following:</p>
<ol>
<li>In case NTP is ever used down the road, disable the local clock by commenting out the two lines in <code>/etc/ntp.conf</code> as shown above.</li>
<li>Disable ntpd for all runlevels as follows:<br />
<code>chkconfig --list ntpd </code># show current ntpd runlevels (the default is On for 3, 4, and 5)<br />
<code>chkconfig --level 0123456 ntpd off </code># turn off for all runlevels (applies at boot time)<br />
<code>chkconfig --list ntpd </code># confirm that change worked<br />
<code>service ntpd stop </code># shut down the server now<br />
<code>service ntpd status </code># confirm that it stopped</li>
</ol>
<p><strong>Note:</strong>&nbsp; When you first log on to a PiaF system, you will see a table of services and their statuses. You can re-create this table at any time by typing <code>status</code> at the command line. From now on, NTPD should show as OFFLINE.</p>
<p>At this point you should have a working CentOS installation that can more or less tell time. Check the time by typing <code>date</code> at the command prompt and comparing it to the clock on your host system. I&#8217;m still seeing some minor clock drift on my installation; I&#8217;ll have to monitor this for a while to determine whether it becomes a problem.</p>
<p>This is a good point at which to shut down the guest (<code>shutdown -h now</code>) and merge any Undo Disk changes. You&#8217;re welcome to make a copy of the virtual machine at this point, but you might want to wait a few minutes. We&#8217;ll start the next section,&nbsp; <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx">Setting Up PBX in a Flash, Part 2:&nbsp; Before Running FreePBX</a>, with a couple simple steps to update PiaF. Once that &#8220;generic&#8221; part of our setup is complete, we&#8217;ll make a copy of the virtual machine before continuing with the installation-specific setup.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/setting-up-pbx-in-a-flash-part-1-configuring-a-virtual-machine/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting Into VoIP</title>
		<link>http://www.mcbsys.com/techblog/2008/11/getting-into-voip/</link>
		<comments>http://www.mcbsys.com/techblog/2008/11/getting-into-voip/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 10:32:40 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[3cx]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[sipx]]></category>
		<category><![CDATA[sipxecs]]></category>
		<category><![CDATA[trixbox]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Getting-Into-VoIP.aspx</guid>
		<description><![CDATA[It all started with my new Magicjack. Plug this little gizmo into your PC and you get unlimited domestic calling, $40 for the first year and $20/year thereafter. That&#8217;s hard to pass up. But it also means that I now have three phone lines coming into the home office. So I either needed to get [...]]]></description>
			<content:encoded><![CDATA[<p>It all started with my new <a href="http://www.magicjack.com" target="_blank">Magicjack</a>. Plug this little gizmo into your PC and you get unlimited domestic calling, $40 for the first year and $20/year thereafter. That&#8217;s hard to pass up. But it also means that I now have <em>three</em> phone lines coming into the home office. So I either needed to get a bigger analog phone, or get into a PBX.</p>
<p><span id="more-54"></span></p>
<h1>Requirements</h1>
<p>Here are the things I wanted my PBX system to do:</p>
<ul>
<li>Answer two incoming POTS lines, one business line and one personal line. </li>
<li>Answer the Magicjack line, also as a POTS line. (Unfortunately, Magicjack does not yet allow users to access them as a VoIP provider without the use of the Magicjack hardware.) </li>
<li>Route these three lines to two existing analog phone lines in the house, and eventually to a SIP phone for the home office. </li>
<li>Route outgoing calls based on least cost. In particular, local calls should go out on the personal line (which has unlimited local calling), and long-distance on the Magicjack. &#8220;Local&#8221; in this case is loosely defined as area codes 619 and 858. I only dial 7 digits for 619 phone numbers, but I have to dial 1 + the area code to reach 858 numbers. Ideally least cost could be differentiated more granularly, as some 858 prefixes are probably toll calls and should go out on the Magicjack. </li>
<li>If possible, run in a virtual machine. The host is an old 2 GHz Pentium 4 with 1 GB of memory, running XP Professional. </li>
<li>If possible, cost nothing for software. </li>
<li>Oh yeah:&#160; and deliver crisp, clear audio with no jitter, crackling, drop-outs, echo, or all those other annoying problems that have become so familiar with VoIP. </li>
</ul>
<p>A quick aside for those who want to try this at home:&#160; before doing anything else, I had to modify my existing phone wiring. I basically installed a multi-port phone jack at the point where the phone lines come into the house. The top ports of the jack are the incoming phone lines. The bottom ports feed back out to the existing analog phones. My PBX goes in between.</p>
<h1>Choosing a VoIP PBX</h1>
<p>A couple years ago, I needed to replace a small traditional PBX for a client. It quickly became apparent that a computer-based VoIP PBX would be significantly cheaper than buying a new traditional PBX. I eventually went with <a href="http://www.trixbox.org" target="_blank">Trixbox</a>, and it&#8217;s still working pretty good. </p>
<p>Trixbox is basically a pre-built ISO that installs the CentOS flavor of Linux, then sets up <a href="http://www.freepbx.org" target="_blank">FreePBX</a>, which is based on <a href="http://www.asterisk.org/" target="_blank">Asterisk</a>. Trixbox has since gone commercial. While they still offer a free version, I decided this time to look at <a href="http://www.pbxinaflash.com/" target="_blank">PBX in a Flash</a> (PiaF). PiaF also uses CentOS, FreePBX, and Asterisk.</p>
<p>I&#8217;d seen mention of <a href="http://www.3cx.com" target="_blank">3CX</a> in some forums. Since I mostly use Windows boxes, the idea of a Windows-based PBX is appealing. I decided to look at 3CX.</p>
<p>Somewhere along the way I stumbled across <a href="http://sipx-wiki.calivia.com/index.php/Main_Page" target="_blank">sipXecs</a> and spent some time looking at that as well. I&#8217;ve already <a href="http://blogs.mcbsys.com/mark/post/Testing-sipXecs.aspx" target="_blank">blogged</a> on that so I won&#8217;t spend any more time on that here.</p>
<h1>Trying Out 3CX</h1>
<p>It was pretty easy to get 3CX set up and running in a Windows virtual machine under Microsoft Virtual PC/Server. (That&#8217;s saying a lot compared to the hoops you have to jump through to run a Linux-based PBX in a virtual machine!) And once set up, there&#8217;s a lot to like:</p>
<ul>
<li>Consistent user interface. </li>
<li>Decent documentation on how to set up Analog Terminal Adapters (ATAs) and phones. </li>
<li>Pretty easy to configure. </li>
<li>Caller ID was captured correctly (number only, no name) </li>
<li>Good voice quality, except with the Magicjack, which turned out to be a pretty universal problem. </li>
</ul>
<p>However it didn&#8217;t take long before I started encountering some limitations:</p>
<ul>
<li>Web access to voicemail, and fax service, are only available in the commercial edition. </li>
<li>Voicemails can be sent as email attachments, but the .wav files occupy about 1MB per minute. </li>
<li>Outbound call rules can only be set up based on number length, number starting with, or which extension is making the call. I did not see an obvious way to set up my least-cost dialing rules (although it might be possible to set up area codes with the &#8220;number starting with&#8221; option). My <a href="http://www.3cx.com/forums/how-to-set-up-smart-outbound-rules-7439.html" target="_blank">forum post</a> on the topic yielded no solution. </li>
</ul>
<p>I initially had some other issues, but they were mostly related to the Grandstream HT-503 ATAs that I started testing with. I wound up returning those ATAs when I was unable to get them to reliably deliver Caller ID.</p>
<h1></h1>
<h1>Trying Out PBX in a Flash</h1>
<p>PBX in a Flash (PiaF) has a great <a href="http://www.pbxinaflash.com" target="_blank">web site</a> with loads of documentation and an active forum. PiaF uses <a href="http://www.freepbx.org" target="_blank">FreePBX</a> , which has its own site and forum. FreePBX is built around <a href="http://www.asterisk.org" target="_blank">Asterisk</a>, also with its own site and forum. This multi-level product can be a bit confusing at first, but ultimately it is one of its strengths. It wasn&#8217;t until I looked at sipXecs that I was reminded what it&#8217;s like to deal with &#8220;raw&#8221; open-source software. The great thing about PiaF and FreePBX is that these guys have tested a bunch of different versions of the software plus dozens of add-ons, have found combinations that work, and have created packages that install everything for you automagically (more or less).</p>
<p>Some of the other PiaF/FreePBX pluses:</p>
<ul>
<li>Outbound calling rules are infinitely configurable through a kind of regular expression syntax. FreePBX can even pull in a pre-built list of local phone number prefixes. </li>
<li>The free version includes web access to email and fax service. </li>
<li>Voicemails sent as email attachments are compact&#8211;under 100K per minute. </li>
<li>Voice quality is good except with the Magicjack. </li>
<li>Lots and lots of add-ons are available. I may not need or use most of these, but it is nice to use a platform (Asterisk) that is so widely implemented and enhanced. </li>
</ul>
<p>Of course, PiaF is not without its difficulties:</p>
<ul>
<li>By far the biggest hassle is getting PiaF running well in a virtual machine. More on that in a <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx" target="_blank">separate blog post</a>. </li>
<li>The PiaF/FreePBX user interface has improved greatly in the last couple years, but it&#8217;s still clear that PiaF incorporates programs by several different authors:&#160; the &#8220;look and feel&#8221; is not consistent throughout. </li>
<li>You can&#8217;t entirely avoid knowing something about Linux. This could also be listed as a &#8220;plus&#8221; since learning Linux is probably a good thing. But it does make the install more difficult when you need to search Google every time you want to run some simple command (check the IP address of the computer, list files with their sizes, etc.). </li>
</ul>
<h1>General Findings and Moving Forward</h1>
<p>After much testing, I&#8217;ve had to accept that the Magicjack may not work reliably with a VoIP PBX system. It seems that going from a VoIP device to analog and back to VoIP, with all those analog-to-digital transitions, may be too much too ask. I&#8217;ve moved Magicjack compatibility down the priority list. Hopefully Magicjack will eventually support a &#8220;BYOD&#8221; (Bring Your Own Device) solution so I can directly register the Asterisk server with Magicjack as a VoIP provider.</p>
<p>Running a PBX in a virtual machine is indeed a questionable endeavor. 3CX, the Windows-based PBX, seemed to run pretty well in virtual Windows client. But for some reason, getting a Linux-based PBX to run well in a virtual machine is more difficult. I&#8217;ll try running it virtually for a while, but I may wind up installing directly on a physical machine.</p>
<p>Both 3CX and PBX in a Flash have much to recommend them. I&#8217;ve decided to go with PiaF for now. For my own records, I need to document the steps that I took to get it all working. Hopefully by putting the information in a series of posts, it will help some of you out there as well. Here they are:</p>
<p><a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-1-Configuring-a-Virtual-Machine.aspx">Setting Up PBX in a Flash, Part 1:&#160; Configuring a Virtual Machine</a></p>
<p><a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-2-Before-Running-FreePBX.aspx">Setting Up PBX in a Flash, Part 2:&#160; Before Running FreePBX</a></p>
</p>
<p> <a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-3-Configuring-FreePBX.aspx">Setting Up PBX in a Flash, Part 3:&#160; Configuring FreePBX</a>
<p><a href="http://blogs.mcbsys.com/mark/post/Setting-Up-PBX-in-a-Flash2c-Part-4--Configuring-a-Linksys-SPA-3102-ATA.aspx">Setting Up PBX in a Flash, Part 4:&#160; Configuring a Linksys SPA-3102</a></p>
<p><font color="#0000ff">Update 11/24/2008:&#160; I ultimately converted to a physical machine, though the virtual machine was a great test bed and is probably a good alternative for production with the right host. See more </font><a href="http://blogs.mcbsys.com/mark/post/Moving-PBX-in-a-Flash-from-a-Virtual-to-a-Physical-Machine.aspx"><font color="#0000ff">here</font></a><font color="#0000ff">.</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/11/getting-into-voip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing sipXecs</title>
		<link>http://www.mcbsys.com/techblog/2008/10/testing-sipxecs/</link>
		<comments>http://www.mcbsys.com/techblog/2008/10/testing-sipxecs/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 21:14:00 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[sipx]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">/mark/post/Testing-sipXecs.aspx</guid>
		<description><![CDATA[I&#8217;ve been playing with a few software-based VoIP PBXs lately. I accidentally came across SIPFoundry&#8217;s sipXecs (commonly abbreviated SipX). Their Wiki home page gives some compelling reasons to try them out, so I did.

Environment
At least for test purposes, I want to run SipX in a virtual machine. I&#8217;m most familiar with Microsoft Virtual PC and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with a few software-based VoIP PBXs lately. I accidentally came across <a href="http://www.sipfoundry.org">SIPFoundry</a>&#8217;s sipXecs (commonly abbreviated SipX). Their <a href="http://sipx-wiki.calivia.com/index.php/Main_Page" target="_blank">Wiki home page</a> gives some compelling reasons to try them out, so I did.</p>
<p><span id="more-55"></span></p>
<h1>Environment</h1>
<p>At least for test purposes, I want to run SipX in a virtual machine. I&#8217;m most familiar with Microsoft Virtual PC and Server, so I used those. </p>
<h1>Installing SipX   <br /></h1>
<p>Here are some random things I encountered trying to get SipX running in a Microsoft virtual machine. I used the <a href="http://www.sipfoundry.org/download.html">Single CD Installation CD</a> because, &#8220;It cannot be much easier than this.&#8221; Some of the issues that I encountered were due to the virtual environment. Some are due to SipX itself. </p>
<ul>
<li>Virtual PC and Server cannot display the 24-bit graphics used by the CentOS 5 installation program. By examining some of the installation files on the CD, I determined that typing <font face="courier new,courier">sipx text</font> at the first prompt would get the CentOS installation started in text mode, which worked fine. </li>
<li>The SipX installation CD is hard-coded to look for SATA or SCSI disks. Unless you want to rewrite the SipX CentOS kickstart file, that rules out Virtual PC&#8217;s IDE disks. I got around this by installing under Virtual Server R2 SP1 and adding a SCSI controller. After installation, I re-attached the disk as an IDE disk because I didn&#8217;t want to fuss with the SCSI drivers under Linux. </li>
<li>At one point during the installation, it presented me with a SIPDomain name parsed out from a previous hostname entry, and told me that my SIPDomain was wrong and it could not continue. I eventually found the source code using Google and discovered that it was hard-coded to only allow a lowercase domain name. I didn&#8217;t remember giving it uppercase in the first place, but by overtyping its default with lowercase, I was able to continue. </li>
<li>The SipX installation requires you to use a fixed IP address. I prefer to use the router to assign the IP address based on the MAC address. After the installation, I had to use <font face="courier new,courier">system-config-network</font> to go back to DHCP client mode. </li>
<li>The installation apparently does not start the network card automatically. I had to edit <font face="courier new,courier">/etc/sysconfig/network-scripts/ifcfg-eth0</font> and set <font face="courier new,courier">ONBOOT=yes</font>. Only then would <font face="courier new,courier">service network restart</font> actually start the eth0 card. </li>
<li>The SSL certs failed due to clock issues. This is a Virtual Server issue. Once I got the Microsoft <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bf12642f-77dc-4d45-ae4e-e1b05e0a2674&#038;DisplayLang=en" target="_blank">Virtual Machine Additions for Linux</a> installed (a challenge in itself), this problem went away. </li>
<li>After installation, SipX does not work. You have to run <font face="courier new,courier">yum update</font> in order to get the call resolver to start. Since <font face="Courier New">yum update</font> installs 148 packages, it takes forever. </li>
<li>After getting the call resolver to start, I had some trouble getting SipXConfig to run. You&#8217;re supposed to be able to go to http://host.domain.name. That redirects to you to https://host.domain.name:8443/sipxconfig, which tells me Page Not Found. I tried some of the stuff on the <a href="http://sipx-wiki.calivia.com/index.php/SipX_ConfigServer_Troubleshooting" target="_blank">SipX ConfigServer Troubleshooting Page</a> but got nowhere. Finally I found a <a href="http://forum.voxilla.com/sipx-support-forum/problem-configuring-sipxpbx-17647.html" target="_blank">random post on Voxilla</a> that mentions that the URL should be https://host.domain.name:8443/sipxconfig/app. Sure enough, adding &#8220;/app&#8221; got me to the setup page for the application. Later, I found that http://host.domain.name <em>did</em> redirect correctly; I&#8217;m not sure what changed&#8211;possibly that I had manually accepted the SSL certificate that the browser considered invalid. </li>
</ul>
<p>Wow! That was a lot of work. Perhaps the most frustrating part was the lack of accurate documentation. The SipX Wiki has potential, but its articles are frequently out of date, and since they carry no dates or version information, there is no way to know what level of accuracy to expect from any given article. SipFoundry hosts no user forum, just an old-style <a href="http://list.sipfoundry.org/archive/sipx-users/" target="_blank">mailing list</a> with no search function other than Google. Voxilla hosts a sipX forum, but since May 2005 it has garnered a total of 76 threads, most with zero replies. </p>
<p>Somewhere in the middle of all this, I got tired of trying to do it myself and decided to try SipX&#8217;s much-touted <a href="http://sipx-wiki.calivia.com/index.php/Fedora_Live_CD_for_sipX" target="_blank">Live CD</a> to see if SipX was worth pursuing. That page links to the ISO directory where you are supposed to be able to download the Live CD. Unfortunately, as of this writing, there is no Live CD there. </p>
<h1>Running SipX</h1>
<p>Once I was able to start the program, I must say that I was impressed with the UI and functionality. The UI has a nice, integrated feel with all functions available from a series of menus. With that said, I missed being able to monitor basic system performance (CPU and memory usage) from within the UI, and their CentOS build does not install webmin by default. </p>
<p>SipX has done a lot of work on creating the ability to remotely provision some gateways and phones. This requires a DHCP server that has Option 66 to route to the SipX tftp server. Without that kind of DHCP support, the SipX configuration tests fail. I was able to work around this in my test by manually configuring my Linksys SPA-3102 gateway (which isn&#8217;t on their auto-configure list anyway). </p>
<p>Unfortunately, audio quality was not great when used together with the SPA-3102. Calls to voicemail from both the FXS and FXO side of the gateway sounded choppy. I attribute this entirely to running in the Virtual Server environment&#8211;I&#8217;m having similar issues getting FreePBX to run well under Virtual PC. Interestingly, SipX audio quality under Virtual Server is a little better than FreePBX audio quality under Virtual PC. However, SipX&#8217;s CPU usage is higher than FreePBX&#8217;s. </p>
<h1>Closing Thoughts</h1>
<p>If SipX wants to encourage broad testing and use of their system, they need to streamline the installation and documentation, and add better user-to-user support (a forum). However, luring thousands of &#8220;newbies&#8221; to the project probably isn&#8217;t their goal. Maybe one day, communities will grow up around SipX as they have around Asterisk (Trixbox, FreePBX, PBXInAFlash, etc.). In the meantime, my impression is that SipX is a serious project that would take significant effort to learn and implement, but that would scale well and probably be worth the effort in a large installation. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2008/10/testing-sipxecs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

