Tom Keating, whose column is one of our must-reads each week, recently wrote a piece about the new Area775 service. In a nutshell, this service attempts to merge the VoIP world with cellphones by giving you one number which simultaneously rings both your cell phone and your IP phone when you receive an incoming call. It also lets you transfer calls from your IP phone to your cellphone and receive your voice mail messages via email. Any of this sound familiar? The only gotcha with the Area775 "free" service is that calls you answer on your cell phone cost you $2 ... each unless you pay a $3.95 monthly fee. Ouch!

For those who have deployed a free Asterisk@Home 2.5 PBX or the new VMware version of Asterisk@Home on your Windows desktop, today we're going to walk you through configuring it to do the same thing at no cost using an IP phone and a phone number in New York or for about a penny a minute for calls answered on your cellphone. If you prefer unlimited incoming and outgoing calls in your area code ($9.95) or throughout the U.S. ($14.95) with no per minute fees, you still can't beat TelaSIP. And our previous column has already demonstrated all the neat CallerID stunts you can perform with a TelaSIP line. If you always wanted to be a Baby Bell, here's your chance.

But, we've digressed. Today, we're going to take the low road and show just how inexpensively you can deploy Follow-Me Roaming or, more accurately, One-Number Roaming using Asterisk@Home. First, you need a phone number to accept incoming calls. Then you'll need an outbound trunk so that calls can be relayed to your cellphone. Finally, we'll show you how to configure Asterisk@Home to either ring your local extensions and your cellphone(s) simultaneously or in a particular order. And, of course, you can transfer calls to your cellphone in a flash. We'll show you how.

Signing Up for a StanaPhone Number. Before you can receive incoming calls from Plain Old Telephones, you'll need a phone number. StanaPhone will give you one for free with a New York area code. Using a Windows PC, head over to StanaPhone.com, sign up for an account, and download their softphone. Once you receive your account number and password, log into their service with the softphone and sign up for a Stana-IN phone number in area code 347. It's FREE! Using your softphone, go to the configuration menu and write down your account number, password, and 347 phone number. Then disconnect from their service and be sure to kill the StanaPhone icon in your toolbar so that you really are disconnected. You can't be registered twice on their system at the same time, and we need that account to use as an inbound trunk on your Asterisk® system.

NOTE: With StanaPhone, you have to "use" their service at least once every 90 days to keep your number. StanaPhone is a little ambiguous about whether incoming calls count as use, but my guess would be that they probably don't. So you might want to make a $5 payment to your StanaPhone account and make at least one outbound call every few months to keep your number activated. Their rates aren't that bad: 1.6¢ a minute to most numbers in the U.S.

Configuring an Inbound Trunk. In Asterisk@Home lingo or for those using plain old Asterisk with the Asterisk Management Portal (AMP), inbound and outbound lines are called Trunks. And, at least for inbound trunks, you need a phone number associated with the trunk (DID) if you expect to receive incoming calls from Plain Old Telephones (POTS).

Now let's create a new Trunk using the Asterisk Management Portal (AMP). Using a web browser, substitute the IP address of your Asterisk server: http://ipaddress/admin/config.php. Login as user maint using the password you established for AMP when you first configured your system. Now click Setup->Trunks->Add SIP Trunk. For Outbound CallerID, enter the phone number assigned to you by StanaPhone. For Maximum Channels, enter 1. Leave the Dial Rules and Dial Prefix blank for the time being.

For Outgoing Settings, enter a Trunk Name of stanaphone. For Peer Details, enter the following using your assigned username and password. Be very careful to match the upper and lower case settings in your assigned password.

host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername

For Incoming Settings, enter a USER Context of from-pstn. This tells Asterisk to process incoming calls through this context in your dialplan. For USER Details, enter the following using your assigned username and password:

canreinvite=no
dtmfmode=rfc2833
host=sip.stanaphone.com
insecure=very
nat=yes
secret=yourpassword
type=peer
username=yourusername

For the Registration String, enter the following using your assigned username, password, and 347 phone number:

yourusername:yourpassword@sip.stanaphone.com/3471234567

Click the Submit Changes button and then click on the Red Bar to save your trunk settings and reload Asterisk. To be sure you have properly registered with Stanaphone, click the Maintenance tab and then Asterisk Info. Under SIP Peers, you should see an entry for sip.stanaphone.com showing a state of Registered. If not, check your username and password entries for typos.

Configuring an Outbound Trunk. Even though we're going to use Asterisk to transparently ring your cellphone whenever you have an incoming call on your inbound number, we still need an outbound trunk to connect the calls to your cellphone once Asterisk detects ringing on the inbound line. Remember, your cellphone isn't technically part of your Asterisk system. For outbound calls using your Asterisk system, you have a lot of choices. And more is better. When a VoIP provider's service goes down, having a a fallback provider is worth its weight in gold.

Payment plans for outbound VoIP calls also vary. You can pay by the minute and make as many simultaneous outbound calls as you like, or you can pay by the month for unlimited calls so long as you place the calls one at a time. For pay-by-the-minute, you can't beat the pricing and quality of calls with Voxee.com. Calls to most of the U.S. and Canada are 1.1¢ per minute billed in six second increments. Calls to Germany and the U.K. are 1.4¢ per minute. For pricing to other destinations, download this spreadsheet. If you prefer an All-You-Can-Eat plan, head over to TelaSIP and then follow our step-by-step tutorial to get it set up as your outbound trunk.

For today, we're assuming you've chosen the Voxee route. So go to their web site, sign up for an account, and put $5 in your account so you can start making calls. Using AMP, choose Setup->Trunks->Add IAX2 Trunk. Maximum channels only matters if you want to restrict how many simultaneous outgoing calls through Voxee can be made. For the Outgoing Dial Rules, enter the following:

1NXXNXXXXXX
1+NXXNXXXXXX

This tells Asterisk to dial outgoing calls through Voxee using a 1 followed by a 3-digit area code and 7-digit phone number. Now skip down to the middle of the form and under Outgoing Settings, name your trunk voxee. For the Peer Details, insert the following using your username and password assigned when you registered for an account:

type=friend
host=66.246.246.52
username=yourVoxeeAcctNumber
secret=yourVoxeePassword

Leave the Incoming section of the form blank since you won't be getting any inbound calls on your Voxee trunk. Now skip down to the Registration field and plug in the following:

YourAcctNoHere:YourVoxeePasswordHere@66.246.246.52

Save your settings and click the Red Bar to reload Asterisk. Check to make sure you're registered in the same way we did it for the inbound trunk with Stanaphone.

Configuring an Outbound Route. Now that we have an outbound trunk set up, we need to tell Asterisk to route outbound calls through this trunk. In AMP it's called Outbound Routing so click on that tab, and then click Add Route. When the blank form appears, enter OutVoxee for the Route Name. Leave the route password and dial pattern blank for now. For the trunk sequence, click on the pull-down and choose IAX2/voxee. Then click the Add button. Finally, click the Submit button and then the Red Bar to update your configuration. If OutVoxee isn't listed as your top (0) route, then click the Up arrow to the right of the entry sufficient times to move it up to the top position. This is the sequence that Asterisk walks through to place outbound calls, and we want to make sure that Voxee is always selected for outbound calls. Click the Red Bar again when you get OutVoxee moved to the top slot.

Configuring an Extension. We're assuming you've already set up your Asterisk@Home system and configured at least one extension. If not, go through our Asterisk@Home 2.5 tutorial, and get one or two extensions working before you continue here.

Configuring Follow-Me Roaming. Now, for the fun part. There are just a few more quick steps in order to enable Follow-Me Roaming with Asterisk@Home and AMP. First, you create a Ring Group to tell Asterisk which extensions or cellphones to ring when an inbound call is detected. Next, you tell Asterisk whether to ring all of the extensions and cellphones at the same time or one after another. And finally, we'll set up an Incoming Route using AMP's Inbound Routing option to tell Asterisk how to process incoming calls on the Stanaphone trunk we previously created. Then, you'll be ready to take your first call.

Creating a Ring Group with AMP. Using AMP, click Setup->Ring Groups to display the Add Ring Group form. Assign an extension to this ring group by entering a number for Group Number. Let's make it 333 to keep things simple. Ring Strategy is where you tell AMP how to process inbound calls to this number. AMP uses what are now called Ring Strategies to handle incoming calls to Ring Groups. You have three choices: ringall, hunt, and memory hunt. Ringall means just what it says. Inbound calls to this number ring all the numbers in the Ring Group simultaneously. Hunt means incoming calls start ringing the first number in the Ring Group and, if there's no answer, move down the list of numbers one at a time until someone answers. Memory Hunt works just like hunt except the second incoming call first rings the second number in the ring group, then moves down the list, and rings the first number in the ring group last.

For our Follow-Me Roaming project today, we want your local Asterisk extension and your cellphone to ring simultaneously so leave the Ring Strategy set to ringall. In the Extension List box, simply type the numbers of the phones you want to ring pressing the Enter key after each entry. For extensions on your Asterisk system, just enter the extension number. For cellphones or other phones that aren't part of your Asterisk system, enter the phone numbers like this: 16781234567# where 1 is the dialing prefix that Voxee expects, 67812234567 is the phone number to call, and the pound sign (#) says call it now. Leave the CID name prefix blank. For the Ring Time, you may need to experiment a bit. We recommend a number of 50 which will force unanswered calls to your cellphone voicemail system. If you don't want that to happen, set it to something like 30. Your local extension(s) will already be ringing while the cellphone call is being established by the way. Finally, tell AMP where to send the call if no one answers including your cellphone's voicemail system. We usually set this to a voicemail box on the Asterisk system which you check regularly or which delivers your voicemail messages via email. Now click the Submit Changes button and then the Red Bar to reload Asterisk.

Creating an Inbound Route. The last step is to configure Asterisk to forward inbound calls on your 347 number to Ring Group 333 which we just set up. Go to AMP->Setup->Inbound Routing. In the blank form which displays, enter your new 347 number in the DID Number and CallerID Number fields. Skip down to the Set Destination section and choose Ring Group 333. Now click the Submit Changes button and then the Red Bar to reload Asterisk.

Placing a Test Call. Using a telephone that's not in your Ring Group and not on your Asterisk system, dial your new 347 number. And, presto. Follow-Me Roaming is now soup. Phones should be ringing all over the place ... including your cellphone. Enjoy!

Ring Group Bug Fix. As luck would have it, there's a bug in the AMP code that causes the hunt and memory hunt Ring Group options not to work. If you want simultaneous ringing of all your inbound calls to all of the numbers in your ring group, then don't worry about it. Just skip this section. But, if you want a perfectly operating Asterisk system (don't we all?), we'll need to make a minor change in the [macro-dial] context of the extensions.conf file. Click AMP->Maintenance->Config Edit and then choose extensions.conf. Now click macro-dial in the left column of contexts. Move down to the line which begins exten => s,22. Immediately after {Huntmembers}, add a right bracket symbol which looks like this: ]. Click the Update button, and you're all set once you reload Asterisk.

Transferring Calls to Your Cellphone. Now that everything is working, let's assume a call has been answered on an extension in your Asterisk network. But now you want to forward the call to an outside number or your cellphone. It's easy. Hit the switchhook once or flash an IP phone by pressing #. At the dial tone, dial 1 plus the area code and number of your cellphone. When the call starts ringing, hang up. Call transferred! Now that wasn't hard, was it?

Hot Tip! O'Reilly's must-have book, Asterisk: The Future of Telephony, is still available for free download here under a Creative Commons license. This is a cleaned up version of the original PDF which fixes pagination and compresses the file size to 3.9MB using Acrobat's Reduce File Size tool. Requires at least Acrobat 4 to load. Special thanks to Alexander Burke for all the hard work cleaning this up.


Some Recent Nerd Vittles Articles of Interest...

Be Sociable, Share!

This article has 11 comments

  1. Thanks for the great article. I want asterisk to handle all my voicemail. I can get my cell phone voicemail shut off, so it just rings, but if my phone battery runs out or I have my phone off (like when I am on an airplane), the cell carrier immediately answers the call with an intercept. My friends have similar issues.

    Do you know a way to get asterisk to do the right thing when the cell call is answered by an intercept or voicemail?

    Thanks,
    mike

    [WM: The problem is that Asterisk can only detect when a call is answered by a PSTN line or voicemail service so it has no way to distinguish between a person and a voicemail system. One possible solution is to require that some key be pressed when you answer a cellphone call. No key press = voicemail. I’ll work on it a bit.]

  2. I love it. I already did this (two nights ago actually) but there are always so many little things in your articles. I set up an extension and forwarded it to my cell phone, instead of simply typing the number in the right group like you did (duh) and you always come up with the best voip providers and freebies.
    Thanks again for the great articles.

  3. Does it really need a ] added to make it work? This is how mine looks without changes. What should it look like?

    exten => s,22,GotoIf($[$[${HuntMembers}] >= 1]?30 )

    [WM: Yours looks correct. What version of Asterisk@Home?]

  4. First off if it wasn’t for you and your articles I wouldn’t have an Asterisk system up and running support WorldWide business operations. Thank you!

    In a previous posting you stated that the Dial line for an extentsion had to changed from Sip/XX to Dial(local/XX@from-internal) where XX is the extentsion number for follow me calling to work. I have found this to be a true statement with the Asterisk@home version 2.5 that I am currently running. Was it an oversite that this information wasn’t include in this article or have you found a way around this issue?

  5. How would you pass the original caller ID from the incoming call to show up on your cell phone? This is a popular feature that Avaya systems offer.

    [WM: Great question, and you’re right. It was a must-have in our book. Read our article on that very subject.]

  6. If you’re having trouble setting up Stanaphone like I did check out http://www.voip-info.org/wiki/view/Asterisk@Home+Handbook+Wiki+Chapter+6#614Stanaphone it worked for me.

  7. I’m having trouble with this. My asterisk extensions just ring once, however it does make the call out to my cell phone. Any thoughts?

  8. I cannot create a new user on StanaPhone.com. Sign up for an account. is not allowed. Exist any other way? Please let me know. Am so frustrated. Thanks.

    [WM: Stanaphone at least temporarily is not accepting new accounts.]

  9. Thanks for the articles, you’re advise is always extremely useful! I’m curious of others are having this issue; I’ve a system when two ZAP channels and an IAX2 trunk to another system.

    I find that when I setup an extension to dial out to a cell phone as well as ring a SIP extension on my system the SIP extension rings only once and then the call is handed off completely to the trunk (either zip or iax2) going to the cell phone. Watching the Asterisk console, I see what looks like Asterisk thinking the trunk has “answered” the call so it stops ringing any other extensions. The call does get completed to the cell phone but there’s no chance to answer the call on the SIP. I’ve tried this in both hunt and ring-all configs.

    I’m currently running Trixbox 2.2 but I’ve had this problem through several versions of Trixbox/AAH. Any ideas?

    [WM: I’ve seen the same thing going all the way back to Asterisk@Home 1.5. It’s definitely a bug, but no one seems to be able to find or fix it.]

  10. Thank you for the info on setting up forward. I have done everything and it works fine. However the problem i have now is there is a 4-5 sec delay in the audio conversation. This is very difficult to talk with. When i place a call direct from one of my extensions there is almost zero delay. So it seems like it has to do with the forward. Any ideas?

    [WM: Have you implemented the tips on Getting Rid of One-Way Audio in our tutorial?]

  11. Voxee.com is also not accepting new accounts, but of course they don’t mention that until you give them all of your contact info on their signup screen. Sounds like phishing to me. Anybody know what’s up with them?