Unlimited Free Calling with Voice

1. Unlimited Free Calling with ...... 0 1. Introduction ...... 1 2. Free Calling from a Landline ...... 1 3. Free Calling from a Cellphone (using the Voice plan) ...... 2 4. Free Calling with Voice Over IP (VOIP) - Introduction...... 6 5. The Project - Background ...... 6 6. Google Voice Integration with Gizmo5 ...... 7 7. Gizmo5 Integration with SIP Sorcery ...... 7 8. SIP Sorcery Integration with sipgate ...... 8 9. SIP Sorcery Scripting ...... 9 10. Unified Dial Plan ...... 9 11. Customizing the SIP Sorcery Unified Dialplan ...... 15 12. Connecting other SIP Clients and Devices...... 16 13. Configuring and Testing your SIP Calling Chain ...... 21 14. Additional setup screenshots ...... 28 15. Revision History...... 29

1. Introduction

Google Voice is a free service offered by Google and is designed to help you manage your phone calls. When used for its original intended purpose, Google Voice can add unlimited calling to and from US phone numbers to any landline. With a little more effort, that benefit can be extended to cellphones with "calling circles", or plans that allow a certain number of non-free phone numbers to be converted into free calls. With even more effort and a suitable phone, the feature can be further extended to not only maintain free calling even after a carrier decides those calls should no longer be free, but to also maintain free calling while roaming outside of the United States. Finally, with the greatest amount of effort, one or two lines with unlimited calling 24x7 can be added to any home or business.

2. Free Calling from a Landline

Google Voice offers two ways to enable 24x7 free inbound and outbound calling for landline phones based in the US. First is a method that works the same way no matter what kind of phone you end up using to make a call. From the main Google Voice web page (http://voice.google.com) you are able to enter phone numbers or choose contacts from your Google Voice . With the phone number entered or selected, click the Call button or link.

When viewed on a full PC browser, you will be asked which phone you would like Google Voice to ring. When viewed on a browser, Google Voice will dial the phone number currently selected in the "My Mobile Number:" on the Settings page. No matter which version of the website you use, ensure that your landline is selected as the phone you want to use for the call. Start the call and the selected phone will start ringing. As you don't get the option to choose which phone to ring when using the mobile browser, you must ensure you have the correct phone line selected prior to initiating the call. Once Google Voice calls you, answer the phone. You will immediately hear the ringing sound of an outbound call. This is Google Voice connecting you for free to the number you entered or selected on the website. As landlines don't typically incur any charges to receive calls (except "collect calls" where the recipient is asked to pay), there are no special steps to take to receive calls for free. If you are home quite frequently, don't have unlimited long distance calling on your house line, have access to the web on your cellphone, but don't have a lot of cellular minutes to spare, this is a great way to make unlimited free long distance calls from your home, without giving out your home phone number.

Just pull out you cellphone, bring up the Google Voice page, make sure your house phone is selected as your Mobile phone number, and enter or select from the directory the phone number you would like to call. This method works regardless of whether or not your Google Voice number is a local call to your house number since all calls will be inbound to your landline.

The second method is entirely different, and is most beneficial if the Google Voice number you selected at signup is a local to you and you don't have long distance service. It is also much simpler to use. Just pick up your phone and dial the Google Voice number you selected. From the main menu, press the number 2 and you will be asked to dial the number you wish to reach. Google Voice then connects you, for free, to the number you dialed, so long as the number is in the US.

If your landline already has unlimited long distance or the numbers you call are within your local or regional flat rate calling area, the main benefit of using Google Voice is to mask your home phone. The people and businesses you call will see your Google Voice number on their caller id, and will only need to know one phone number to reach you.

3. Free Calling from a Cellphone (using the Voice plan)

Central to Google Voice is the ability to manage your phone calls and SMS text . Just as when using your landline, Google Voice can also help you mask your personal cellphone number to other parties,showing them just one phone number for reaching you. With a little planning (and a little cooperation from cellphone companies), Google Voice can help you turn your cellphone into a flat-rate, unlimited use phone line. There are generally two ways this can be achieved.

Cellphone usage is priced differently in the US from almost every other country. In general, US cellphone users are charged minutes for both incoming and outgoing calls. The same is true for text messages, although unlimited plans have been available across all of the major carriers for many years. To help retain and build their customer bases over the years, cellphone companies began by offering unlimited calling to other cellphones operating on the same network. Even that wasn't even enough eventually, and companies began allowing customers to select a handful of out-of-network phone numbers and designate them as effectively being "in network". The out-of-network numbers don't have to be other cellphones or landlines -- users can generally pick any set of numbers they like, and they will never be charged for the minutes used during calls to or from the numbers on the list.

As described above, there are two ways in which calls involving the Google Voice Number selected by a Google Voice user can be used to branch out to free calls to any other phone number in the US free of charge. First, the user can access the Google Voice website and enter or select a number they want to call. Google Voice will then call the user at the phone number where the user indicated they can be reached, showing a caller id of the user's own Google Voice number. When the user answers the incoming call they will be connected to the phone number entered or selected at the Google Voice website, free of charge.

Alternatively, if the user does not want to use the Google Voice website or does not have a smartphone capable of browsing the web, the user may still dial their own Google Voice number. Google Voice will recognize the call as coming from a phone that is managed by the user, and will offer to play any waiting voicemail or connect them to another number. The user may press 2 and then enter another phone number to which they will be connected free of charge. It may become a hassle for users to dial phone numbers by hand every time they want to make a phone call. Since their introduction, cellphones have always had the ability to have keystroke sequences programmed into telephone numbers stored for address book entries.

Two important programming codes available for numbers are the "pause" and the "wait". When a pause is inserted into a phone number, the cellphone will dial the portion of the phone number leading up to the pause. Then for each pause inserted into the stored number, the phone will wait 2 seconds before continuing on to dial the remaining numbers. When a wait is inserted into a code, the phone will again call the phone number stored ahead of the wait code, but instead of waiting a certain amount of time prior to dialing the remaining numbers, the phone will wait for the user to press a key to signify to the phone that is okay to proceed in dialing the remaining numbers. iPhone users who want to simplify dialing but weren't able to grab the official Google Voice dialer have another option. There is a free app called Prefix Dialer. The app can be configured to automatically prepend a dialing sequence in front of the numbers to be dialed when calling an entry in the phone's address book. Once the app is installed, go into the settings, and enter this special sequence:

Enter your Google Voice phone number, the letter "p", your pin, another letter "p", the number 2, another "p", and optionally the number 1 (the final "1" seems to speed up dialing a bit, but is not required).

For example, if your GV number is 555-666-7777, and your pin is 9999 then you would enter "5556667777p9999p2p1". Then, whenever you want to place a call go into Prefix Dialer & tap "select number". The app then shows you your normal iPhone contact list. Select a contact and dial like you normally would. When the call is placed the app will dial your prefix first, then the number you selected, thus routing the call through your Google Voice account.

Separately, there are options for Google Voice users who don't have a smartphone (or a data plan for their smartphone) but still want to enjoy free calling without typing 11 digits for every outbound call. The solution is to update the phone numbers for each of their contacts, starting with the most frequently called ones. Instead of just having the person's phone number listed, the Google Voice user will update the number to read their own Google Voice number, plus either a wait or a long enough series of pauses, the number 2, another pause or two, and finally the number that was originally stored in that memory location. This restores even "low tech" Google Voice users' ability to make unlimited free outbound calls with little inconvenience.

It should be noted, however, that any frequently called numbers that are on the Google Voice user's cellular network should not be changed. As Google Voice is not a cellphone service, the parties receiving calls from new Google Voice users will now be charged minutes to receive phones they have never been charged to receive before.

So by simply adding their own Google Voice number to their "Calling Circle", Google Voice users have two options for making unlimited outbound calls without consuming any talk minutes allocated to their account. One way requires a drastic change in the way in which phone calls are placed by forcing users to visit a website instead of their own local address book. The other way either requires a significant amount of extra button presses at the start of each call or the systematic editing of every frequently called number in the user's address book that is not a mobile phone on the user's own cellular network.

In addition, Google Voice has an option to further extend the benefits of this approach. By going into the configuration settings of their Google Voice account, users are able to decide what is shown on their caller ID when a call arrives through the Google Voice system. Users may choose to see the actual caller ID presented by the caller, or simply mask all incoming calls behind the Google Voice number. When calls arrive on the user's Google Voice line, calls presented to the user with the user's own Google Voice number as the caller ID will cause the user's carrier to recognize that number as being in their calling circle and therefore free.

There is a third way in which users can enjoy unlimited calling. On select smartphones, particularly those running Google's Android and RIM's Blackberry phones, Google has released software that simplifies outbound dialing. The user brings up an alternate dialer, which still typically has access to the user's local address book stored on their smartphone. When the user chooses a number to dial, the alternate dialer performs two steps in parallel. First, the dialer uses the phone's Internet connection to notify Google Voice's servers that a call is about to arrive from the user's cellphone and the message includes the phone number they are actually trying to reach. Then the dialer triggers the phone to call an entirely different, unpublished number to log into the Google Voice system. Once the Google Voice system has processed the message sent previously by the alternate dialer, the system answers the inbound call coming from the user's cellphone and connects the caller to the number they originally specified in the alternate dialer.

This is significant because there's no way for users to know which Google Voice "access number" the user's handset is going to call and yet, this number has to be detected by the user and added to the user's calling circle. If the user does not figure out this access number and add it to their calling circle, they will be under the misconception that all of their outbound calls are free, when in fact they are not.

When Google Voice users with calling circles add their Google Voice number (and the access numbers used by smartphones) to their calling circle and choose to have Google Voice display their own Google Voice number as the caller ID on incoming calls, they are now able to make and receive unlimited calls with their cellphones under certain conditions:

1) The cellphone is on their carrier's home network (i.e. not roaming),

2) The user always uses a dialing method that routes calls through the Google Voice servers and all entrance numbers are listed in their calling circle,

3) Parties calling the user call them through their Google Voice number,

4) The user maintains at least the minimum calling plan that qualifies for calling circles Users should note that the access number dialed by the alternate dialer on Android and Blackberry phones is subject to change at any time, and it is the user's responsibility to ensure that the access number being dialed matches the number on their calling circle for that purpose. The alternate dialer on Blackberry phones does not entirely mask the calling process from the user. Once the dialer transmits the target phone number to the Google Voice servers over the Internet, the dialer app initiates a standard phone call, allowing the user to see the standard screen displayed while a call is in progress.

With this in mind, a common suggestion given to Blackberry users is to create an entry in the phone's local address book for Google Voice. The two numbers stored in that entry would be the user's own personal Google Voice number as well as the access number they detect as being called by the alternate dialer. The user may also go as far as adding a picture to the entry, such as this one found here:

http://www.iphonefreak.com/wp-content/uploads/2009/06/ gv_mobile_logo_new_250x250.jpg

Doing so makes it very easy for Blackberry users to recognize when the access number has changed since the "Call In Progress" screen will simply show a phone number instead of the name "Google Voice" and the icon displayed above will not be shown. When the icon and name are not displayed on outbound calls initiated by the alternate dialer, the user will know that the access number being dialed by the dialer app is not on their calling circle and the outbound calls will not be free of charge until the new number is added to the calling circle.

The alternate dialer on Android phones apparently mask the entire process of dialing the access number, therefore making it a bit more difficult to identify the access number being dialed. Furthermore, adding that number and the caller ID picture above to an entry created for Google Voice is of no value since the standard "Call In Progress" screen is not displayed. 4. Free Calling with Voice Over IP (VOIP) - Introduction

Voice Over Internet Protocol (Voice Over IP, or simply "VOIP") is a generic term that applies to methods and approaches for allowing users to transmit audio over Internet connections. There are many approaches and technologies applied to implement VOIP, and a few standards have been developed to ease the interaction between two or more systems looking to establish a session. One of the most popular approaches is called Session Initiation Protocol, or SIP. SIP is able to establish connections covering a variety of communications, but for for the purpose of this discussion, SIP should be thought of as a way to link two or more systems together for the purpose of establishing, maintaining, and terminating phone calls. Generally speaking, a SIP server is a system that either connects to other systems or to end users, either over SIP or through a gateway function that links "digital" phone calls to telephone devices.

What end users tend to think of as a "phone line" can be hosted by a SIP server and lines can be activated or deactivated by an authorized person identified through their login credentials. Just like how people login to Google's properties to check their account for new email, see their custom dashboard in iGoogle, chat with their friends and family on or read the headlines in , users of SIP lines can bring up phone lines by using special software to authenticate against a server using unique credentials. When the SIP phone line is activated by the authorized user, phone calls destined for that phone line are presented to the end point the user has designated as their personal interface to the phone line.

Endpoints may take the form of software on a laptop or PC that looks just like a desktop telephone, software that runs on small, handheld computers the size of a cellphone, software that runs on an actual cellphone or (with the help of another device) a standard telephone sitting right on their desk. Without getting too far into details, it is just important to know that what we know as "phone calls" can now freely hop back and forth between the old fashioned technology you see in your walls behind the phone plug and computers communicating with each other over the Internet. That's how the phone companies have done it for years, and you are free to join in the fun.

Since long before GrandCentral (the predecessor to Google Voice) hit the scene, services had been popping up, offering low cost phone calls with very low per-minute rates, particularly for international callers. Some companies allowed customers to access their system via regular telephone lines while others only allowed calls to traverse their network in digital form. Since Google Voice offers publicly accessible phone lines and uses high tech approaches to routing and managing phone calls on those lines, its only appropriate that Google would allow a pure IT-based approach to allowing users to connect to their Google Voice phone lines in the same way. And Google did allow this for a short time.

5. The Gizmo5 Project - Background

After a brief period of allowing all users direct access to their Google Voice phone lines via SIP, Google restricted the purely digital access through an established Internet phone line provider, Gizmo5. Now Gizmo5 had its own digital phone line service offering, complete with their own domestic and international calling rates. But by accepting digital phone calls from Google Voice and allowing Google Voice users to receive phone calls from Google Voice completely free of charge, their revenue model was threatened. Remember, when you enter or select a phone number to call on the Google Voice website, Google Voice calls you first and when you answer, connects you to the other party.

So if Gizmo5 was granting free access to end users to free digital-only phone lines but also had the only all-digital path to Google Voice, they were destined to receive a stampede of new Google Voice users who had no interest in using their chargeable services. Furthermore, since Gizmo5 offers free forwarding of inbound calls to other destinations over SIP, this meant that anyone worldwide could suddenly sign up for free services from Gizmo5 while waiting for a free phone line from Google Voice. Google worked very hard to limit the earliest eligible beta testers to those located in the US, but Gizmo5 breaks that requirement and will forward your phone calls anywhere in the world over SIP.

After a several months of beta testing, Google recognized that not only does Gizmo5 play a key role in linking some of Google's users with a very popular product, the popularity of the product paired up with Gizmo5's generosity was quickly eating away at their bottom line. Instead watching Gizmo5 collapse into itself, taking a successful, established business with it as well as thousands of Google users using Gizmo5's services for free, Google bought Gizmo5 and is currently in the process of rebranding their product line and apparently preparing to better integrate the service with Google's offerings.

6. Google Voice Integration with Gizmo5

After a torrid build-up of interest in Gizmo5 as the only provider with SIP access to Google Voice, Gizmo5 introduced some integration with Google Voice. Recognizing that Google Voice directly competes with and undercuts their long distance calling product, Gizmo5 added some configuration settings to the user accounts, allowing users to specify their Google Voice credentials. Then, users would initiate an outbound call through Gizmo5's own systems, not Google's. The Gizmo5 servers would then interact with the Google Voice servers to initiate an outbound call but connect the call to the Gizmo5 user who initiated the call. Because of the direct competition, Gizmo5 limited calls inititated in this way to 3 minutes in length.

Gizmo5 did not limit the length of calls that arrived inbound from the Google Voice servers, however. This means that all calls arriving into Gizmo5 accounts from Google Voice are unlimited in length. Recall that when Google Voice users initiate outbound calls by entering or selecting phone numbers at the web site, Google Voice always proceeds by calling the user first at a number they specify, only to connect the user to the desired phone number when they answer the call. From the very beginning, Google Voice users with Gizmo5 accounts have been able to make calls of unlimited length over SIP merely by initiating the calls at the Google Voice website.

Since SIP is a computer-to-computer communication system, this means that users with devices capable of SIP communication can now enjoy free unlimited calling by authenticating their SIP client against their SIP account at Gizmo5 and initiating outbound calls via the Google Voice website and indicating to Google Voice that they can be reached through their Gizmo5 phone line. This also means that devices that have not historically been thought of as telephones can now serve their users in that role.

7. Gizmo5 Integration with SIP Sorcery

Among the many SIP phone line providers on the Internet, SIP Sorcery presents an interesting end user experience. SIP Sorcery was developed to offer a flexible way to control the flow of phone calls while in their digital form. What is unique about SIP Sorcery's approach is that they expose a complete programmable environment, allowing skilled users to develop robust and complex schemes for routing calls between networks. When GrandCentral reopened its doors as Google Voice and Google Voice restricted its SIP-based communications to Gizmo5, SIP Sorcery seized a unique opportunity.

See, Gizmo5 still offers to forward all inbound calls to another destination free of charge, so long as the connection is via SIP. This is of no consequence to SIP Sorcery because they only deal in SIP links. SIP Sorcery unilaterally updated their system to include support for Google Voice. They developed and made available a script function that uses Google Voice to establish phone calls which are then presented via SIP to SIP Sorcery and on to their connected users. SIP Sorcery uses the phone numbers entered via a SIP client to kick off the script that establishes a call at Google Voice.

What does all this mean? It means that users who connect to SIP Sorcery via SIP are able to dial phone numbers directly in their SIP clients or on their analog phones attached to a SIP-compatible phone adapter. SIP Sorcery then uses Google Voice to place unlimited free calls to any US phone number entered by the user.

It also means, by extension, that users who connect their SIP clients directly to Gizmo5 or other SIP gateway providers and don't want to pay for their value added services are not utilizing the service in the most efficient and cost effective way.

8. SIP Sorcery Integration with sipgate

SIP Sorcery is not only able to process and route SIP calls, but is also able to serve as a SIP client to SIP providers. This capability enables SIP Sorcery users to use any other telecom provider that offers SIP access to their users' phone lines. Sipgate.com is one such provider. In order to enable 24x7 free calling for Google Voice and sipgate users using just a SIP client, follow these simple steps to use the dialplan in the next section.

Note: These instructions will be sipgate-specific until Google re-opens Gizmo5 for signups. If you have a Gizmo5 account already and would like to know how to enable free calling without the 3-minute limit, please ask in the forum until the new process is known.

1. Sign up for a free Residential Sipgate ONE account at sipgate.com. Go into your settings page and take note of both your regular phone number (usually in area code 415) as well as your SIP credentials.

2. Sign up for a free account at SIPSorcery.com. You will need to install Microsoft Silverlight in your browser to perform this step and complete the rest of this process.

3. On the SIP Providers page, add a new provider named "sipgate" and enter your SIP username and password provided by sipgate. Enter sipgate.com as the server. Click "show advanced settings" and add sipgate.com as the proxy. Check the "Register" checkbox and make sure that the registered contact shows "sip:" followed your SIP Sorcery name and "@sipsorcery.com". Click Add when you have finished. After a few seconds, sipgate should automatically appear in the "SIP Provider Registrations" list at the bottom of the screen. If it does not, double check the SIP credentials and server settings against those shown on your sipgate account settings page. 4. Configure your SIP client, SIP-compatible or SIP-compatible ATA to login to your sipsorcery account. Check the "SIP Accounts" page of your SIP Sorcery account and make sure an entry appears in the "SIP Bindings" list at the bottom of the page.

5. Use a phone to call your sipgate number and make sure the phone attached to your SIP Sorcery account rings. Answer the call and make sure you can hear sound in both directions.

6. Login to Google Voice, click Settings, Phones, and add your sipgate phone number as a new managed phone. Google Voice will display a two digit number on your screen. Click Connect and Google Voice will call your sipgate number and ask you to enter the code displayed. Once you successfully add the new line, make sure it is checked on your Google Voice phone list.

Note: You are now ready to receive inbound calls to your Google Voice number for free. You may also enter phone numbers on the Google Voice website and select your sipgate number as the phone you wish to use to make free outbound calls. There is one last step required to enable 24x7 free unlimited outbound dialing from your SIP-compatible softphone or standard telephone attached to your SIP-compatible ATA.

7. Copy the SIP Sorcery dialplan below, go to the Dial Plans page in SIP Sorcery, click on default, and paste the dialplan, overwriting the short default script already there. Customize the portions of the dialplan highlighted in blue below according to section 11. The script will not function correctly and you will not be able to make free outbound calls until you customize all of the highlighted text.

If you've made it here, you should be all set. If you followed all the steps properly, you should be able to start your SIP client or pick up your ATA-connected phone and dial any number in the US for free. If you are unfamiliar with other SIP clients and SIP-compatible devices available to you, check out Section 12.

NOTE: If you are unable to follow these steps and just can't seem to get outbound dialing to work, please see section 13 of this document for more detailed instructions, including screenshots of the setup process.

9. SIP Sorcery Scripting

Key to taking advantage of SIP Sorcery's capabilities is their scripting feature. It is important to remember in all this that SIP is just a method for enabling computers to exchange audio (and other information) in a way that is compatible with what people know as "telephone calls". The scripts that SIP Sorcery supports are called dialplans. Dialpans instruct SIP Sorcery on how to route calls based on a variety of parameters. Only outbound dialplans are needed for integration with Google Voice.

10. Unified Dial Plan

Here is a dialplan adaptable to both sipgate and Gizmo5 that offers a speed dial directory that is accessible from every attached phone. It is also capable of automatic routing across multiple SIP providers based on the phone number you are calling, also developed by MikeTelis at mysipswitch.com. You will need to edit the Google Voice section with your Google Voice username, password, and your assigned sipgate number. For the code below - entries highlighted in blue need to be modified before saving the dialplan. There are 5 entries that need to be customized and 2 highlighted hash marks in each of two sections, one of which in each section MUST be removed in order for dialing to function.

#======BEGIN CODE ======#

#Ruby

# Note: This script works with both gizmo5 and sipgate but some # EDITS ARE REQUIRED to indicate which SIP provider is being used

# ------BEGIN MANDATORY ENTRIES SECTION------#

Area = '217' # my area code, this will be added to 7-digit dialouts Tz = -6 # my time zone (GMT format, e.g. Central = -6)

# ---- Enter your Google Voice ("GV") and Sipgate account credentials----#

GV_USER = "[email protected]" # my GV e-mail address ([email protected]) GV_PASS = "password" # my GV password SIP_NUMBER = "xxxyyyzzzz" # my 10-digit Sipgate or Gizmo5 number

# ***************Google Voice Configuration Section ********************* # You must remove the "#" from the start of the one of the two lines in this section # that correlates to your provider. # Dialing WILL NOT WORK UNTIL YOU REMOVE THE "#" FROM THE APPROPRIATE LINE def googleVoice

# sys.GoogleVoiceCall(GV_USER,GV_PASS,SIP_NUMBER,@num,'.*',1,30) # sipgate # sys.GoogleVoiceCall(GV_USER,GV_PASS,SIP_NUMBER,@num,'.*',7,30) # Gizmo5 end

# ***************SIP Provider Configuration Section ******************** # You must remove the "#" from the start of one of the two lines in this section # that correlates to your provider. # Select the appropriate line starting with '5' and remove the first '#' # Dialing WILL NOT WORK UNTIL YOU REMOVE THE "#" FROM THE APPROPRIATE LINE

VSPtab = { '0' => '00 @ F9', # Future-nine default route '2' => '02 @ F9', # Future-nine grey route '3' => '03 @ F9', # Future-nine white route '4' => '04 @ F9', # Future-nine premium route # '5' => '@ sipgate', # sipgate # '5' => '@ gizmo', # gizmo

}

# ------END MANDATORY ENTRIES SECTION------# # ------BEGIN OPTIONAL SECTION FOR SPEED DIAL ------# # Speed dial entries. Format: "short code" => "destination (POTS or SIP)"

Speeddial = { '0' => '123456789', # my 0 (zero) key's speeddial number '411' => '8004664411', # Google's Directory Assistance, GOOG-411 '303' => '[email protected]', # Blueface speaking clock (Ireland time) '266' => '[email protected]', # CNN Headlines (266 = "CNN") '677' => '[email protected]', # NPR's most e-mailed stories (677 ="NPR") '742' => '[email protected]', # Prairie Home Companion's, or PHC's # News from Lake Wobegon (742 = "PHC") '932' => '8009328437', # 800-WEATHERCALL (9328437 = "WEA[ther]")

} # ------END OPTIONAL SPEED DIAL ENTRY SECTION ------#

# Serviced domains, must be in lowercase!

Domains = ['sipsorcery.com','174.129.236.7']

# Excluded Prefixes. Provides a safeguard against accidentally calling premium # numbers. Accepts both strings and patterns, spaces ignored

ExcludedPrefixes = [ ' 1 (900 | 976 | 809)', # USA Premium '44 (9 | 55 | 87 (0|1))', # UK Premium '44 84 (4|5)', # UK Local Premium '44 70', # UK Personal Premium '43 (8|9)', # Austria Premium '32 (7|90)', # Belgium Premium '45 (1 | 50 (1|2|3) | 70 (1|2))', # Denmark Premium '45 (8|9) 0', # Denmark Premium (...) '33 (7|9)', # France Premium '49 (1 | 900)', # Germany Premium '39 [^3]', # Italy Premium (...) '31 (14 | 6 (3|8|9) | 8 | 9)', # Netherlands Premium (...) '48 (39 | (2|7|8) 0)', # Poland Premium '46 9 (00 | 39 | 44)', # Sweden Premium '41 90 (0|1|6)', # Switzerland Premium ]

# ******************** s e l e c t V S P ******************************* def selectVSP # VoIP provider selection

# Reject calls to premium numbers unless VSP was forced

ExcludedPrefixes.each {|p| p.gsub!(/\s*/,''); sys.Respond(503,"Calls to #{$1}* not allowed") if @num =~ Regexp.new("^(#{p})")}

case @num when /^1([2-9]\d\d)/ # North America

case $1 # check area code

when "808", "907", "867" # AK, HI, Canada Yukon calls are now free with GV googleVoice # route(4,"Destination - Alaska, Hawaii, Yukon")

when /(800|866|877|888|415)/ # US toll-free calls googleVoice # route(5,"Destination - US toll-free or sipgate")

else googleVoice sys.Log("GoogleVoiceCall failed, routing thru F9") route(4,"Destination - North America") end

when /^972(5|6)/ # Israel mobile route(3,"Destination - Israel mobile") else route(0,"Default route applied") end end

# ************************** C A L L S W I T C H ********************** def callswitch(num,*args) route # Initialize vars

@num = num unless @num = Speeddial[num] # If there is speed dial entry for it...

@l = "URI dialing: #{@num}" # Assume URI dialing unless @num =~ /@/ # If we already have URI, skip all number processing @num.gsub!(/%(..)/) {$1.to_i(16).chr} # Convert %hh into ASCII

#======# Note: this section is important to understand because it lets users choose a specific # SIP Provider for each outbound call. Perfect for users both sipgate and G5 # accounts who want to be able to choose which provider to use. Let's develop # this section to make the script portable to both G5 and sipgate users as well # as user with other 3rd party SIP providers

if @num =~ /^#(.)(.*)/ # If number starts with '#' @p = $1; @num = $2 # next char is VSP code end #======

@num.gsub!(/[^0-9*+]/,'') # Delete all fancy chars (only digits, '+' and '*' allowed)

# sub! below removes prefixes: # '+' - international format # 00 - European style international prefix (00) # 011 - US style international prefix (011)

unless @num.sub!(/^(\+|00|011)/,'') # If no international prefix, process special cases below case @num when /^[2-9]\d{6,6}$/ # Local call, 7-digit number @num = "1#{Area}#{@num}" # prefix it with country and area code when /^[01]?([2-9]\d{9,9})/ # US number with or without "1" country code @num = '1' + $1 # add country code and truncate number to 10-digit when /^\*/ # Voxalot voicemail, echotest & other special numbers else sys.Respond(603,'Wrong number, check & dial again') end end

sys.Log("Number in ENUM format: #{@num}")

@l = "Forced routing to provider #{@p}, template '#{VSPtab[@p]}'" # Assume user explicitly selected VSP

if @p.empty? # Automatic VSP selection?

# Invoke selectVSP prior to ENUM lookup just in case we need to modify @num

route # re-initialize variables selectVSP # Pick appropriate provider for the call

if enumuri = sys.ENUMLookup("+#{@num}.e164.org") # Check if NAPTR exists for the number sys.Log("ENUM entry found: '#{enumuri}'") # If yes, call that URI sys.Dial(enumuri) # if call failed, call via regular VSP. status() # If this is not what you want, add "return" sys.Log("Call to #{enumuri} failed (#{@reason}), will call again via regular VoIP provider") end

end # @p.empty end # URI

dial(*args) # dial selected number or URI end

# ******************************* D I A L ******************************** def dial(*args) sys.Log(@l) unless @l.empty? # for the record :) if tpl=VSPtab[@p.to_s] # if provider is in our table tpl.gsub!(/\s*/,'') # Remove spaces @num = tpl.gsub(/@/,@num+'@') # Insert number before '@' end sys.Dial(@num,*args) # Dial status() # We shouldn't be here! Get error code... sys.Log("Call failed: code #{@code}, #{@reason}") end # ****************************** R O U T E ******************************* def route(p='', l='') @p = p; @l = l end

# ***************************** S T A T U S ****************************** def status if (ptr = sys.LastDialled[0]).nil? @code = 487; @reason = 'Cancelled by Sipsorcery' else ptr = ptr.TransactionFinalResponse @code = ptr.StatusCode; @reason = ptr.ReasonPhrase # sys.Log("#{ptr.ToString()}") end end

# ******************************* M A I N ***************************** begin sys.Log("** Call from #{req.Header.From.ToString()} to #{req.URI.User} **")

t = Time.now + ((Tz+8)*60*60) # Get current time and adjust to local. SS Server is in GMT-8 sys.Log(t.strftime('Local time: %c')) if sys.In # If incoming call... name = req.Header.from.FromURI.User.to_s # get a copy of caller's number

# Prefix 10-digit numbers with "1" (US country code). # Some DID send Caller ID without country code

name = ('1' + name) if name =~ /^[2-9]\d\d[2-9]\d{6}$/

name.sub!(/^011/,'') # Remove 011 prefix added by Google Voice

sys.Log("FromName: '#{name}'") req.Header.From.FromName = name # Set FromName for sys.Dial # Change FromURI.User, too - or else Bria won't find contact in its phonebook! req.Header.from.FromURI.User = name

if sys.IsAvailable() # If my ATA is registered callswitch("#{sys.Username}@local") # forward all incoming calls to it elsif (8..23) === t.hour # else forward calls to my home sys.Log("#{sys.Username} is not online, forwarding call to home number...") callswitch("0",35) # Note that '0' is in my speed dial list end

sys.Respond(480, "#{sys.Username} Not online") # switch to voice mail

else # Outbound call ...

# check if it's URI or phone number. # If destination's host is in our domain, it's a phone call

num = req.URI.User.to_s; reqHost = req.URI.Host.to_s # Get User and Host host = reqHost.downcase.slice(/[^:]+/) # Convert to lowercase and delete optional ":port"

num << '@' << reqHost unless Domains.find {|x| x == host} # URI dialing unless host is in our domain list

callswitch(num)

end sys.Respond(@code,@reason) # Forward error code to ATA rescue # Gives a lot more details at what went wrong (borrowed from Myatus' dialplan) sys.Log("** Error: " + $!) unless $!.to_s =~ /Thread was being aborted./ end

#======END CODE ======#

11. Customizing the SIP Sorcery Unified Dialplan

The very top of the script contains the "Mandatory Entries" section. First, there are 5 pieces of information highlighted in blue that you will need to provide. The five details are

1) Your local area code. This restores 7-digit dialing to Google Voice in your home area code. 2) Your time zone. 3) Your in full email address form (typically "[email protected]") 4) Your Google account's password 5) The 10-digit phone number of the SIP provider you plan to use. For Gizmo5 users, this will be a number in area code 747. For sipgate users this must be the number that was assigned to you by sipgate. It can be in almost any area code, but more often than not, it is from area code 415.

NEW STEP: Once you have entered those five details, you must review the next two sections of code. Each section will have two lines with leading hash marks ("#"), and you must determine which ONE line in each section must have its leading hash mark removed. It is easy to determine which line in each section needs to be edited based on the provider you decided to use.

After the mandatory section is the optional speed dial directory. This function has two benefits. First, it brings customizable "short codes" to standard phones. This allows numeric codes to be dialed and have those codes interpreted to trigger a connection to a specific destination. For example, a user can create "extensions". So for instance, 411 is translated to 1-800-466-4411, which is Google's 411 (information by phone) service. (Note that 4664411 spells "GOOG-411" on a standard telephone keypad.)

IMPORTANT: If you are disconnecting your home phone service and do not have a cellphone, be advised that Google Voice does not provide 911 service. You should take a minute to call your emergency services center ON A NON-EMERGENCY NUMBER and ask them for the best alternative number to call if you don't have 911 service.

URGENT NOTE: It is always best to call 911 from a live phone line provided by the phone company. Your second best option is your cellphone, preferably one with GPS functionality. Your very last option should be to use Google Voice to call the alternate number provided to you by your emergency services center. They will not have automatic addresses or GPS coordinates, so they will have the least amount of information available if you call during an emergency. They will also typically answer 911 calls first so you may not get an immediate response when it is most urgently needed.

A popular use for the speed dial directory is to listen to podcasts collected by podcast aggregator Podlinez. They collect thousands of regularly updated podcasts and link them to phone numbers. By calling the assigned phone number, the user will immediately hear the latest episode of the associated podcast. Podlinez takes the extra step, however, of making each and every phone line also available via SIP. This means that SIP Sorcery can be configured to call any of those numbers directly over SIP instead of using Google Voice to call into Podlinez via a standard phone line. And since the speed dial directory supports translating short codes to other SIP-accessible phone lines, users are free to choose any number of podcasts from the Podlinez directory and add them to their speed dial list.

For example, the CNN Radio top stories podcast is updated hourly and available to all phones at 1-415-376-7253. Podlinez also makes that phone number available via SIP at "[email protected]". Instead of dialing the entire number or creating an entry in the address book for each device attached to your SIP Sorcery account, a "short code" number can be added to the custom speed dial directory at the top of the script. As soon as the script has been updated, all attached devices can dial the short code and hear the headlines. Since 266 spells "CNN" on a standard telephone keypad, the short code can be added to the speed dial directory with this simple line placed in the middle of the directory:

'266' => '[email protected]', # CNN Headlines (266 = "CNN")

Again, all phone numbers listed in the Podlinez directory can be added to the speed dial directory by creating an entry formatted like the one above. This is not required as users are still free to call the traditional phone lines to hear the podcasts, but those lines are occasionally busy. Accessing the lines via SIP bypasses the traditional phone lines, leaving them open for other users who are not SIP enabled, and also eliminating the chance of calling at a time when the phone lines are simply out of capacity.

12. Connecting other SIP Clients and Devices

The hard part is out of the way! You are now free to connect any SIP client software or SIP- compatible devices to your SIP Sorcery account and enjoy unlimited calling to and from US- based phone numbers. SIP client software is available on many platforms. These include but are not limited to:

• sipdroid for use on Android cellphones and Internet tablets • iSip for the iPhone and iPod Touch • Internet Call for devices such as the Nokia N810 Internet Tablet • SIP Phone (note: Get the real name!) on cellphones

Many SIP-compatible Analog Telephone Adapters (ATAs) are also able to login to your SIP Sorcery account. One popular device is the Linksys PAP2T-NA ATA. There's a wikipedia overview of the PAP2T-NA, along with some useful links located here: http://en.wikipedia.org/wiki/Linksys_PAP2

The support page, including a link for downloading the latest firmware, for the PAP2T-NA may be found here: http://www.cisco.com/en/US/products/ps10029/index.html

A PDF version of the Admin Guide may be found here: http://www.cisco.com/en/US/docs/voice_ip_comm/csbpvga/ata/administration/guide/ ATA_AG_v3_NC-WEB.pdf

Following are screenshots and instructions for configuring your PAP2-NA to authenticate to your SIP Sorcery account.

1. Click "Line 1" from the Administration page

2. Enter your SIP Sorcery credentials. That's it. Hook up a standard analog phone to the Line 1 port on your Linksys device, pick up the phone, and enjoy unlimited calling to and from US-based phone numbers.

If you would like an alternative approach to configuring your Linksys ATA, see the configuration wizard available at Voxilla, available here: http://voxilla.com/voxilla/tools/device-configuration-wizard/linksys-pap2-pap2t- configuration-wizard

1. Connect the Linksys device to an open port on your home router. Attach an analog phone to line 1. Pick up the phone and dial "****" (Four stars). At the voice prompt, dial "110#" and take down the ATA's IP address that is given to you.

2. Using the Voxilla configuration utility, enter the IP address of the router in Step 1. Choose "SIPphone (STUN)" in Step 2. 3. Follow these examples for completing steps 3 through 6.

4. For steps 7 through 10, skip the Dial Plan, choose Line 1, select your timezone, and then start the process to configure your adapter. 5. When the Linksys configuration screen appears, change the proxy server from proxy01.sipphone.com to sipgate.com. If the screen does not look like this example, make sure you are on the Admin page, not the User page. 6. In case of irrecoverable errors, and you need to reset the Linksys adapter to the factory state, try these instructions found here: http://forums.linksysbycisco.com/linksys/board/ message?board.id=VoIP_Adapters&message.id=4659

A. Disconnect the ethernet cable from your PAP2T-NA

B. Dial ****73738# and wait for the Interactive Voice Menu to get activated (Note: "73738" spells "RESET" on your phone's dialpad)

If asked for a password, try 8995523# or 7756112# or 5465866# or 50274537# or 78196365# One of those passwords should work for you)

C. Enter 1 to confirm, press #, and then hang up the phone.

13. Configuring and Testing your SIP Calling Chain

If you are unable to follow the instructions in Section 8, following are screenshots and descriptions of the steps required to sign up for free accounts at various websites and instructions for connecting it all together for free calling. If you have completed all of the steps leading up to this point and are able to place calls from SIP clients or your ATA, you are finished and do not need to read this section.

1. Go to sipgate.com and click the "Sign up" link in the menu bar 2. From the signup page, enter your cellphone number and choose your carrier. 3. Sipgate will send a 4-digit code to your cellphone in a text message and wait for you to enter it on the website. Enter the code in the appropriate field. (No picture)

4. You will be taken through the signup process. Be sure to create a free Residential / sipgate ONE account. Important: Make sure that sipgate assigns a phone number to you. It is easy to get confused during the signup process and end up with an account that does not have a phone number assigned. (No picture)

5. From the main page, select Settings in the upper right corner.

6. Take note of the phone number shown in the center of the screen. If you do not have a phone number assigned, click "+ Phone Numbers" in the right navigation pane, make sure that one is assigned, and take note of it. Next, click "SIP Credentials" in the right navigation pane of the Settings page.

7. Review the SIP credentials shown in the pop-up window. Note that these credentials are NOT the same ones you use to login to the sipgate website. 8. With your sipgate phone number noted and your SIP credentials (SIP-ID and SIP- Password) also noted, you may log out of the sipgate website.

9. Visit sipsorcery.com and install the Microsoft Silverlight plug-in when prompted. Once installed, create a new account. (No picture)

10. Once logged in, click on the SIP Providers menu.

11. There are two windows on the screen, an upper window and a lower window. Click Add on the top row of the top window. 12. Create a new SIP Provider named "Sipgate" and enter the SIP-ID and SIP-Password into the Username and Password fields in the pop-up window. As a reminder, you do NOT enter the username and password you use to login to the sipgate website. The values you need come from the SIP Credentials link on the Settings page of your sipgate account.

13. Click Update at the bottom of the pop-up window and watch the bottom window on the screen, titled "SIP Provider Registrations". Within seconds of clicking Update, a new row should appear in the window, titled Sipgate. Make sure that the checkbox in the Registered column is checked. FREE CALLING WILL NOT WORK UNTIL THIS IS CHECKED.

14. Once the checkmark appears in Registered, you are ready to test your connection. Download and install X-Lite from Counterpath. With X-Lite installed and running, right click anywhere on the phone and choose SIP Account Settings. On the SIP Accounts screen, click Add in the upper right corner (no picture).

15. Enter your SIP Sorcery account details as shown. Here you will use your SIP Sorcery username and password from the website.

16. Click OK on the Properties of Account 1 screen and click Close on the SIP Accounts screen. You will be returned to the telephone interface and should see a Ready status with your SIP Sorcery username. 17. Use your cellphone to call the sipgate phone number you wrote down in step 6 above. X-Lite should indicate an incoming call. Answer the call by clicking the green button. Make sure you can hear sound in both directions.

18. Once you check the audio, return to the Google Voice website and add the sipgate line to your Google Voice account. Click Settings in the upper right corner and then Phones in the blue menu (if necessary). Click Add Another Phone at the bottom. Name the phone Sipgate. Do not select Mobile as the type of phone. Google Voice will display a 2-digit verification code and wait for you to click Connect. Click Connect and X-Lite will ring. Answer the call and type in the 2-digit code displayed on the screen. The line will be added to your list of managed phones.

19. With the line now verified in Google Voice, it is time to add dialout capabilities. Return to section 10 of this document and copy the entire dialplan into your clipboard. Highlight the entire script from "Begin Code" to "End Code" and hit Ctrl-C. Return to SIP Sorcery and click Dial Plans. 20. The Dial Plans page will have window displayed. You will see one entry titled "default".

21. Click on that row and a pop up window will appear. Highlight the sample script shown in the window, and hit Ctrl-V to paste the sample dial plan copied from this document. Return to section 11 of this document and carefully follow the steps required to customize the script. There are five pieces of information to enter: your home area code, your time zone, your Google Account username, your Google Account password, and the 10-digit phone number assigned to you by sipgate and tested in step 17. In the following two sections, remove the "#" in blue highlight from the one line at the beginning of each line associated with sipgate.

22. Once complete, click the Update button at the top center of the script editing window. You should now be able to dial any US phone number directly from the keypad of X-Lite. Test this by returning to X-Lite and dialing any known-good US-based phone number, such as your cellphone.

14. Additional setup screenshots

This document is a collaborative effort, so we are constantly looking for other setup instructions and screenshots. In particular, we would like to document the process for configuring these two very popular clients:

• sipdroid for Android devices • iSip for iPhone and iPod Touch 15. Revision History

12/04/2009 by norske - updates to the sipgate dialplan • highlighted user-specific entries for the dialplan in blue (easier to know exactly what should be changed to make the dialplan work for the new user) • added some speeddial codes (including for 1-800-WEATHERCALL) • replaced 747 (gizmo5) area code with 415 (sipgate) in what was line 80 • removed (2) # characters that were in front of the following two lines. They were causing syntax errors in line 80 of the dialplan when /(800|866|877|888|415)/ # US toll-free and sipgate-to-sipgate calls route(5,"Destination - US toll-free or sipgate") 12/04/2009 (AM) by EasternPA -

• removed 911 from the sipgate and Gizmo5 dialplans until we have a better method of hosting those life-critical services. Too risky otherwise IMHO. • updated the formatting line for the speed dial sections of sipgate and gizmo5 dialplans • replicated the highlighting in the Gizmo5 script • copied the new speed dial entries from sipgate to gizmo5. I'm wondering if we should build a separate section just for the speed dial directory to avoid having to replicate the entries between the sections. Keep the unique entries in each dialplan, but maintain a separate section for entries that are not unique to the SIP provider. As more SIP providers get added to the doc, it will get messy trying to replicate a long directory. That was also my original intention with creating the Wave. A separate place for a common speed dial directory. norske (6:30p): I agree that the speed dial section can remain fixed as-is. It provides plenty of examples for others to tweak their own to suit their specific needs. Another section would be OK - but especially useful if we have something really useful that may otherwise be tough to find. 12/04/2009 (PM) by EasternPA -

• Renamed section 9 to be Gizmo5-specific • Made extensive changes to section 10 to account for the recent spate of users unable to complete the process

12/05/2009 by EasternPA -

• Removed all references to the 3-line dialplan. That short dialplan no longer works (even with Gizmo5) • Worked with norske to re-sequence Section 10. We agreed that there should be an early test to ensure the path from sipgate to SIP Sorcery and the SIP client is up and running. Then the sipgate line should be registered in Google Voice. Then the dialplan should be copied over and customized. • Replaced "your Google Voice number" with ".*" in sipgate dialplan per Red Leatherman 12/08/2009 by norske (RE: the sipgate plan) • Moved all user-required entries to the front-end of the dialplan - so user doesn't have to make direct entries in the sys.GoogleVoiceCall line • Adjusted the sys.GoogleVoiceCall line to accept named parameters from the initial entry section

Added this bullet 12/10/2009: • note the final two parameter on this line of code in the sipgate plan:

sys.GoogleVoiceCall(GV_USER,GV_PASS,SIP_NUMBER,@num,'.*',1,30)

The 1 designates the Phone Type, where 1 = Home, 2 = Mobile, 3 = Work, and 7 = Gizmo. The default (no entry) is "2". For the sipgate plan, it could be that this parameter is not an absolute requirement.

The need to add a Phone Type is a recent change.. and is documented here:

http://sipsorcery.codeplex.com/SourceControl/PatchList.aspx

With respect to the final parameter - it's the "callback timeout"in seconds which is the amount of time the sipsorcery dialplan will wait for the GoogleVoice callback before giving up and continuing with the next dialplan command. The timeout must be between 5 and 60s and if not specified a default value of 30s is used."

I think that if you're OK with the default, then an entry isn't mandatory.

Here's a link to sipsorcery's dialplan help.. it's tough to read because of the gray background, but it does explain key parameters used in the dialplans.

https://www.sipsorcery.com/help/dialplans.html

12/09/2009 by norske • reposted the latest EasternPA document - that link was having issues this morning • fixed a couple of formatting issues (things bold and larger font than they're supposed to be)

12/10/2009 by EasternPA • reformatted the new user credentials area at the top of the sipgate script (a few lines were line-wrapped) • updated the comments in the Google Voice section of the sipgate script since users no longer need to enter their credentials in that section of the dialplan anymore

12/10/2009 by norske revised the gizmo dialplan to match the change I made to the sipgate plan on 12/08/2009 as outlined above... namely: • Moved all user-required entries to the front-end of the dialplan - so user doesn't have to make direct entries in the sys.GoogleVoiceCall line • Adjusted the sys.GoogleVoiceCall line to accept named parameters from the initial entry section 12/11/2009 (AM) by EasternPA Made MAJOR changes throughout the document. I created a new unified dialplan that is portable to users of both Gizmo5 and sipgate. Every section from 7 on has been edited, moved, or deleted. There are now two sets of two commented lines in the mandatory editing section and one line in each set must be uncommented based upon the provider the user has selected. I also nullified the checks for the AK, HI, Yukon, and toll free numbers since they are all properly handled by GV. I left the original code in place as comments in case anyone wants to experiment with it. One such change would be to specifically route 747 calls over Gizmo5, but only if a Gizmo5 account exists.

12/11/2009 (PM) by EasternPA Made another round of major changes. I have incorporated most of norske's screenshots as well as those provided by jamesgwvoice. I also resequenced the screenshots. For the users who are able to successfully follow the sequence straight through and can make calls via X- Lite by the end of section 11, they will see the screenshots for configuring the Linksys ATA.

For those users who aren't able to follow the steps in sections 8-11, they are referred to section 13 for a more detailed set of instructions, including screenshots walking them through the entire process.

12/12/2009 by norske • Added links to the front section of Section 12: - A wikipedia page on the PAP2T-NA - Cicso support page, and - User's guide to the Linksys PAP2T-NA • Added some Linksys PAP2T-NA commentary at the end of Section 13

12/12/2009 by EasternPA • Made a clickable Table of Contents