The Incredible PBX: Remote Phone Meets the Travelin’ Man

Ever wrestled with one of those thorny problems for weeks only to wake up in the middle of the night with the answer? Thus was born Travelin’ Man, a web- based, one-click Asterisk® application that automatically reconfigures your Asterisk PBX to enable remote SIP phone access from your cellphone, iPad, remote PC, NetBook, or desktop telephone.

News Flash: Be sure to read our latest article introducing Travelin’ Man 3, a completely new security methodology based upon FQDN Whitelists and DDNS. In a nutshell, you get set-it-and-forget-it convenience and rock-solid VoIP security for your Cloud-based PBX or any PBX in a Flash server that’s lacking a hardware-based firewall and you get both transparent connectivity and security for your mobile or remote workforce.

If you’ve read the Incredible PBX series of articles on Nerd Vittles, you already know what a thorny problem remote phone access is if you want to preserve the overall security of your server. Indeed, our recommendation has been to leave SIP access closed on your hardware-based firewall because of the dangers inherent in activating remote SIP access. Now we have a better idea!

Today’s new approach works like this. First, we’ll run a little script that secures all of your extensions with permit entries locking down all these connections to the IP address range within your private network. Then we’ll open the SIP and RTP ports on your hardware and software firewalls and map these ports to your Asterisk server’s private IP address. With this setup, no one can attempt remote SIP logins to your server because Asterisk blocks all SIP extension connection attempts except those originating inside your LAN. To manage external phone connections to your server, the install script creates a new virtual Apache web server on your Incredible PBX using port 83. We’ll enable and map TCP port 83 on your hardware and software firewalls to your server as well. Web access with port 83 is limited to running the Travelin’ Man app to activate external phones.

Now we’re ready to set up access to your server for remote devices. For each extension you wish to enable for remote access, we’ll create a special web directory using an obscure, random file name which will serve as the web link for the Travelin’ Man web app. For example, in the diagram above, directory 184778 manages extension 501, directory 2389957h manages extension 701, and directory 6993h5j manages extension 702. This is accomplished by simply changing the extension number in the index.php script stored in each directory.

When one of these web links is accessed remotely, the PHP script will automatically reconfigure Asterisk to enable access to the designated SIP extension on your server using the remote IP address from which the web page was accessed. And, of course, there’s an additional layer of SIP security as well. You still need your extension credentials to actually log in to your server with a softphone to place and receive calls. The Travelin’ Man installation process takes only a couple minutes, and the remote SIP activation procedure takes just a couple seconds each time you want remote access from a different location. Here’s a quick example of how it actually works.

Let’s assume we want to use the new $3.95 Bria SIP softphone on an iPad to connect as extension 501 on our Incredible PBX back at home. The problem is that the dynamic IP address of your iPad changes at each new site on your itinerary. Some locations have WiFi while others only have 3G connections.

First, we’ll generate an icon to run Travelin’ Man from your iPad desktop. Use the same procedure with an iPhone or iPod Touch, and there’s a similar procedure for Android devices.1 You only have to do this once. Start up Safari on the iPad to access the new port 83 web server at the random web address the installer created to support extension 501. That web address is something like this using your own FQDN2: http://myserver.dyndns.org:83/184778. After establishing the link once, we’ll hit the + button in Safari and choose Add to Home Screen. This creates the TravelMan icon on the iPad. See the screenshot below of our demo iPad setup which used extension 221 instead of 501.

Once configured, it’s just two clicks to enable your remote phone anywhere: click once on the TravelMan icon. When your IP address is confirmed, return to your Home Screen and click the Bria softphone icon to establish a SIP connection back to your server. Behind the scenes, the Travelin’ Man application will generate the required permit entry for your remote IP address mapping it to the designated extension on your server, and then it will reload your SIP settings to make your Asterisk server accessible to the Bria softphone in your hotel room. The entire process takes only a couple seconds.

If your company happens to have a dozen traveling salesmen, then you’d simply assign a dedicated extension to each employee and create secure directory names for each person (e.g. 2389957h and 6993h5j in diagram above) with a copy of the Travelin’ Man app configured for that employee’s extension number. Now your entire mobile workforce has connectivity back to the home office from any location on the globe. And, when an employee leaves the company and another arrives, just create a new name for the old employee’s web directory to preserve the security of your system (e.g. 184778 in our example becomes 78hd773). Keep in mind that each time the Travelin’ Man app is run for any extension, it wipes out any previously authorized IP address entry for that extension. Thus, the security of your Incredible PBX is always preserved.

Prerequisites. Before proceeding with today’s install, you must be running a stock install of Incredible PBX with PBX in a Flash behind a properly-secured, hardware-based firewall3. We recommend the latest version of Asterisk 1.4 because it addresses a SIP vulnerability that might cause you problems if malformed SIP packets are targeted at your server. The current release of PBX in a Flash (1.7.5.5 Silver) is ideal, but any version of PBX in a Flash can be brought current with Asterisk using the update-source and update-fixes tools. Travelin’ Man assumes that you have the Incredible PBX base install of extensions: 501 plus 701-715. You can obviously add more or remove some, but you’ll need to manually adjust sip_custom_post.conf to reflect your actual extension list after the install completes.

The installer has been encrypted for your/our own protection. In source form, the script would allow anyone to defeat the Incredible PBX requirement. Doing so would mean the required IPtables security component would not be in place and properly configured to protect the underlying system from attack. So we’ve opted to play Big Brother to avoid potential security problems for all of us down the road. This article clearly explains all the necessary components if some folks want to roll their own version. We just don’t want the responsibility if something goes horribly wrong. As Forrest Gump would say, “Shit Happens.” :-) If you don’t believe it, check out the latest security scramble in the trixbox forums.

Installation. Now we’re ready to get started. So log into your Incredible PBX as root and issue the following commands:

cd /root
wget http://incrediblepbx.com/travelinman.tar.gz
tar zxvf travelinman.tar.gz
./travelinman.x

NOTE: If you’re using PIAF2 with CentOS 6.2, you’ll need to use the updated version of Travelin’ Man because of a syntax change in the Apache config file:

cd /root
wget http://incrediblepbx.com/travelinman2.tar.gz
tar zxvf travelinman2.tar.gz
./travelinman2

The first step in the install procedure is to lock down access to all of your extensions to your private LAN subnet. In case you ever want to do this on another server not running the Incredible PBX, here’s a link to our privip.sh shell script that shows how to do it. This should work on most FreePBX-based Asterisk systems.

Once the extensions are locked down, the script will modify your IPtables and Apache configurations to permit web access on port 83. Next, it will adjust your Asterisk setup to support the Travelin’ Man permit scheme. This involves reworking of sip_custom_post.conf so that permit settings for individual extensions can be stored in files named 501.inc, 701.inc, etc. Finally, the installation procedure will set up a single web site to support extension 501 with a randomized directory name for remote access.4 This setup will be stored in /var/www/travelman. To activate support for additional extensions, you would simply copy the subdirectory giving it a new random name: cp -r dir1 dir2. Then edit config.php in the new subdirectory and change the $extension entry.

To complete the install, you must reconfigure your hardware-based firewall and map the following ports to the private IP address of your server:

TCP 83
UDP 5060
UDP 10000-20000

When the installation is completed, it will show you how to access the new web site for extension 501 using either a fully-qualified domain name or a public or private IP address. Now just follow the steps at the beginning of this article to set up your Android or iDevice, and test things out. Enjoy!

Reminders: Be sure to review the comments to this article and the related support forum thread for a week or two for late-breaking enhancements and issues. Also, Incredible PBX comes preconfigured with call forwarding activated for extension 501. Don’t forget to either disable it or set up a real call forwarding number for extension 501 if you want your cellphone to ring. From any extension on your server, just dial *72501 to set up call forwarding. To cancel call forwarding and pass calls directly to the registered 501 softphone, dial *74 and enter 501. Also be aware that the default RingAll ring group (700) configuration on Incredible PBX systems does not include extension 501. So add 501 if you want your remote extension to ring for incoming calls.


The Incredible PBX: Basic Installation Guide

Adding Skype to The Incredible PBX

Adding Incredible Backup… and Restore to The Incredible PBX

Adding Multiple Google Voice Trunks to The Incredible PBX

Adding Remotes, Preserving Security with Incredible PBX

Continue reading Basic Installation Guide, Part II.

Continue reading Basic Installation Guide, Part III.

Continue reading Basic Installation Guide, Part IV.

Support Issues. With any application as sophisticated as this one, you’re bound to have questions. Blog comments are a terrible place to handle support issues although we welcome general comments about our articles and software. If you have particular support issues, we encourage you to get actively involved in the PBX in a Flash Forums. It’s the best Asterisk tech support site in the business, and it’s all free! We maintain a thread with the latest Patches and Bug Fixes for Incredible PBX. Please have a look. Unlike some forums, ours is extremely friendly and is supported by literally hundreds of Asterisk gurus and thousands of ordinary users just like you. So you won’t have to wait long for an answer to your questions.




Need help with Asterisk? Visit the PBX in a Flash Forum.
Or Try the New, Free PBX in a Flash Conference Bridge.


whos.amung.us If you’re wondering what your fellow man is reading on Nerd Vittles these days, wonder no more. Visit our new whos.amung.us statistical web site and check out what’s happening. It’s a terrific resource both for us and for you.


 
New Vitelity Special. Vitelity has generously offered a new discount for PBX in a Flash users. You now can get an almost half-price DID and 60 free minutes from our special Vitelity sign-up link. If you’re seeking the best flexibility in choosing an area code and phone number plus the lowest entry level pricing plus high quality calls, then Vitelity is the hands-down winner. Vitelity provides Tier A DID inbound service in over 3,000 rate centers throughout the US and Canada. And, when you use our special link to sign up, the Nerd Vittles and PBX in a Flash projects get a few shekels down the road while you get an incredible signup deal as well. The going rate for Vitelity’s DID service is $7.95 a month which includes up to 4,000 incoming minutes on two simultaneous channels with terminations priced at 1.45¢ per minute. Not any more! For PBX in a Flash users, here’s a deal you can’t (and shouldn’t) refuse! Sign up now, and you can purchase a Tier A DID with unlimited incoming calls for just $3.99 a month and you get a free hour of outbound calling to test out their call quality. To check availability of local numbers and tiers of service from Vitelity, click here. Do not use this link to order your DIDs, or you won’t get the special pricing! After the free hour of outbound calling, Vitelity’s rate is just 1.44¢ per minute for outbound calls in the U.S. There is a $35 prepay when you sign up. This covers future usage and any balance is fully refundable if you decide to discontinue service with Vitelity.
 


Some Recent Nerd Vittles Articles of Interest…

Be Sociable, Share!

  1. To create a desktop icon for Travelin’ Man on Android devices, navigate to the link with your browser. Then save the link as a Bookmark by clicking the Star icon in your browser then click Add. Return to the Home Screen and, from the screen on which you wish to add the icon, touch and hold your finger on the screen. When the Add to Home Screen menu appears, choose Shortcuts then Bookmarks and select the link you previously saved. As with iDevices, you only have to do this once. []
  2. FQDN = Fully-qualified domain name []
  3. We recommend the dLink Router/Firewall. Low Cost: $35 WBR-2310  Best: DGL-4500 []
  4. If you’d like to download the web site code independently from the Travelin’ Man install procedure, here’s the link. []

18 Responses to “The Incredible PBX: Remote Phone Meets the Travelin’ Man”

  1. Dave says:

    This is great, and I will be setting it up this afternoon. Do you use robots.txt file to make sure that the directories don’t get indexed by search engines?

    I think it would be nice if the user had to authenticate with a password, when visiting the URL, for an extra level of security.

    WM: Directories won’t get indexed because there is no link to the subdirectories, but robots.txt is now included anyway. If you want password authentication for the directories, issue the script commands below which will honor all existing passwords on your system as well as any new ones you create using this command:

    htpasswd /usr/local/apache/passwd/wwwpasswd username

    Script to Activate Password-Protected Web Sites:

    cd /etc/pbx/httpdconf
    mv travelman.conf /root/.
    wget http://incrediblepbx.com/travelman.conf
    service httpd restart

  2. Jake says:

    Genius! This is just perfect. I have been wanting a solution for secure remote extensions and you have come up with it.

  3. Joshua Welch says:

    Okay, I’m sorry to be stupid, but does fail2ban also work on iax2 and sip connections?

    I was lead to believe it did by this article. And a quote from the article that says:

    “Just recently, we’ve added the latest release of Fail2Ban to all PBX in a Flash systems using our software update service. Fail2Ban blocks SIP and IAX attacks which are becoming more and more prevalent by locking IP addresses out of your server for a specified period of time whenever a designated number of invalid passwords are submitted.”

    … saying its from NerdUno himself. Can you clear this up???

    [WM: Yep. Fail2Ban is there. Problem is that it reads your logs to work its magic. And with some high-speed computer attacks (e.g. Amazon S3), there can be thousands of attempts on your system before your poor little machine ever gets a sufficient processor time slice to read its log. In short, Fail2Ban is not real-time while Asterisk permit restrictions are. So permit restrictions are one more arrow for your security quiver if you choose to allow SIP or IAX connections to your system.]

  4. Dave Holowiski says:

    Thanks for the reply with the info on how to password protect the directories. That puts my mind at ease, and I’ll be setting this up on my system tonight. Thanks!

  5. Amygrant says:

    Ward, seriously… you are the greatest thing since sliced bread. Actually, I think you are even better!

    This is exactly something I was looking for. Thank you very much!

  6. Dave says:

    Slightly off topic question – any idea where I can get a ‘vanity’ toll free DID? I have 2 DID’s with Vitelity (used your signup link) but they seem to have a very limited selection of toll free DID’s.

  7. Steve Peterson says:

    Just wanted to say thanks for doing this. I finally did get it working. Running iPhone4 and the Bria for iPhone client. Initially had no audio. got a D-Link and that seemed to fix it (per Ward’s recommendation) Thank you very much.

  8. Carlos says:

    Should Google Voice integration work on the Bronze load? It does not work for me, but it works fine on the Silver load.

    [WM: Bronze is Asterisk 1.6. If you're using Incredible PBX and chose the Asterisk 1.6 option, you should be fine. If you manually installed Google Voice, then you'll need to change the piping | characters to commas in extensions_custom.conf and restart Asterisk. 64-bit shouldn't matter.]

  9. gv says:

    For setting-up the softphone on iphone, what password do i have to use? i followed the instructions and i have everythng sets, however i am unable to connect remotely using my iphone with acrobits or mixphone softphone. it works fine when connected locally but no luck on remotely using my at&t data plan.

    example:
    username: 701
    password: ?
    server: my server’s ipaddress

    [WM: Use your password for extension 701. It's stored in FreePBX in the secret field for that extension.]

  10. Craig says:

    Couldnt you do the same thing using hamachi?

  11. Robert says:

    Quick question. When this is run and I do iptables -L it loses all the fail2ban rules. For now, I simply modified your index.php and placed an additional…

    exec(‘sudo /etc/init.d/fail2ban restart’);

    This adds the rules back in. Is this necessary or even a bad thing to do?

  12. ward says:

    A major SIP security vulnerability was discovered in all versions of Asterisk today. You can read all about it here.

    We have developed a script which will quickly patch your Asterisk 1.8.x system and eliminate the problem. Log into your server as root and issue the following commands:

    cd /root
    wget http://incrediblepbx.com/sipfix
    chmod +x sipfix
    ./sipfix

    Please apply this patch immediately to protect your server!

  13. James says:

    How do I uninstall this software.

    [WM: Remove the entries from sip_custom_post.conf in /etc/asterisk. Then delete travelman.conf from /etc/pbx/httpdconf. Then restart Apache (service httpd restart) and Asterisk (amportal restart).]

  14. ward says:

    For a dynamic approach using DynDNS, take a look at this recent article on the Michigan Telephone blog.

  15. steve says:

    Getting “Stopped” error when executing. This is a new install as of 1/17/2012. I had to install Incredible PBX 3 because I couldn’t get the 2.0 executable to work. Not sure where to look for errors.

    A previous install of Travelin’ Man on an older Incredible PBX setup some months back went without a hitch. Not sure what’s up with this new install.

    Is there any documention on how to manually implement Travelin’ Man? I still have access to the install from the old machine.

    PIAF Installed Version = 2.0.6.2 Running on *HARDWARE*
    FreePBX Version = 2.9.0.7
    Running Asterisk Version = 1.8.8.0
    Asterisk Source Version = 1.8.8.0
    Dahdi Source Version = 2.6.0+2.6.0
    Libpri Source Version = 1.4.12
    Operating System = CentOS release 6.2 (Final)
    Kernel Version = 2.6.32-220.2.1.el6.i686 – 32 Bit
    Incredible PBX 3 Version = 3.0.3

  16. Ward Mundy says:

    For the latest WhiteList solution for remote phones with dynamic IP addresses, see this thread on the PIAF Forums: http://nerd.bz/wtponq

  17. Chris Lewis says:

    I have been using the incredible pbx 3.0. Absolutly love it. I finally got the Travelin’ Man to work remotely on a 3G iPhone with fqdn.dyndns.org:83/33333. I have read all the postings regarding how to add another extension to my network. I went in to config Edit 501 has my iPhone IP now extension 701 i entered the other ip of that phone. My problem is how do i get the 2 nd iphone to add the travelin man application with extension 701. I am assuming it’s fqdn.dyndns.org:81/with a new random 5 digits. I have been trying to do this for 1 month and i don’t get it. i thought once you went in to configEdit and edit extension 701 it will generate the 5 digits. I would greatly aprreciate any help.

    [WM: Head to the forums for some help.]

  18. spacemind says:

    Hum..

    Why the need to have open ports to pbx server ???

    The best option is to setup a light vpn server and connect by vpn to home router/pbx server instead of get a few ports opened at router.

    Openvpn works very good in raspberry pi with low resources, poptop also works great but the encryptation is very poor.

    It would be nice to see PBX in a Flash with an addon for VPN server, to create and manage vpn accounts.

    http://www.raspberrypi.org/phpBB3/viewtopic.php?t=20916

    [WM: Huh? Where have you been? We've supported VPNs as far back as the Hamachi days. Currently we recommend NeoRouter and PPTP VPNs as the easiest to set up. But OpenVPN has been documented as well for years. We also have a stand-alone VPN in a Flash server that can be installed from any of the PIAF2 ISOs. And Incredible PBX includes turnkey NeoRouter and PPTP VPNs out of the box. Finally, Incredible PBX for Raspberry Pi supports NeoRouter and PPTP VPNs as well. Either can be configured in less than 5 minutes.]

Leave a Reply

Ringbinder theme by Themocracy