Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Mario Limonciello: Asterisk 1.8 and native Google Voice support

$
0
0
Last week the Asterisk development team announced Asterisk 1.8's release with native support for Google Talk / Gmail calling.  By doing so, a lot of the hackery that was previously done with bridging and AGI dialers in my earlier posts can be axed.

Even though Asterisk 1.8 was released, I didn't see any developers jumping on creating OpenWRT packages, so I decided to do so myself.  I've produced packages for both ar71xx devices (like the one I detailed in earlier posts) as well as brcm-2.4 devices that the market is flooded with.

These packages can be found at http://www.arctangent.net/~superm1/openwrt/.
I've also submitted the packaging changes to a ticket for inclusion in a future OpenWRT release at https://dev.openwrt.org/ticket/8132.

So for an ar71xx device, you would add this line to your /etc/opkg.conf:

  src/gz asterisk1.8 http://www.arctangent.net/~superm1/openwrt/ar71xx

If you've got asterisk 1.6 installed, you'll need to remove all of the associated packages for it before proceeding.

opkg remove asterisk16-sounds asterisk16-res-musiconhold asterisk16-res-agi asterisk16-func-db asterisk16-format-g726 asterisk16-form
at-g729 asterisk16-codec-g726 asterisk16-codec-a-mu asterisk16-app-system asterisk16

For Asterisk 1.8, I think these are the only packages you'll need:

opkg install asterisk18 asterisk18-func-db asterisk18-res-musiconhold asterisk18-chan-gtalk asterisk18-res-rtp-asterisk

Configuration Files

Once installed, you need to add your google information to /etc/asterisk/gtalk.conf.  This configuration will dump my incoming gtalk calls directly to a context that will be defined as 'google-in'.


[general]
context=google-in ; Context to dump call into

[guest] ; special account for options on guest account
disallow=all
allow=ulaw
;context=guest

[superm1-gtalk]
username=superm1@gmail.com
disallow=all
allow=ulaw
context=google-in
connection=superm1


Next configure jabber information in /etc/asterisk/jabber.conf.  This setup will cause you to always be signed into jabber, so make sure to set yourself away and give an informative message to know that it's a computer signed in, not a human.


[superm1] 
type=client
serverhost=talk.google.com
username=superm1@gmail.com
secret=(your password)
statusmessage=I am asterisk [*]
status=xaway

Lastly configure your /etc/asterisk/extensions.conf dialplan for the new inbound and outbound features.  This is built upon my previous dialplan.  It will support incoming sip or google talk/voice as well as outgoing SIP, toll free, and GV.



; --
; Inbound Calls
; --


; * This extension is where any external SIP calls should route to
[default]
exten => s,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Dial(SIP/101,10)
exten => s,n, Hangup
exten => 101, 1, Dial(SIP/101, 10)


; * From Google (superm1)
[google-in]
exten => superm1@gmail.com, 1, Dial(SIP/101, 180, D(:1))


; --
; Outbound Calls
; --


; * Default starting context for internal SIP devices
[mario-default]
include => local-devices
include => tollfree
include => gv-outbound
include => dial-uri


; * These are for any local extensions we should be supporting
[local-devices]
exten => _1, 1, Dial(SIP/101,10)


; * Toll free numbers (don't use GV for these)
[tollfree]
exten => _411, 1, Dial(SIP/18004664411@proxy.ideasip.com,60)
exten => _1800NXXXXXX,1,Dial(SIP/${EXTEN}@proxy.ideasip.com,60) 
exten => _1888NXXXXXX,1,Dial(SIP/${EXTEN}@proxy.ideasip.com,60) 
exten => _1877NXXXXXX,1,Dial(SIP/${EXTEN}@proxy.ideasip.com,60) 
exten => _1866NXXXXXX,1,Dial(SIP/${EXTEN}@proxy.ideasip.com,60)


; * Route the call using the google voice bridge
[gv-outbound]
;append an area code if necessary
exten => _NXXXXXX,1,Set(CALLERID(dnid)=1512${CALLERID(dnid)})
exten => _NXXXXXX,n,Goto(1512${EXTEN},1)
;append a 1 if necessary
exten => _NXXNXXXXXX,1,Set(CALLERID(dnid)=1${CALLERID(dnid)})
exten => _NXXNXXXXXX,n,Goto(1${EXTEN},1)
;do our real dialing
exten => _1NXXNXXXXXX,1,Dial(Gtalk/superm1/${EXTEN}@voice.google.com)
exten => _+1NXXNXXXXXX,1,Dial(Gtalk/superm1/${EXTEN}@voice.google.com)


; * Dialing by SIP URL eg foo@domain.com
[dial-uri] 
exten => _[a-z].,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)
exten => _[A-Z].,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)
exten => _X.,1,Dial(SIP/${EXTEN}@${SIPDOMAIN},120,tr)

Advantages / Disadvantages
Advantages
  • This configuration is far quicker and more like a real phone.  When you dial a number, it will be connected within seconds rather than 30's of seconds.
  • The quality seems better than the old way (and in theory should be less hops, and less latency)
Disadvantages
  • You have to always be signed into Google Talk/Chat with this solution.  If people IM you and you aren't on a computer, then the IM is lost in your gmail history.
  • If you are signed into Gmail Chat and the computer supports video (has the plugin installed) then your SIP phone won't ring.
Thanks
Thanks to Paul Jennings for helping to provide a quite functional configuration to get started here for me, as well as AST/Calling+using+Google for detailing all the options actually available to configure.

Updates
11/23:
This post seems to be the post that people are linking to and reading mostly when setting up Asterisk 1.8.  Just want to make sure I mention, there have been improvements since this post (as detailed in other future blog postings).  To avoid having to relive the learning experience I did with my other improvements, my (scrubbed for passwords) configs are available at http://www.arctangent.net/~superm1/gv_configs/

Viewing all articles
Browse latest Browse all 17727

Trending Articles