<?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; freepbx</title>
	<atom:link href="http://www.mcbsys.com/techblog/tag/freepbx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mcbsys.com/techblog</link>
	<description>Custom Software and I.T. Services</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:58:19 +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>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>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>
	</channel>
</rss>

