Using Asterisk as Sip Server with Google Voice


I have wanted for some time to buy a sip phone to plug directly into my network and use it with my google voice account, thus giving me a free house phone with unlimited minutes to all of north america (or wherever google decides). To do this I installed Asterisk 11.0 on my server and followed the documentation to get this set up. There were a few caveats that I will share, but the following link has everything needed to get asterisk working with your google voice phone number.

Using Asterisk with your google voice account is easy, but having a basic understanding of what is needed is absolutely essential. There are two protocols that Asterisk uses to control and send voice information with your phone, with either soft or hard phones. The SIP protocol controls the functions of your call – such as dialing, hanging up, transferring, and etc. The actual conversation for the phone is transported over RTP. Each one of these protocols uses UDP rather than TCP, and they both use different ports. In the sip.conf file you specify which port you want SIP to use, the default is 5060. In the rtp.conf file you need to actually specify a range of UDP ports that the protocol can use. The smaller the number of this range the more secure you will be, but don’t make it too small that you have no available ports to use if hanging up does not work successfully.

The other vital thing to understand is you are not connecting directly to google voice’s sip server. Rather you are connecting through jabber or xmpp. Connecting to the chat server will then allow you to handle call control.


  • The first problem I ran into is a fresh install of Asterisk includes far more configuration information than you actually need. In order for the SIP and RTP to work well I ended up commenting out almost all of the rtp.conf and sip.conf files in /etc/asterisk/.
  • The second problem I had was with the dial plan in the extensions.conf. I wanted to be able to dial long distance numbers without dialing 1 in front of the number. So I added the following outbound dial plan to use.
    exten => 100,1,Dial(Motif/google/,,r)
    exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN},,r)
    exten => _XXXXXXXXXX,1,Dial(Motif/google/1${EXTEN},,r)

    Then in the sip.conf I set the context=out for my user.

  • The last major problem I had was my firewall. I needed to open the UDP ports on my firewall. I use iptables for my firewall. I opened the ports successfully, but every time I used netstat or nmap to check if the port was open I wasn’t seeing anything. Later I discovered that UDP ports don’t actively listen like TCP ports and the ports were indeed open even if a scan wasn’t always showing it.

My next step is to set up better IP filters and error messaging so I can use Iptables to deny erroneous requests.

2 Responses

Subscribe to comments with RSS.

  • Amanda says:

    I am confused. i downloaded vmobile for WiFi minutes and i recieved a message telling me to sign into a sip server. What does that mean?

    • zaphinath says:

      SIP servers are just a way of transmitting control of a phone call through the internet. Wiki – Sip talks a lot more in detail about sip. Any softphone (like the one you downloaded) needs to have a sip server to connect to in order to make phone calls. You can usually talk to your internet service provider and see if they have any sip servers you could connect to (they will charge you per minute for your calls) or you can set up your own if you are really tech savie. If you are a customer of vmobile then you should talk to them about how to connect to their sip server.