If y'all've moved ahead to Asterisk 1.8 in production or are testing it out, employ FreePBX equally your configuration GUI, and want to add Google Vocalisation such that inbound and outbound routing can easily be configured from FreePBX, hither'southward a pocket-size how-to. Unless and until a GTalk FreePBX module comes forth, at that place'due south some command-line work to do, but just for initial configuration.

References:

  • Calling Using Google – Asterisk Project Wiki

How To Add Google Vox To FreePBX

Role 1: In the shell

  1. Refer to the Asterisk Wiki: Calling Using Google. We'll be following that every bit our guide.
  2. From the command line, as user root or asterisk, verify that the res_jabber and chan_gtalk modules are loaded.
    • [root@asterisk18 ~]# asterisk -rx "module show" | grep res_jabber
      res_jabber.so                  AJI - Asterisk Jabber Interface          0
      [root@asterisk18 ~]# asterisk -rx "module evidence" | grep chan_gtalk
      chan_gtalk.so                  Gtalk Channel Commuter                     0
    • If ane or both of those grep commands returns nothing, yous need to build the modules (don't forget to have OpenSSL development libraries installed) and make sure they are loading at Asterisk startup (autoload=yep OR load => res_jabber.so and load=> chan_gtalk.so in /etc/asterisk/modules.conf).
  3. There are three config files in /etc/asterisk to edit past hand (use vi, nano, emacs or whatsoever you like): jabber.conf, gtalk.conf, and extensions_custom.conf.
    • jabber.conf

      Edit or supersede jabber.conf to follow what is listed in Calling Using Google, and which I am pasting almost verbatim here. (I removed debug=yes.) This establishes the XMPP connexion.

      [general]
      autoprune=no
      autoregister=yes

      [asterisk]
      type=client
      serverhost=talk.google.com
      username=your_google_username@gmail.com/asterisk
      hugger-mugger=your_google_password
      port=5222
      priority=1
      usetls=yes
      usesasl=yep
      statusmessage="I am an Asterisk Server"
      timeout=100

    • gtalk.conf

      Again referring to the Asterisk wiki, edit gtalk.conf thus:

      [general]
      context=from-google
      allowguest=yeah
      bindaddr=0.0.0.0
      ;externip=1.2.3.4 ; if yous know your external ip addr
      stunaddr=stun01.sipphone.com ; utilize STUN if yous're on dynamic IP and NAT

      [guest]
      disallow=all
      allow=ulaw
      context=from-google
      connection=asterisk

      Some notes about gtalk.conf:

      • Utilize context from-google, which we will set up in the extensions_custom.conf.
      • connectedness=asterisk must match the connection definition (in square brackets) in jabber.conf.
      • Employ externip or stunaddr to go your external IP address if yous're behind a NAT.
    • extensions_custom.conf

      Make a department like this:

      [from-google]
      exten => s,1,Answer()
      exten => s,n,Expect(ii)
      exten => s,n,SendDTMF(1)
      exten => s,north,Set(CALLERID(num)=${Cut(CALLERID(proper noun),@,ane)})
      exten => s,n,Prepare(CALLERID(name)=${CUT(CALLERID(name),/,1)})
      exten => due south,n,Goto(from-trunk,YOUR-GV-NUMBER,1)
      exten => south,h,Hangup

      • Replace YOUR-GV-NUMBER with your Google Voice DID.
      • The Gear up commands ready upward the caller ID to get rid of the long XMPP ID that is passed on an inbound call.
  4. In one case these files are in place, restart Asterisk (amportal restart).
  5. Consequence the following command to see that the XMPP connection to Google Talk has been established:

    # asterisk -rx "jabber show connections"
    Jabber Users and their condition:
           User: ...@gmail.com/asterisk     - Connected
    ----
       Number of users: ane

  6. At present you're gear up to gear up a Google Voice trunk and inbound and outbound routes in FreePBX.

Part 2: FreePBX

  1. Add together a new Custom Trunk.
    • Trunk proper name: Google Phonation
    • Outbound Caller ID: put your Google Voice DID, even though this will be ignored (GV ever uses your GV number for the outbound Caller ID)
    • Dialed Number Manipulation Rules: Google Voice requires that the number be a full 11 digits, starting with 1. Either hither or in your outbound road (or both), make sure you are sending a full 11-digit number. See the screenshot for my config.
    • Custom Punch String: This is the near important part. Enter gtalk/asterisk/+$OUTNUM$@voice.google.com where asterisk matches the client definition in your jabber.conf (in square brackets). If y'all've followed this how-to exactly, so this line is correct.
    • Submit changes.
    • Screenshot (click for full version):
      gvtrunk-small.png
  2. Add a new Outbound Route.
    • You can ship whatever U.s. domestic calls through Google Voice. But configure an appropriate outbound route and select Google Vox as the trunk. In this screenshot, I accept configured 11-, 10-, and 7-digit dialing within my own area code.
    • Screenshot (click for full version):
      outroute-small.png
  3. Add a new Inbound Route.
    • Refer back to this line you lot entered in extensions_custom.conf: exten => s,n,Goto(from-trunk,YOUR-GV-NUMBER,ane) Whatever yous entered for YOUR-GV-NUMBER will be the DID you use for your inbound route.
    • Description: Google Voice (or whatsoever you want)
    • DID Number: YOUR-GV-NUMBER
    • Other stuff: defaults
    • Destination: wherever yous desire the incoming call to go. In my screenshot, it is directly dialing an extension.
    • Screenshot (click for full version):
      inroute-small.png
  4. Submit all changes and apply configuration. Done! You have added a Google Voice two-way trunk to FreePBX and tin employ it in your inbound and outbound routing. Don't forget to log in to Google Voice and select Google Chat (…@gmail.com) every bit the phone to which your incoming calls are forwarded!