How to make and receive calls using Google Voice without XMPP

I.    Introduction

Around 2010, before Asterisk 1.8 and Gtalk, I did some work to set up calls using Google Voice with callback through a DID channel.  I didn’t touch it for quite some time because gtalk with XMPP works very well.  Since Google is going to drop XMPP protocol in May 2014, people started to looking into the old fashioned way again.  Following approaches described in this blog (http://tech.iprock.com/?p=9784) and others’ comments, especially from those by davidnewt, I did some experiments and the set-up is pretty stable now.  I think it will be worthwhile to share with people have the same interest.  Below, I will describe the steps-by-step implementation of such an approach and what I have learned in the process.

The platform that I prefer most is Dockstar, which is an ARM based box, running Debian.  However, since it is no longer widely available, I repeated the installation process using Raspberry Pi with a version of Debian Wheezy.   The installation process should work without modification on any Linux box running Debian Wheezy and Ubuntu 12.04 or later.  With some minor modification, the process is also applicable to any linux systems.  Generally speaking, the GV callback approach can be run for Asterisk running on any ARM and X86 based systems.

To keep the implementation effort to be minimal, I use only plain Asterisk without GUI.  Only the basic system with call-out and incoming call functionalities are implemented.  With some knowledge of Asterisk, the system functionalities can be expanded as much as you like.

Now, let the fun part begin!

II.    The step-by-step guide of setting up an Asterisk PBX with GV callback.

A.    Set up a DID route

There are different ways to have DID services.  I feel the most available and easiest way to set up a DID is to get a DID number from IPKall (http://phone.ipkall.com/) and point it to your registration of a SIP portel.  Among the SIP portels, I had good experience with IPTel (http://www.iptel.org/) and Linphone (http://www.linphone.org/eng/linphone/register-a-linphone-account.html).  All of them are free.  However, you can use any DID route that you prefer.  What you need to do are as follows:

  1. Register with a SIP portel of your choice.  Below I will use IPTel in the examples.  After registering, you will have a user name [sipusername], and a password [sippassword].  The web address of IPTel is iptel.org.
  2. At the IPKall web page, you can choose an area code, enter sipusername@iptel.org in SIP URI fields, provide a valid email address and choose a password [DIDpassword] for IPKall.
  3.  You will receive an email to inform the DID number assigned to you.  Below I will use 253xxxxxxx as the DID number.
  4. You can test the DID number by using a softphone and enter your SIP Portel registration information [sipusername, sippassword, iptel.org].  (You can use an ATA with a phone attached to it instead of using the softphone as well.)
  5. If the softphone shows you are registered, you can call the DID number from another phone.  If your soft phone rings and you can receive the call, your DID number is ready.

(Note, the IPKall number is free but you have to at least use it once a month.  Otherwise, your number will be taken away.)

B.    Set up Google Voice (GV) and callback number.

If you already have signed up for Google Voice that you want to use, then skip the next steps and go to step 2

  1. Go to www.gmail.com and create a gmail account with gvusername and gvpassword.
  2.  Once the gmail account is established, go to www.google.com/voice and apply for a new GV number (gvnumber), if you don’t have one already.
  3. In www.google.com/voice webpage click at the symbol on the right of the second line and select settings.
  4. In the Settings menu, disable call screening in the Calls submenu
  5.  In the Phone submenu click on “add a phone” and use the [didnumber] that you got from IPKall in step A.3 as the number you want.  Google will try to verify that you have the number so you will need to have a softphone, or ATA, connect to the SIP account that you registered in step A.1.  Verify the number with GV.  The DID number [253xxxxxxx] will be your GV call back number.

C.    Install Asterisk

I use Asterisk 1.8 and Raspberry as an example.  I have tried Asterisk 11 and everything appeared also work but I didn’t test extensively.  Asterisk 1.6 will probably also work but I haven’t tested it.  It should work on any Linux box running Debian Wheezy.  Other Linux distributions should also work but may need some modifications.

  1. SSH into and log on your Raspberry Pi.
  2.  apt-get update
  3. apt-get install asterisk

For Debian Wheezy, Asterisk 1.8 will be automatically installed and that’s it.

D.    Install Python and pygooglevoice

Do the following under the Linux # prompt:

cd /root
apt-get -f install python-setuptools
easy_install simplejson
wget http://pygooglevoice.googlecode.com/files/pygooglevoice-0.5.tar.gz
tar zxvf pygooglevoice-0.5.tar.gz
cd pygooglevoice-0.5
python setup.py install
sed -i 's|https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral|https://accounts.google.com/ServiceLogin?service=grandcentral\&continue=https://www.google.com/voice|' /usr/local/lib/python2.7/dist-packages/googlevoice/settings.py
sed -i 's|      galx.*|      galx = re.search(r\"name=\\"GALX\\" type=\\"hidden\\"\\n *value=\\"(.+)\\"\", content).group(1)|' /usr/local/lib/python2.7/dist-packages/googlevoice/voice.py

Make a test call using Python at Linux prompt (not Asterisk):

# gvoice -e [gvusername@gmail.com] -p [gvpassword] call NXXNXXXXXX 253xxxxxxx 1

where NXXNXXXXXX is any US number.  You need to make sure the softphone or ATA is registered to the SIP account connected to the IPKall DID number and ready to receive the call.  If it rings, the phone at the other end will ring after you picking up the softphone.

E. Configure Asterisk

  1. For the basic calling, all need to be done is replacing two default Asterisk conf files, sip.conf and extensions.conf in the /etc/asterisk/ directory.  The examples of the files are given below.  Of course, you will need to insert your own GV and DID and SIP credentials into the proper place inside these two files.  The Asterisk PBX is set as to have three extensions: 201, 202 and 203.  Any of your softphones or SIP phones registered with the extensions can make outgoing calls.  If there are incoming calls to your GV number or the DID number, the phones registered with 201 and 203 will ring until one of them is picked up.
  2. In the sip.conf file, there is a register statement.  After replacing the original files with these two example files, restart the Asterisk by doing a “/etc/init.d/asterisk restart”.  Then do “asterisk –rvvv” to get to the CLI interface.  Inside the CLI interface, type “sip show registry” and hit the return.  It should show you that your SIP service is registered.
  3. Leave the CLI interface open and register your softphone with the Asterisk PBX and them make a call.  The CLI will show you all these activities.  Hopefully, you will be able to make a successful call after listen to a few seconds of music :-).
  4. In some Asterisk distributions, Music on hold functions may not installed correctly.  If you don’t here music after you dial a number and you really want to, please check the following:
    1. In the musiconhold.conf file, check the directory=… statement in the [default] section.  It is simply “directory=moh”, you may want to change it to “directory=/var/lib/asterisk/moh”.
    2. Look if there are music files in /var/lib/asterisk/moh directory with extensions of .gsm or .wav.  If there’s no files, you can get the files from here, or you can use your favorite music files.

Good luck!

III.    Acknowledgements and Disclaimers

First the acknowledgement:

I am not a network/software/VOIP person.  All of what I did are based the knowledge that I gained from Googling and exchanging with other more experienced people.  Thus, nothing described in this note is invented by myself.  All the credit should go to the people who proposed this approach and worked out the details, specifically, the authors, commenters and contributors of this blog mentioned previously.  What I did is just to make sure all of details that I described are correct and to verify it indeed works.  I would appreciate to have your feedback and comments.  If you have any questions, please let me know also.  I will try to answer them as much as I can.

Now the disclaimer:

As stated above, what I did is simply trying the GV callback approach designed and described by others.  It is experimental to say the most.  As we all know, whenever one goes online including performing VOIP activities, there are always security risks.  Thus, if you decide to follow what described in this blog, you should know the risks involved and you will be responsible for whatever action you are taken.  You will be responsible for any consequences of your actions.

Another point is that we don’t know what Google is going to do after May 15.  Even though the set-up following the above descriptions works today, there’s no guarantee it will work at that time.  We just have to hope it will.

IV.    Appendix

The configure files:

sip.conf (source)

[general]
context=phone                 ; Default context for incoming calls
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
bindport=5060                  ; UDP Port to bind to (SIP standard port is 5060)
externrefresh=60
localnet=192.168.1.0/255.255.255.0
udpbindaddr=0.0.0.0             ; IP address to bind to (0.0.0.0 binds to all)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
canreinvite=no
dtmfmode = rfc2833
tcpenable=no
;directmedia=yes
register => sipusername:sippassword@iptel.org:5060/253xxxxxxx
session-timers=refuse
disallow=all
allow=ulaw
allow=gsm

[201]
defaultuser=201
secret=secret1
type=peer
callerid="user1 "
host=dynamic
context=phone
outgoinglimit=1
incominglimit=1
canreinvite=no
nat=yes
qualify=yes

[202]
defaultuser=202
secret=secret2
type=peer
callerid="user2 "
host=dynamic
context=phone
outgoinglimit=1
incominglimit=1
canreinvite=no
nat=yes
qualify=yes

[203]
defaultuser=203
secret=secret3
type=peer
callerid="user3 "
host=dynamic
context=phone
outgoinglimit=1
incominglimit=1
canreinvite=no
nat=yes
qualify=yes

[DID]
context=sip
defaultuser=sipusername
type=peer
secret=sippassword
host=iptel.org
fromdomain=iptel.org
fromuser=253xxxxxxx
trustrpid = yes
sendrpid = yes
canreinvite = no
insecure=port,invite
nat=yes

extensions.conf (source)

[general]
static=no
writeprotect=no
autofallthrough=yes
clearglobalvars=yes
priorityjumping=no

[globals]
gtimeout=50    ; timeout value
; initialize
gvuser=10000

[sip]
exten => _253xxxxxxx,1,ExecIf($[${gvuser}!=10000]?Bridge(${gvuser}):Dial(SIP/201&SIP/203,60,D(:1)))
exten => _253xxxxxxx,n, Set(GLOBAL(gvuser)=10000)
exten => _253xxxxxxx, n, Hangup()
[phone]
include => sip
include => gv-outbound
[gv-outbound]
exten => _NXXNXXXXXX,1,GoTo(1${EXTEN},1)
exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,n,Set(GLOBAL(gvuser)=${CHANNEL})
exten => _1NXXNXXXXXX,n,System(gvoice -e gvusername@gmail.com -p gvpassword call ${EXTEN} 1253xxxxxxx 1 &)
exten => _1NXXNXXXXXX,n,Ringing
exten => _1NXXNXXXXXX,n,Wait(30)
exten => _X.,n,Noop(Never received callback from Google Voice on channel ${gvuser} . exiting)
exten => h,1,GotoIf($["${CHANNEL(state)}" = "Ring"]?:bridged)
exten => h,n,Noop(Hangup on channel ${gvuser})
exten => h,n,System(gvoice -e gvusername@gmail.com -p gvpassword cancel &)
exten => h,n, Set(GLOBAL(gvuser)=10000)
exten => h,n,Hangup()
exten => h,n(bridged),Noop(The channel has been bridged successfully)
exten => h,n, Set(GLOBAL(gvuser)=10000)

161 thoughts on “How to make and receive calls using Google Voice without XMPP

  1. Thanks for your post. It has helped me, a complete newbie with asterisk, to transition from the Obi->XMPP Google Voice setup to the automatic callback. I use Callcentric’s free DID for callback. I have a question: I want to dial callcentric’s 1777XXXXXXX numbers directly withouth the Google Voice callback. What’s the best way to accomplish that?

    Thanks!

    • With the callback approach installed and working, you don’t need to do anything. Asterisk does not distinguish between the GV forwarding or calls directly to callcentric DID. If you don’t want to set-up asterisk, your ATA can directly register to callcentric to receiver DID. Please let me know if you have further questions.

  2. Thanks for your reply. I think I was not clear about what I wanted to do. I want to be able to dial out to 1777XXXXXXX numbers. RIght now all numbers are called via the google voice callback and since 1777XXXXXXXX is not a valid number, the call fails on the google size of course. I need a rule which would catch the 1777 numbers and dial them directly via the callcentric trunk. Not sure how to do it because I don’t really understand the order in which the rules are processed. I added a rule which I thought would do what I wanted but the 1777XXXXXXX numbers were still being routed via that callback route. Thanks again!

    • 1777xxxxxxx is an ip number. You cannot dial out using this approach. I don’t know how to connect using the ip phone numbers in this case.

  3. I managed to get your instructions working. I used IPKall and CallCentric. I am pretty sure it was necessary to register the IPKall number to the GV account. I didn’t see that step entered. I also had to edit the area code from 253 to the one I got from IPKall.

    One feature I don’t get, with 2 SIP phones connected to extensions 201 and 203, is the ability to call from extension to extension, or the ability to hit * and have GV re-ring whichever other extension did not answer. GV wouldn’t understand how I could want that when both SIP extensions on Asterisk appear to GV as just the one registered number to ring to. So perhaps there might be a need or at least a way to transfer a call from extension to extension if that is needed? Any idea how to do that? It is kind of part of maintaining the GV feature using the callback.

  4. If you get a DID for your Callcentric account, you can also use it for GV callback. In both cases, you will need to use the DID number register with GV account as discussed in Step B.5.
    To focus on the GV callback discussion, I didn’t include what needed for call between extensions in sip.conf or other features. You can take a look of the comment by sizhutou, who had shown how to do this. If there are additional features you want and found out how to do, you may want to share with others as well.

  5. Thanks a bunch for the guide. It helped a lot.

    I followed the instruction and I am able to make a test call by using gvoice command. After modify sip.conf and extentions.conf and restart asterisk service, asterisk “sip show registry” shows the correct info. However I got “the number you dial xx-xxx-xxxx” was rejected by service provider, reason 403″ everytime I make an outgoing call. Asterisk CLI doesn’t show any log message.

    Any idea? Thanks!

    • Looks like your ATA/softphone is not registered to your Asterisk. If you do a “sip show peers” can you see it is registered to the extension, e.g., 201? Did your ATA/softphone shows it is registered with your asterisk? After testing using linux GVoice command, you need to disconnect the ATA/softphone from you ATA registration to the DID and re-register it to your asterisk.

      • “sip show registry” result:

        Host dnsmgr Username Refresh State Reg.Time
        iptel.org:5060 N sipusername 105 Registered Wed, 07 May 2014 15:01:47
        1 SIP registrations.

      • Dumb question: I have my cordless phone system hook to my ATA box(Obi100). Both Pogoplug and ATA box are connecting to my router. I confirmed the ATA/softphone is registered to both ATA registration and Pogoplug Asterisk registration now. This doesn’t look right. But if I disconnect the ATA/softphone from ATA registration(still not sure how to do that, just delete SP configuration. Obi100 supports two SPs.), then what do I use the ATA box for? Thanks a bunch!

  6. “sip show peers” result:
    Name/username Host Dyn Forcerport ACL Port Status
    201/201 (Unspecified) D N 0 UNKNOWN
    202/202 (Unspecified) D N 0 UNKNOWN
    203/203 (Unspecified) D N 0 UNKNOWN
    DID/sipusername xx.xx.xx.xx N 5060 Unmonitored
    4 sip peers [Monitored: 0 online, 3 offline Unmonitored: 1 online, 0 offline]

    How to register sip phone with extension?

  7. Looks like your ATA/softphone is not registered with your asterisk. As how to register, it depends on which ATA/softphone that you are using. In general, e.g., for XLite softphone, you will need to enter your Pogo’s ethernet address (e.g., 192.168.1.x) as Domain. the extension, e.g., 201, as the user ID (maybe also as the authorized username), and password as you set on your asterisk. As for other ATA/softphones, you can ask people familiar with your device to help.
    Good luck.

    • Made some progress. When I make an outgoing call, hear default ring then seems like call dropped after 4-5 seconds, it turns into dial tone. The phone I called on the other end does ring after that but the caller is in bad state.

      Asterisk log:

      — Executing [1##########@phone:1] Answer(“SIP/201-00000012”, “”) in new stack
      — Executing [1##########@phone:2] Set(“SIP/201-00000012”, “GLOBAL(gvuser)=SIP/201-00000012”) in new stack
      == Setting global variable ‘gvuser’ to ‘SIP/201-00000012’
      — Executing [1##########@phone:3] System(“SIP/201-00000012”, “gvoice -e gvusername@gmail.com -p gvpass call ####### 1425###### 1 &”) in new stack
      — Executing [1##########@phone:4] Ringing(“SIP/201-00000012”, “”) in new stack
      — Executing [1##########@phone:5] Wait(“SIP/201-00000012”, “30”) in new stack
      == Using SIP RTP CoS mark 5
      [May 8 04:53:41] WARNING[1681]: ast_expr2.y:1488 op_div: non-numeric argument
      — Executing [425#######@sip:1] ExecIf(“SIP/DID-00000013”, “1?Bridge(SIP/201-00000012):Dial(SIP/201&SIP/203,60,D(:1))”) in new stack
      — Locally bridging SIP/DID-00000013 and SIP/201-00000012
      == Spawn extension (phone, 1##########, 5) exited non-zero on ‘Bridge/SIP/201-00000012’
      — Executing [h@phone:1] GotoIf(“Bridge/SIP/201-00000012”, “0?:bridged”) in new stack
      — Goto (phone,h,6)
      — Executing [h@phone:6] NoOp(“Bridge/SIP/201-00000012”, “The channel has been bridged successfully”) in new stack
      — Executing [h@phone:7] Set(“Bridge/SIP/201-00000012”, “GLOBAL(gvuser)=”abc””) in new stack
      == Setting global variable ‘gvuser’ to ‘”abc”‘
      — Executing [h@phone:6] NoOp(“SIP/201-00000012”, “Never received callback from Google Voice on channel “abc” . exiting”) in new stack
      — Auto fallthrough, channel ‘SIP/201-00000012’ status is ‘UNKNOWN’
      — Executing [h@phone:1] GotoIf(“SIP/201-00000012”, “0?:bridged”) in new stack
      — Goto (phone,h,6)
      — Executing [h@phone:6] NoOp(“SIP/201-00000012”, “The channel has been bridged successfully”) in new stack
      — Executing [h@phone:7] Set(“SIP/201-00000012”, “GLOBAL(gvuser)=”abc””) in new stack

      Still need some help/advise, thanks!

      • Looks like the problem is this one: “== Spawn extension (phone, 1##########, 5) exited non-zero on ‘Bridge/SIP/201-00000012′” but I don’t know why. I don’t think I have ever seen such a phenomenon before. Can you try to login it using another device such as a softphone and/or to another extension, such as 202.
        Have you tried to call your GV number or DID number from another phone to see if it works?
        You might want to ask other more experienced people in Asterisk to see why this is happening.

      • Not sure the following applies to your case:
        I was having trouble with IPall number linked to iptel.org. Direct calling that number was OK, however, calls forwarded from Google Voice would hang up immediately after hearing a beep. That’s why I went with Call Centric. Yesterday I created an account at sip2sip.info and linked my IPall number to sip2sip.info. Surprisingly, everything worked and no more dropped calls!

  8. I have successfully hooked up my Android phone using the CsipSimple app to Asterisk with this method and I have a few comments and questions.

    1) I see that the SIP app allows sending text messages. And I saw in the GVoice python script that there is also some support for SMS. Is there any way to use those capabilities together, perhaps hooking them up in another Asterisk .conf file?

    Note: Using 2 Android SIP apps registered at the same time I was not able to send a text message from phone to phone so there would be issues within Asterisk to configure beyond the above, especially since IPKall might not pass that through between GV and Asterisk. From the asterisk messages log file I was able to see that it got the sending SIP client’s text message attempt.

    2) I was seeing error messages in the Asterisk log file about each registered extension having an error on voice mail. I fixed that! In CsipSimple in its “expert” mode for SIP configuration I found way down on the list a check box for subscribing to “message waiting indication” that I was able to uncheck, and that quietted the log file. Is there any better way to actually enable that feature within Asterisk?

    3) I am using IPKall and a free public SIP service. I recall that IPKall really would let me specify my own Asterisk server as the SIP server. Is there any way to skip the public SIP server step? This requires that the Asterisk server be reachable at a public host name, and although my home network uses a NAT router I was able to make this work using Dynamic DNS. I think it might be possible to use your wonderful method for setting up Asterisk and GV skipping 1 level of outside dependency.

    4) I also have an old SIP ATA phone adapter I have not used in a while, a Cisco ATA 186. No matter what I tried I was not able to get that to work with the new Asterisk configuration. Any tips for how to achieve that would be very much appreciated. The ATA device works, and I can use it to register to the SIP server I used as part of the setup process, just not as an extension on my own SIP server.

    • I just followed exactly twinclouds’ steps. After you are able to make test call by using gvoice command, then start configure asterisk. Just use the configuration provided by twinclouds and replace with your gvuser, gvpass and DID.

      One thing I need to bring up is: change localnet in sip.conf to match with your subnet. You probably want to change the secret key for user 201,202,203.

      Then you have to disconnect your Obi device from original service provider and register it to your own asterisk server. You can do it in Obitalk web portal. My SP1 used to be GV now I will register SP1 to my asterisk server(Pogoplug E02). Proxy server is the IP address of my Pogo device(192.168.1.x, my Pogo device and Obi device are in same subnet.), user: 201, password is the secret key you specified in sip.conf. Wait for a while then you should be able to see SP1 status as registered.

      Reboot your asterisk device(I found out better reboot your router as well), then open asterisk CLI “asterisk -rvvv”, run command “sip show peers”, you should be able to see both 201 and DID online.

      Hope it help.

  9. Hi! Hmm… on the gvoice command I get an error. I tried the sip show peers, it didn’t work either.

    I’m running CentOS with Asterisk & FreePBX.

    Any ideas?

    Here’s my output.

    [root@host pygooglevoice-0.5]# gvoice -e @gmail.com -p call NNN####### NNN####### 1
    Traceback (most recent call last):
    File “/usr/bin/gvoice”, line 79, in
    login()
    File “/usr/bin/gvoice”, line 49, in login
    voice.login(options.email,options.passwd)
    File “/usr/lib/python2.6/site-packages/googlevoice/voice.py”, line 70, in login
    galx = re.search(r”name=\”GALX\”\s+value=\”(.+)\””, content).group(1)
    AttributeError: ‘NoneType’ object has no attribute ‘group’
    [root@host pygooglevoice-0.5]# sip show peers
    -bash: sip: command not found
    [root@host pygooglevoice-0.5]#

    • Not sure why your sip show peers not show anything. Were you be able to log you ATA/softphone successfully? Also, what sip show registry told you?
      As for the gvoice command, looks like you didn’t do the patches correctly. With different version of Linux, the position of the python files may be different. But this is independent of sip show commands.

  10. Thank you for the detail guide. I was able to install asterisk and pygooglevoice on my router (Tomato), Everything works except outbound call. Here is the message from unknown*CLI>.

    == Using SIP RTP CoS mark 5
    — Executing [17022188623@phone:1] Answer(“SIP/201-00000000”, “”) in new stack
    — Executing [17022188623@phone:2] Set(“SIP/201-00000000”, “GLOBAL(gvuser)=SIP/201-00000000”) in new stack
    == Setting global variable ‘gvuser’ to ‘SIP/201-00000000’
    — Executing [17022188623@phone:3] System(“SIP/201-00000000”, “gvoice -e gvusername@gmail.com -p gvpass call 1########## 1253xxxxxxx 1 &”) in new stack
    — Executing [17022188623@phone:4] Ringing(“SIP/201-00000000”, “”) in new stack
    unknown*CLI>
    Disconnected from Asterisk server
    Executing last minute cleanups

    asterisk server was disconnected when reach to Ringing line.
    What do I do to fix the issue?
    Thanks

    • I have never be able to make it work on Tomato. The main issue is I cannot install Python correctly. If you are able to please let me know how you did that.
      If you python is working, were you be able to make call using the Linux command line method as I described in the tutorial?

  11. Here is what did.
    1. install TomatoUSB on your router.
    follow the steps on the third post. http://www.fatwallet.com/eXpansys-USA-coupons/belkin-share-max-n300-wireless-n-gigabit-dual-usb-router-w-dd-wrt-and-tomato-support/36121-3/.

    My router is Belkin Share Max N300 Wireless N+ Router, and I used a 512m USB drive.

    2. install Optware on TomatoUSB. http://tomatousb.org/tut:optware-installation

    3. install asterisk18 under optware
    cd /opt
    ipkg update
    ipkg upgrade
    ipkg install asterisk18

    4. install python and pygooglevoice
    ipkg install python *python 25 will be installed.
    ipkg install py25-setuptools
    ipkg install py25-simplejson
    wget http://pygooglevoice.googlecode.com/files/pygooglevoice-0.5.tar.gz
    tar zxvf pygooglevoice-0.5.tar.gz
    cd pygooglevoice-0.5
    python setup.py install

    sed -i ‘s|https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral|https://accounts.google.com/ServiceLogin?service=grandcentral\&continue=https://www.google.com/voice|’ /opt/lib/python2.5/dist-packages/googlevoice/settings.py
    sed -i ‘s| galx.*| galx = re.search(r\”name=\\”GALX\\” type=\\”hidden\\”\\n *value=\\”(.+)\\”\”, content).group(1)|’ /opt/lib/python2.5/dist-packages/googlevoice/voice.py

    note: The paths of the two files are different under optware. Also gvoice is under /opt/local/bin directory

    I can make call using the command line, and incoming call is fine too.

      • not sure if it relates to SIP channel. Here is a warning when I tried.
        WARNING[2678]: app_dial.c:2345 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 – Subscriber absent)

  12. After remove “exten => _1NXXNXXXXXX,n,Ringing” line in extensions.conf, it worked. it is surprising. After 3-4 seconds silence, my phone starts to ring. I don’t know why.

    ;exten => _1NXXNXXXXXX,n,Ringing
    exten => _1NXXNXXXXXX,n,Wait(30)

  13. I’ve tried installing this on an ASUS router using entware, and am able to install everything fine. I can start gvoice and get a prompt, but if I try to login, then the login fails. Tried accessing the webpage through Lynx (as described by one commenter), but I get a whole rigamarole about certificates and cookies. Apparently, it is a SSL issue. The google server response is:

    SSL error:unable to get local issuer certificate-Continue? (y)

    Then I get a bunch or requests to accept cookies. I’ve installed libopenssl and python-openssl. Any thoughts on what the ssl implementation requires?

    • I have never used on routers, especially on entware. Maybe there are others who can help. Or you can figure out how to make it work and post to help others.

      • I determined that I needed to install the package “pyopenssl”, in addition to the packages “libopenssl” and “python-openssl.” That allowed me to login to googlevoice and get a gvoice prompt from the command prompt, as follows:
        #gvoice
        Email address: [enter gmail address]
        Password: [enter password]
        gvoice>

        Then I tried to issue a “call” command, as follows:
        call NXXNXXXXXX 206XXXXXXX 1

        But no response. Also, if I try to login and issue the call command all at one time (as per you instructions, i.e. # gvoice -e [gvusername@gmail.com] -p [gvpassword] call NXXNXXXXXX 253xxxxxxx 1), the login will fail.

      • Found the error – I failed to notice that my google voice password had special characters interpreted by the bourne shell, so I couldn’t pass the login password as a -p argument in the gvoice command executed by the shell.

        After changing my google voice password, the gvoice command is working interactively, by passing arguments and by checking the parameters in the .gvoice file in my home directory. However, I still can’t bridge a call. I can dial out, but the callback is never bridged to the outgoing channel I’m on. It is received however. I use an IPKALL DID and anveo, and I noticed that the call from anveo does not show my forwarding number in the callerid, but a changing, different number from anveo. There is nothing to match the extension to cause inbound call to bridge to the outbound channel. Do calls from Callcentric or others always identify as your Google Voice forwarding number when the call back is made?

  14. tell me callcentric service requires taking 911 service? I can not take a free DID without 911.

  15. I can’t pas this step without paying E911. I have done it before without this step. Has something changed?

  16. Getting the following error:

    self.logger.warning(‘No special token found after login: %s’ % e)

    Both patches applied successfully and paths all seem fine. Any ideas?

    • I have no idea. Did this happen when you run it as the linux command? The only thing I can think of is checkong the patched files to see if they are the same as should be. For the galx patch, you can check “http://stackoverflow.com/questions/19661031/googlevoice-will-not-programatically-login-python” to see what should be.

  17. Todd:
    I had problem with anveo also. I have tried local phone, iptel, linphone to work with IPKall and had no problem. You can also register for a free DID from callcentric to try.

    • Finally, success! I followed your lead, signed up for a linphone account and pointed my IPKALL DID to it. Worked with the sip.conf and extensions.conf files in your instructions. So a powertip – don’t use Anveo sip service for this method.

      One more thing for those trying this using entware on a router (mine is an ASUS RT-N16) – I needed to uninstall Asterisk 1.8 and install Asterisk 11 instead. As far as I could discern, Asterisk 1.8 for entware didn’t have the bridge_simple.so module in the build. Installing Asterisk 11 and then installing the package “asterisk11-app-confbridge” using the opkg package manager gave me the needed module for bridging a call in asterisk.

      • I loaded chan_bridge.so, but neither bridge_simple nor app_confbridge (Asterisk 11, loaded about 40 modules in total)

      • Hi, Todd:
        I repeated what you did on Openwrt on WR703n with 16M/64M flash/ram. I haven’t tried the asterisk portion yet, but, at least the Linux command gvoice is working. One additional module need to install is “python-expat”. I will try using asterisk to make call later but want to make a note here.

  18. To sizhutou – in entware 1.8 bridging failed and there was no way to load any of the bridging modules mentioned in the documentation at http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-CHP-5-SECT-1.html. In asterisk 11, I still could not load any of the bridging modules. When I installed the package “asterisk11-app-confbridge” these modules were loaded for me by the app. I made a guess that it was the bridge_simple.so module that was the missing piece that was preventing the call from bridging. Perhaps it was just that I needed the built-in features of asterisk11 instead of asterisk 1.8? I readily admit that I am a newb at this.

    • Todd:
      Are you sure we need the bridge modules for the Bridge function to work? I my implementation of the dial back method in Asterisk on Debian, no bridge modules are loaded. The following are a list of all of the modules loaded in modules.conf:

      autoload=no
      load => res_rtp_asterisk.so
      load=res_crypto.so ; Cryptographic Digital Signatures
      load=cdr_csv.so ; Comma Separated Values CDR Backend
      load=chan_sip.so ; Session Initiation Protocol (SIP)
      load=codec_g726.so ; ITU G.726-32kbps G726 Transcoder
      load=codec_gsm.so ; GSM/PCM16 (signed linear) Codec Translat
      load=codec_ulaw.so ; Mu-law Coder/Decoder
      load=format_gsm.so ; Raw GSM data
      load=format_ilbc.so ; Raw iLBC data
      load=format_pcm.so ; Raw uLaw 8khz Audio support (PCM)
      load=format_sln.so ; Raw Signed Linear Audio support (SLN)
      load=format_wav.so ; Microsoft WAV format (8000hz Signed Line
      load=format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM)
      load=app_dial.so ; Dialing Application
      load=app_macro.so ; Extension Macros
      load=app_senddtmf.so ; Send DTMF digits Application
      load=app_verbose.so ; Send verbose output
      load=pbx_config.so ; Text Extension Configuration
      load=app_verbose.so ; Send verbose output
      load=pbx_config.so ; Text Extension Configuration
      load=func_callerid.so ; function CALLERID()
      load=func_db.so
      load=func_math.so
      load=func_channel.so
      load=func_strings.so
      load=func_logic.so
      load => res_musiconhold.so
      load => codec_ulaw.so
      load => func_global.so
      load => app_system.so
      load=app_exec.so

      • You’re right, chan_bridge.so is unnecessary, here’s my list of modules (for GV, voicemail, musiconhold):

        ubuntu*CLI> module show
        ubuntu*CLI> 
        Module                         Description                              Use Count 
        ubuntu*CLI> 
        app_db.so                      Database Access Functions                0         
        ubuntu*CLI> 
        app_dial.so                    Dialing Application                      0         
        ubuntu*CLI> 
        app_exec.so                    Executes dialplan applications           0         
        ubuntu*CLI> 
        app_playback.so                Sound File Playback Application          0         
        ubuntu*CLI> 
        app_stack.so                   Dialplan subroutines (Gosub, Return, etc 0         
        [Kubuntu*CLI> 
        app_system.so                  Generic System() application             0         
        ubuntu*CLI> 
        [0Kapp_voicemail.so               Comedian Mail (Voicemail System)         0         
        ubuntu*CLI> 
        cdr_csv.so                     Comma Separated Values CDR Backend       0         
        ubuntu*CLI> 
        chan_local.so                  Local Proxy Channel (Note: used internal 0         
        ubuntu*CLI> 
        chan_oss.so                    OSS Console Channel Driver               0         
        ubuntu*CLI> 
        chan_sip.so                    Session Initiation Protocol (SIP)        1         
        ubuntu*CLI> 
        codec_alaw.so                  A-law Coder/Decoder                      0         
        ubuntu*CLI> 
        codec_g729.so                  g729 Coder/Decoder, based on Intel IPP   0         
        ubuntu*CLI> 
        codec_gsm.so                   GSM Coder/Decoder                        0         
        ubuntu*CLI> 
        codec_ilbc.so                  iLBC Coder/Decoder                       0         
        ubuntu*CLI> 
        codec_ulaw.so                  mu-Law Coder/Decoder                     1         
        ubuntu*CLI> 
        format_g729.so                 Raw G.729 data                           0         
        ubuntu*CLI> 
        format_gsm.so                  Raw GSM data                             0         
        ubuntu*CLI> 
        format_ilbc.so                 Raw iLBC data                            0         
        ubuntu*CLI> 
        format_sln.so                  Raw Signed Linear Audio support (SLN) 8k 1         
        ubuntu*CLI> 
        format_wav.so                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0         
        ubuntu*CLI> 
        func_callerid.so               Party ID related dialplan functions (Cal 0         
        ubuntu*CLI> 
        func_channel.so                Channel information dialplan functions   0         
        ubuntu*CLI> 
        func_db.so                     Database (astdb) related dialplan functi 0         
        ubuntu*CLI> 
        func_global.so                 Variable dialplan functions              0         
        ubuntu*CLI> 
        func_logic.so                  Logical dialplan functions               0         
        ubuntu*CLI> 
        func_math.so                   Mathematical dialplan function           0         
        ubuntu*CLI> 
        func_rand.so                   Random number dialplan function          0         
        ubuntu*CLI> 
        func_strings.so                String handling dialplan functions       0         
        ubuntu*CLI> 
        pbx_config.so                  Text Extension Configuration             0         
        ubuntu*CLI> 
        res_adsi.so                    ADSI Resource                            0         
        ubuntu*CLI> 
        res_agi.so                     Asterisk Gateway Interface (AGI)         1         
        ubuntu*CLI> 
        res_crypto.so                  Cryptographic Digital Signatures         0         
        ubuntu*CLI> 
        res_http_websocket.so          HTTP WebSocket Support                   0         
        ubuntu*CLI> 
        res_musiconhold.so             Music On Hold Resource                   0         
        ubuntu*CLI> 
        res_rtp_asterisk.so            Asterisk RTP Stack                       1         
        ubuntu*CLI> 
        res_smdi.so                    Simplified Message Desk Interface (SMDI) 0         
        ubuntu*CLI> 
        37 modules loaded
        

        I found 3 modules are loaded regardless of my instructions in modules.conf: res_adsi.so, res_crypto.so, and res_smdi.so. Do you have a way to eliminate them?

  19. I tried this dialback approach on Openwrt installed on TP-Link WR703n with 16M flash. I had some problems because some of the modules were not available on the Openwrt Trunk version (Asterisk 1.8.27). On the other hand, the AA/12.09 version (Asterisk 1.8.10), registration does not work. Today, it appears that the modules are available now. After installed the necessary modules, it works fine. The Python installation is as Todd described with “python-expat” installed.
    No bridge related modules are needed.

  20. This has been a very helpful post and comments – on a ubuntu box with asterisk 11.10 that I already had up connected to some other items, I was able to get this to work, a call-centric account, ipkall number and my long-existing gv account – neat trick with the bridging on the call back.
    One question – on the callback, I dont get a dialed number, it always ends up on s, and as far as I can tell, you configured that for the DID number.. some setting I am missing perhaps?
    You have
    exten => _253xxxxxxx,1,ExecIf(…
    I tried that with the 425 area code my number is in, as well as _X. but I can not get it to work with anything but s.

    When looking at the sip debug logs, I can see the call-centric 1777– number, and the number I am testing from, but I dont see anywhere the 425— number

    I guess it isnt a real issue with using s as long as this is my only registerred SIP provider – but if I wanted to add more I need a way to distinguish the calls, and as far as I know, this always come in at the default context (as defined in sip.conf general).

    I am also seeing the issue where GV sends a phony caller-id when it connects via the IPKall number, I see quite a few people have that issue out there.

    I put my config here – masked out with 0000000 instead if the real numbers and user/pass etc – if anyone like to take a look (during testing I split it up to another context for the gv-dialing as I will be adding international dialing rules for google voice as well)
    stokkeland.net/sip/sip.conf
    stokkeland.net/sip/extensions.conf

    Any comments/feedback would be great.

    • If you use a 425xxxxxxx number with callcentric (CC), have you put it on end of the registry statement and the “fromuser=425xxxxxxx” statement in DID section in sip.conf? I had never had this problem when I use a similar setup as yours.
      Since you are using CC, it might be easier to simply use its free DID number. I used to have some problem with CC but no more. If you do so, you don’t have to worry about the one month expiration of ipkall.

    • register => 17770000000:mysecret@callcentric.com/425xxxxxx
      whatever after the slash becomes your entry point in extensions.conf

  21. Hey All, I configured my Pi using the config files provided on this site and my own accounts and registered a Cisco 7940G with the Pi. Whenever I try to make a call, I’m greeted with a busy tone. Any suggestions?

    • SSH to your Pi and do “asterisk -rvvv”. It should bring up the asterisk CLI. Make a call and check what show on the Asterisk CLI to find out what’s things going on.
      Another cause of problem is your IP phone. You can use a soft phone, e.g., XLite, instead to see if it works.

      • Thank you for helping me out! I’m new to using Asterisk and just to clarify, should the global gvuser be set to my account name instead of “abc”. Also what is the command to call? I tried using dial nnnnnnnnnn@internal but the command did not take.

  22. “abc” is just a dummy variable indicate it is not an extension in the gvuser global variable. You can use it as is without change.
    Not sure what do yo mean by the command to call. You just dial a phone number on your IP phone or softphone to see what happens on Asterisk CLI.
    You probably need to read a little more about the basics of Asterisk.
    I am not an expert of Asterisk either, but just learned how to use its basic features.

  23. Hello,I want to forward the call to my real att number.Do I have to register for a sip account on iptel?How should I write the configuration file?

    • Not sure what do you want to do. If you want the calls to your GV number to ring you att number, you can simply put your att number in you GV account as one of the call forwarding numbers.

  24. twinclouds,
    Looks like the gvoice command is not working any more. I hasn’t been able to initiate any calls during the past week. It did log in, but wouldn’t make any calls. Is it due to changes of https://www.google.com/voice web page? Is there any fix?

    • Mine still works. I also had problem with one account that I cannot set forward number. The reason was that account does not have a GV number. I think it was because the number was taken away by Google due to no activity. Other accounts with an active GV number have not problem at all. You might want to check if your account has any GV number associated with it. If not you can request another one. Good luck!

      • My both accounts are still active as I can initiate calls from the webpage and receive incoming calls as usual.
        Just there’s no response once I issue the gvoice command (there will be a login activity in my google account, but no call history).
        I’ll try to reinstall python library and pygooglevoice.

      • Since XMPP is working now, you can actually use it instead of the call back approach. Most of mine are already using XMPP but I kept a couple just in case.
        Both approach should work.

  25. Turned out to be a network problem. Got it fixed after disabling IPv6. Before figuring it out, I upgraded to Asterisk 13 with res_xmpp and chan_motif. Now I’m using pygooglevoice and Motif at the same time. Thanks for assuring me that both ways were still working.

Comments are closed.