<?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; piaf</title>
	<atom:link href="http://www.mcbsys.com/techblog/tag/piaf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mcbsys.com/techblog</link>
	<description>Custom Software and I.T. Services</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:53:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linksys SPA942 Busy Lamp Field with PiaF</title>
		<link>http://www.mcbsys.com/techblog/2011/11/linksys-spa942-busy-lamp-field-with-piaf/</link>
		<comments>http://www.mcbsys.com/techblog/2011/11/linksys-spa942-busy-lamp-field-with-piaf/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 20:37:27 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2011/11/spa942-busy-lamp-field-with-piaf/</guid>
		<description><![CDATA[A client has an old PBX in a Flash 1.3 installation running Asterisk 1.4.21.2. I’ve upgraded their Linksys SPA942 phones to the latest firmware, version 6.1.5(a). Can we get Busy Lamp Field (BLF) functionality to work on the empty line keys?

This post has a concise guide to SPA942 BLF configuration:
How to configure BLF with a [...]]]></description>
			<content:encoded><![CDATA[<p>A client has an old PBX in a Flash 1.3 installation running Asterisk 1.4.21.2. I’ve upgraded their Linksys SPA942 phones to the latest firmware, version 6.1.5(a). Can we get Busy Lamp Field (BLF) functionality to work on the empty line keys?</p>
<p><span id="more-1038"></span></p>
<p>This post has a concise guide to SPA942 BLF configuration:</p>
<p><a href="http://www.adrianandgenese.com/blogger/2011/02/15/how-to-configure-blf-with-a-linksys-spa942-and-asterisk-1-4/">How to configure BLF with a Linksys SPA942 and Asterisk 1.4</a></p>
<p>I found that I didn’t have to change the PBX in a Flash (PiaF) setup of Asterisk at all. To monitor extension 203, I just made these changes to <strong>Phone</strong> tab of the phone used by extension 200:</p>
<p><a href="http://www.mcbsys.com/techblog/wp-content/uploads/2011/11/SPA942-BLF.png" target="_blank"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="SPA942 BLF" src="http://www.mcbsys.com/techblog/wp-content/uploads/2011/11/SPA942-BLF_thumb.png" border="0" alt="SPA942 BLF" width="554" height="161" /></a></p>
<h4>Notes</h4>
<ul>
<li>The <strong>Extension</strong> is <strong>Disabled</strong> and <strong>Shared Call Appearance</strong> is <strong>private.</strong></li>
<li>The extension being monitored does <em>not</em> need to be defined on an <strong>Ext</strong> tab on the “remote” phone. So if the admin is on 200 and is monitoring 203, the admin does not need 203 defined on an <strong>Ext</strong> tab.</li>
<li>The <strong>Short Name</strong> appears next to the line key when the phone is on hook.</li>
<li>The <strong>Extended Function</strong> looks like this:<br />
<code>fnc=blf+sd+cp;sub=203@$PROXY;ext=203@$PROXY</code></p>
<ul>
<li>blf = Busy Lamp Field</li>
<li>sd = Speed Dial</li>
<li>cp = Call Pickup</li>
</ul>
</li>
</ul>
<h4>Issues</h4>
<ul>
<li>The BLF function does work. However, when the line is off hook, the Short Names are not shown. So users would have to remember which line key is for whom, or use physical labels to identify the lines.</li>
<li>A quick test of transferring a call with the button failed. It could be that that requires some of the Asterisk-side modifications. I didn’t pursue this.</li>
<li>BLF subscriptions may not be supported by a hosted PBX solution, where you register each extensions directly with the external provider. Since most other functions are available in a hosted solution (e.g. <a href="http://voip.ms" target="_blank">voip.ms</a>), it may come down to whether it is worth running an in-house Asterisk server just to have BLF.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2011/11/linksys-spa942-busy-lamp-field-with-piaf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Asterisk to Use the G.729a Codec</title>
		<link>http://www.mcbsys.com/techblog/2011/11/get-asterisk-to-use-the-g-729a-codec/</link>
		<comments>http://www.mcbsys.com/techblog/2011/11/get-asterisk-to-use-the-g-729a-codec/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 06:37:19 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[piaf]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2011/11/get-asterisk-to-use-the-g-729a-codec/</guid>
		<description><![CDATA[I’m using Asterisk 1.8.5 under FreePBX 2.8.1.4. My endpoints (Polycom IP430 phone, SPA3102 ATA) and my ITSP all support the G.729a codec. I wanted to test audio quality using this compressed codec.

G.729a requires that you purchase a license if you are converting (transcoding) the audio to another codec. Although the licenses are inexpensive, I preferred [...]]]></description>
			<content:encoded><![CDATA[<p>I’m using Asterisk 1.8.5 under FreePBX 2.8.1.4. My endpoints (Polycom IP430 phone, SPA3102 ATA) and my ITSP all support the <a href="http://en.wikipedia.org/wiki/G.729" target="_blank">G.729a codec</a>. I wanted to test audio quality using this compressed codec.</p>
<p><span id="more-1016"></span></p>
<p>G.729a requires that you purchase a license if you are converting (transcoding) the audio to another codec. Although the licenses are inexpensive, I preferred to avoid the overhead of transcoding by simply <a href="http://www.voip-info.org/wiki/view/Asterisk+G.729+pass-thru" target="_blank">passing through</a> the G.729a packets.</p>
<p>“Passing through” means that both legs of the call must use G.729a. At first I hoped to be able to use the standard ulaw (G.711u) codec for all calls except those going to my ITSP. However, I eventually found that if the first leg of a call prefers ulaw, and the second leg requires G.729a, Asterisk will not go back and reinvite the first leg using G.729a (see my comment in <a href="http://www.freepbx.org/forum/freepbx/users/force-g729-codec-at-endpoint-phone-on-outbound-sip-trunk#comment-43130" target="_blank">this thread</a>). Bottom line:&nbsp; we need to set up the PBX to use G.729a on <em>all</em> calls, internal and external.</p>
<h3>Setting It Up</h3>
<p>Once that was clear, the setup was fairly simple:</p>
<ol>
<li>Download the current g729 sound files from <a href="http://downloads.asterisk.org/pub/telephony/sounds/" target="_blank">Digium</a>:<br />
<code>asterisk-core-sounds-en-g729-current.tar.gz<br />
asterisk-extra-sounds-en-g729-current.tar.gz</code><br />
These are required for the voicemail system to work after converting to G.729.</li>
<li>On the Asterisk machine, under <code>/var/lib/asterisk/sounds</code>, rename the <code>en</code> directory to <code>en.gsm</code>.</li>
<li>Create a new <code>en</code> directory and extract the new sounds there. Recursively change the group and Owner to <strong>asterisk</strong> and the permissions to <strong>775</strong> to match the original “en” directory.</li>
<li>In the FreePBX admin panel, go to <strong>Tools &gt; Config Edit</strong>. Add the following lines to sip_general_custom.conf:<br />
<code>disallow=all<br />
allow=g729<br />
allow=ulaw<br />
allow=alaw<br />
allow=gsm</code><br />
That puts g729 as the first priority for the whole system.</li>
<li>From the console, open the Asterisk CLI (<strong>asterisk –r</strong>). Make a call and type <strong>sip show channels</strong>. You should see the g729 codec on both legs of the call, whether you call internally or externally. Do try all combinations to make sure that G.729a is supported throughout. If not, the call will fail and you’ll see a corresponding message in the log (Tools &gt; Asterisk Logfiles). (Or if you a the G.729a license, the call will succeed but will be transcoded.)</li>
</ol>
<h3>Update:&nbsp; Still Need to Transcode</h3>
<p><span style="color: #0000ff;"><strong>November 5, 2011:</strong></span> Alas, not as easy as I thought. The above did set up G.729a pass-through on outbound calls. However, some problems remained:</p>
<ul>
<li>Inbound calls through the SPA3102 were still in G.711u format. Since Asterisk tried to use G.729a for the second leg, the call failed without a transcoder. Changing the SPA3102’s Preferred Codec to G729a solved that problem.</li>
<li>Voicemail greetings are not available in .g729 format. Converting from .WAV to .g729, or even creating new greetings in .g729, seems to require a transcoder.</li>
<li>Voicemail messages are not stored in .g729. This can be remedied by adding g729 to the list of formats in <code>voicemail.conf</code>, but still seems to have trouble without a transcoder.</li>
<li>Rod Montgomery, Directory of Services at Digium, writes in <a href="http://www.fonality.com/trixbox/forums/trixbox-pro/trixbox-pro-help/do-we-need-install-g729-if-we-want-use-it" target="_blank">this thread</a> that without a transcoder, Asterisk will not be able to process audio, e.g. DTMF codes for IVR and voicemail. I’m not sure about this one—it seemed to handle the DTMF when I called internally anyway.</li>
</ul>
<p>Bottom line, it still makes sense to set up pass-through for actual phone calls, but there are so many places that audio conversion is needed that it makes sense to get the transcoder. As Mr. Montgomery says in the post linked above, you only need as many licenses as you have simultaneous channels doing transcoding. So if you are making all calls in pass-through mode, you only need a few licenses for receiving and accessing voicemail, and possibly for IVR.</p>
<p>Info on transcoder licensing is available <a href="http://www.voip-info.org/wiki/view/Asterisk+G.729+Licensing" target="_blank">here</a>. For testing purposes, open-source binaries are available <a href="http://asterisk.hosting.lv/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2011/11/get-asterisk-to-use-the-g-729a-codec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerEdge 1500SC: Bogus Memory and Linux Errors</title>
		<link>http://www.mcbsys.com/techblog/2010/11/poweredge-1500sc-bogus-memory-and-linux-errors/</link>
		<comments>http://www.mcbsys.com/techblog/2010/11/poweredge-1500sc-bogus-memory-and-linux-errors/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 23:57:33 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[piaf]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/2010/11/poweredge-1500sc-bogus-memory-and-linux-errors/</guid>
		<description><![CDATA[Sometimes the trickiest errors are the ones you should ignore.
I’m running PBX in a Flash, based on CentOS 5.2, on a Dell PowerEdge 1500SC. Back in February, I got a segmentation fault error and after some discussion on the PBX in a Flash forum, concluded that I needed to replace the hardware or at least [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the trickiest errors are the ones you should ignore.</p>
<p>I’m running <a href="http://www.pbxinaflash.com/" target="_blank">PBX in a Flash</a>, based on CentOS 5.2, on a Dell PowerEdge 1500SC. Back in February, I got a segmentation fault error and after some discussion on the PBX in a Flash <a href="http://pbxinaflash.com/forum/showthread.php?p=39934#post39934" target="_blank">forum</a>, concluded that I needed to replace the hardware or at least the memory. Now I’m not so sure.</p>
<p><span id="more-506"></span></p>
<p>For one thing, the server has been running without issues for the last eight months. Is it really on its last legs? Let’s do some checking.</p>
<h3>Memory Errors</h3>
<p>I ran <a href="http://www.memtest.org/" target="_blank">MemTest86+</a> 4.00 and Microsoft’s <a href="http://oca.microsoft.com/en/windiag.asp" target="_blank">Windows Memory Diagnostic</a> on the machine. Both of them report errors. Interesting thing is that if 1GB of RAM is installed, MemTest86+ reports an error at 1023.9MB; if I remove those DIMMs and install 256MB, it reports an error at 255.9MB. So it’s more like it doesn’t like the memory controller.</p>
<p>Sure enough, the Dell MPMemory diagnostics, part of Dell’s bootable <a href="http://support.dell.com/support/downloads/format.aspx?c=us&amp;cs=04&amp;l=en&amp;s=bsd&amp;deviceid=196&amp;libid=13&amp;releaseid=R102625&amp;vercnt=5&amp;formatcnt=0&amp;SystemID=PWE_PNT_P3C_1500_SC&amp;servicetag=HF98T11&amp;os=WNET&amp;osl=en&amp;catid=-1&amp;dateid=-1&amp;typeid=-1&amp;formatid=-1&amp;impid=-1&amp;checkFormat=true" target="_blank">32 Bit Diagnostics</a> CD, find no errors in the 1GB of memory, even after five passes. A Dell tech support rep confirmed that those diagnostics should be giving an accurate read on the PowerEdge 1500SC.</p>
<h3>agpgart Errors</h3>
<p>The next thing that concerned me were some errors that occurred on startup.</p>
<p>Fairly early in the boot sequence, there are some agpgart errors, retrieved here in their entirety from the <code>dmesg</code> command:</p>
<p><code>Linux agpgart interface v0.101 (c) Dave Jones<br />
agpgart: unable to determine aperture size.<br />
agpgart: agp_backend_initialize() failed.<br />
agpgart-serverworks: probe of 0000:00:00.0 failed with error -22<br />
agpgart: unable to determine aperture size.<br />
agpgart: agp_backend_initialize() failed.<br />
agpgart-serverworks: probe of 0000:00:00.1 failed with error -22<br />
agpgart: ServerWorks CNB20HE is unsupported due to lack of documentation.<br />
agpgart: ServerWorks CNB20HE is unsupported due to lack of documentation.</code></p>
<p>As the Dell tech pointed out, agpgart has to do with video drivers. Apparently CentOS doesn’t recognize the on-board video driver in the server. But the video works fine (all I need is command-line), so I can ignore these errors.</p>
<h3>hda Errors</h3>
<p>These hda errors were actually a bigger concern:</p>
<p><code>hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }<br />
hda: media error (bad sector): error=0x30 { LastFailedSense=0x03 }<br />
ide: failed opcode was: unknown<br />
ATAPI device hda:<br />
&nbsp; Error: Medium error -- (Sense key=0x03)<br />
&nbsp; (reserved error code) -- (asc=0x11, ascq=0x05)<br />
&nbsp; The failed "Read 10" packet command was:<br />
&nbsp; "28 00 00 00 00 10 00 00 02 00 00 00 00 00 00 00 "<br />
end_request: I/O error, dev hda, sector 64<br />
Buffer I/O error on device hda, logical block 8<br />
hda: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }<br />
hda: media error (bad sector): error=0x30 { LastFailedSense=0x03 }<br />
ide: failed opcode was: unknown<br />
ATAPI device hda:<br />
&nbsp; Error: Medium error -- (Sense key=0x03)<br />
&nbsp; (reserved error code) -- (asc=0x11, ascq=0x05)<br />
&nbsp; The failed "Read 10" packet command was:<br />
&nbsp; "28 00 00 00 00 06 00 00 0a 00 00 00 00 00 00 00 "<br />
end_request: I/O error, dev hda, sector 24<br />
Buffer I/O error on device hda, logical block 3<br />
Buffer I/O error on device hda, logical block 4<br />
Buffer I/O error on device hda, logical block 5<br />
Buffer I/O error on device hda, logical block 6<br />
Buffer I/O error on device hda, logical block 7</code></p>
<p>Is a hard drive failing? Or maybe the file structure is corrupt?</p>
<p>The server uses a RAID 5 array of SCSI disks attached to a PERC 3SC controller. First, from the RAID BIOS, I checked the status of each physical disk to see if any disk errors had been recorded. Nope.</p>
<p>Then, again using the Dell 32 Bit Diagnostics CD, I ran the GUI Diagnostics to test the hard drives. They all passed fine (short test only).</p>
<p>Wait a second. What disk is hda anyway? Following some tips in <a href="http://ubuntuforums.org/showthread.php?t=462010" target="_blank">this post</a>, after booting into CentOS, <code>fdisk –l</code> shows I have two “drives” (logical drives from the RAID controller’s perspective):&nbsp; sda and sdb. So hda is <em>not</em> one of the hard logical hard drives used by CentOS.</p>
<p>According to <a href="http://en.wikipedia.org/wiki//dev/hda" target="_blank">Wikipedia</a>, “/dev/hda is the path to the block device node of the first IDE device,” which if the system does not use IDE hard drives is often the optical drive. Sure enough, when I follow the link \dev\cdrom, it tries to read \dev\hda.</p>
<p>I have a bootable <a href="http://www.sysresccd.org" target="_blank">SystemRescueCD</a> in the CD-ROM drive at all times (so I can use the Dell Remote Access Card to remotely format drives and restore a backup if necessary). Apparently that has some read errors during bootup, but that only means a bad CD or at worst a bad CD-ROM drive. So it looks like I can ignore these hda errors as well. (In fact, after going to the client site and replacing the SystemRescueCD with a fresh copy, the hda errors stopped and I can boot from the CD.)</p>
<p>Maybe this old PowerEdge is good for a while longer after all!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2010/11/poweredge-1500sc-bogus-memory-and-linux-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Daily Delete Job with Logwatch</title>
		<link>http://www.mcbsys.com/techblog/2010/06/linux-daily-delete-job-with-logwatch/</link>
		<comments>http://www.mcbsys.com/techblog/2010/06/linux-daily-delete-job-with-logwatch/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 21:00:37 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[logwatch]]></category>
		<category><![CDATA[piaf]]></category>

		<guid isPermaLink="false">http://www.mcbsys.com/techblog/?p=174</guid>
		<description><![CDATA[I have PBX in a Flash set up to create a daily backup and FTP the file to a Windows server. But how do I get rid of the old backups on the Linux machine, which is running CentOS 5.2? A cron job can do the deletes, but I also want a list of the [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/" target="_blank">PBX in a Flash</a> set up to create a daily backup and FTP the file to a Windows server. But how do I get rid of the old backups on the Linux machine, which is running CentOS 5.2? A cron job can do the deletes, but I also want a list of the deleted files delivered with my daily Logwatch 7.3 report.</p>
<p>Here’s what I did:</p>
<p><span id="more-174"></span></p>
<p>1. Create the file /etc/cron.daily/dailydelete containing the command below to delete backup files over 30 days old (thanks <a href="http://www.linuxquestions.org/questions/linux-newbie-8/delete-files-older-than-30-days-using-cronjob-333477/" target="_blank">Matir</a>). It logs output to /var/log/dailydelete.log. Customize <em>backupname</em> to your FreePBX backup name. Change permissions on this file to 0755 to make it executable. In Webmin, check System &gt; Scheduled Cron Jobs:&nbsp; the file should automatically be included in the daily cron schedule.</p>
<p>Important: <strong>Omit the –delete action during testing! </strong>Add –delete once you are sure you are targeting the correct files.</p>
<p style="padding-left: 30px;">find /var/lib/asterisk/backups/<em>backupname</em> –mtime +30 -print -delete &gt; /var/log/dailydelete.log</p>
<p>2. Create the directory /etc/logwatch/scripts/services.</p>
<p>3. Create the file /etc/logwatch/scripts/services/dailydelete with this content:</p>
<p style="padding-left: 30px;">###########################################################################<br />
# $Id: dailydelete, 2010/06/07 Mark Berry MCB Systems Exp $<br />
# Adapted from arpwatch, the simplest service script I could find.<br />
###########################################################################</p>
<p style="padding-left: 30px;">my $Detail = $ENV{&#8216;LOGWATCH_DETAIL_LEVEL&#8217;} || 0;</p>
<p style="padding-left: 30px;">while (defined($ThisLine = &lt;STDIN&gt;)) {<br />
&nbsp;&nbsp; chomp($ThisLine);<br />
&nbsp;&nbsp; next if ($ThisLine eq &#8220;&#8221;);<br />
&nbsp;&nbsp; $dailydelete{$ThisLine}++;<br />
}</p>
<p style="padding-left: 30px;"># Next line changed to work on _any_ Detail level (0 and higher)<br />
if ( ($Detail &gt;= 0) and (keys %dailydelete) ) {<br />
&nbsp;&nbsp; print &#8220;\n&#8221;;<br />
&nbsp;&nbsp; foreach $ThisOne (sort {$a cmp $b} keys %dailydelete) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print $ThisOne . &#8220;\n&#8221;;<br />
&nbsp;&nbsp; }<br />
}</p>
<p style="padding-left: 30px;">exit(0);</p>
<p>4. Create the file /etc/logwatch/conf/logfiles/dailydelete.conf with this content. Note that we are not filtering on date since there is no date stamp in the log file:</p>
<p style="padding-left: 30px;">################################################################<br />
# $Id: dailydelete.conf, 2010/06/07 Mark Berry MCB Systems Exp $<br />
################################################################</p>
<p style="padding-left: 30px;"># What actual file?  Defaults to LogPath if not absolute path&#8230;.<br />
LogFile = dailydelete.log</p>
<p style="padding-left: 30px;"># If the archives are searched, here is one or more line<br />
# (optionally containing wildcards) that tell where they are&#8230;<br />
#If you use a &#8220;-&#8221; in naming add that as well -mgt<br />
Archive = dailydelete.log.*</p>
<p style="padding-left: 30px;"># Expand the repeats (actually just removes them now)<br />
#*ExpandRepeats</p>
<p style="padding-left: 30px;"># Keep only the lines in the proper date range&#8230;<br />
#*OnlyHost<br />
#*ApplyStdDate</p>
<p>5. Create the file /etc/logwatch/conf/services/dailydelete.conf with this content:</p>
<p style="padding-left: 30px;">#################################################################<br />
# $id: dailydelete.conf, 2010/06/07 Mark Berry MCB Systems Exp $<br />
#################################################################</p>
<p style="padding-left: 30px;">Title = &#8220;dailydelete&#8221;</p>
<p style="padding-left: 30px;"># Which logfile group&#8230;<br />
LogFile = dailydelete</p>
<p>Now if all goes well, you should see a dailydelete section in your daily Logwatch email telling you which files have been deleted (should be one per day). Make sure the file date increments from one day to the next:</p>
<p style="padding-left: 30px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; dailydelete Begin &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="padding-left: 30px;">/var/lib/asterisk/backups/FreePBXBackup/20100506.06.45.01.tar.gz</p>
<p style="padding-left: 30px;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- dailydelete End &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Notes:</p>
<ul>
<li>The main Logwatch files are in /usr/share/logwatch. The /etc/logwatch files are for customizations/overrides.</li>
<li>To test Logwatch on today&#8217;s files rather than yesterday&#8217;s, add this line to /etc/logwatch/conf/logwatch.conf:</li>
</ul>
<p style="padding-left: 60px;">Range = today</p>
<ul>
<li>To test (remember to remove &#8220;-delete&#8221;), run these two commands:</li>
</ul>
<p style="padding-left: 60px;">/etc/cron.daily/dailydelete<br />
/etc/cron.daily/0logwatch</p>
<ul>
<li>Remember to add &#8220;-delete&#8221; to the dailydelete job and comment out &#8220;Range = today&#8221; when you are done testing.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2010/06/linux-daily-delete-job-with-logwatch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PBX in a Flash as a Virtual Machine, Take 2: Hyper-V</title>
		<link>http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/</link>
		<comments>http://www.mcbsys.com/techblog/2010/02/pbx-in-a-flash-as-a-virtual-machine-take-2-hyper-v/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 20:21:20 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[hyper-v]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pbx]]></category>
		<category><![CDATA[pbx in a flash]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>

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

		<guid isPermaLink="false">/mark/post/Using-an-APC-UPS-with-PBX-in-a-Flash.aspx</guid>
		<description><![CDATA[Today a client had a power outage. Although the PBX in a Flash (PiaF) server was on an Uninterruptible Power Supply (UPS), the outage lasted long enough that the PiaF server crashed. Twice. Time to brave the waters of installing UPS monitoring software under Linux.
The version of PiaF that I&#8217;m using is based on CentOS [...]]]></description>
			<content:encoded><![CDATA[<p>Today a client had a power outage. Although the <a href="http://www.pbxinaflash.com/" target="_blank">PBX in a Flash</a> (PiaF) server was on an Uninterruptible Power Supply (UPS), the outage lasted long enough that the PiaF server crashed. Twice. Time to brave the waters of installing UPS monitoring software under Linux.</p>
<p>The version of PiaF that I&#8217;m using is based on CentOS 5.2, which is derived from Red Hat Enterprise Linux 5.2. <a href="http://www.apcc.com/products/family/index.cfm?id=125" target="_blank">APC PowerChute Business Edition</a> supports Linux if you are using their higher-end SmartUPS line, but there is no support for BackUPS-type UPSs.</p>
<p><span id="more-44"></span></p>
<p>Google and open source to the rescue! It didn&#8217;t take long to find the <a href="http://www.apcupsd.org/" target="_blank">APC UPS Daemon</a>, also called apcupsd. What did take a while was figuring out which version I needed and how to get it installed and working. Fortunately there is an extensive and well-written manual. Here is a summary of the steps I took to get it running:</p>
<ol>
<li>Although I won&#8217;t be using SNMP, the pre-built &#8220;rpm&#8221; binary for apcupd requires that SNMP be installed. Log on to the PiaF box (I use <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">Putty</a>) and run this command to install it:<br />
<code>yum install net-snmp</code></li>
<li>Download the appropriate installation binary from <a title="http://sourceforge.net/project/showfiles.php?group_id=54413" href="http://sourceforge.net/project/showfiles.php?group_id=54413" target="_blank">SourceForge</a>. I decided that I needed <code>apcupsd-3.14.5-1.el5.i386.rpm</code>, the version for x86 processors and Enterprise Linux 5. I used <a href="http://winscp.net/eng/index.php" target="_blank">WinSCP</a> to copy that to a new folder on my PiaF machine called <code>/usr/src/apcupsd</code>.</li>
<li>On the PiaF box, run the following commands to install the apcupsd software:<br />
<code>cd /usr/src/apcupsd<br />
rpm -ivh apcupsd-3.14.5-1.el5.i386.rpm </code></li>
<li>Now edit the file <code>/etc/apcupsd/apcupsd.conf</code> and test your configuration. There are some instructions in the conf file itself, but you&#8217;ll probably want to refer to the <a href="http://www.apcupsd.org/manual/apcupsd.pdf" target="_blank">manual</a>, starting with the &#8220;After Installation&#8221; section. My local PBX is actually connected as a &#8220;dumb&#8221; slave to a SmartUPS, a fairly unusual arrangement. For that, I found the following configuration options seem to work (only showing the non-default entries):<br />
<code>UPSCABLE 940-0020B</code> # Cable number from the end of the gray, dumb signaling cable<br />
<code>UPSTYPE dumb</code><br />
<code>DEVICE /dev/ttyS1</code> # ttyS0 = COM1; ttyS1 = COM2<br />
<code>TIMEOUT 900</code> # Needed for dumb signaling. I allow a fixed 15 minutes before shutdown.<br />
<code>UPSCLASS shareslave</code> # Because we are connected on the &#8220;dumb&#8221; side of a ShareUPS card.<br />
<code>UPSMODE disable</code> # The default. I think this would only&nbsp; be &#8220;share&#8221; if we were a &#8220;sharemaster&#8221;</li>
</ol>
<p>While testing this, I saw that apcupsd tried to shut down my UPS, which would have been bad since my Small Business Server is connected to the same UPS. The dumb signaling apparently prevented this level of control, so no UPS shutdown occurred, but to be safe, I followed the advice in the manual and commented out the lines added by apcupsd to <code>/etc/rc.d/init.d/halt</code>. They&#8217;re easy to spot&#8211;they all end in # <code>***apcupsd***</code>.</p>
<p><span style="color: #0000ff;"><strong>Update September 16, 2011</strong></span> Added to another PiaF box today. Current version is <code>apcupsd-3.14.8-1.el5.i386.rpm</code>. This time I&#8217;m using a USB cable on a BackUPS unit, so I was able to keep most of defaults in the <code>apcupsd.conf</code> file. The <a href="http://www.apcupsd.org/manual/apcupsd.pdf" target="_blank">manual</a> has helpful instructions for post-installation testing. Useful status/testing commands:</p>
<p><code>apcaccess</code> &#8211; show current UPS status, battery percent remaining, etc.<br />
<code>service apcupsd stop</code> &#8211; stop the daemon, required before <code>apctest</code><br />
<code>apctest</code> &#8211; menu of commands e.g. self-test, alarm mode, etc.<br />
<code>service apcupsd start</code> &#8211; (re)start the daemon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcbsys.com/techblog/2009/03/using-an-apc-ups-with-pbx-in-a-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping Asterisk Traffic Inside the VPN</title>
		<link>http://www.mcbsys.com/techblog/2009/01/keeping-asterisk-traffic-inside-the-vpn/</link>
		<comments>http://www.mcbsys.com/techblog/2009/01/keeping-asterisk-traffic-inside-the-vpn/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 16:38:11 +0000</pubDate>
		<dc:creator>Mark Berry</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[dtmf]]></category>
		<category><![CDATA[piaf]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[vpn]]></category>

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

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

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

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

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

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

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

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

