FYI Confused on Google Voice

Kimberly

Member
Joined
Jul 16, 2013
Messages
44
Reaction score
13
I thought Google Voice was changing and that we could no longer connect to it from our PBXIAF boxes. Simon Telephonics was going to shut down. Now I see Simon Telephonics is starting a new server offering a SIP gateway to Google Voice. How is Simon Telephonics connecting to Google Voice if Google was changing things making it no longer possible? I am a little confused on the whole Google Voice thing.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
Simonics is now using a secure OAUTH connection to Google Voice. What may be going away (but hasn't yet) is insecure connections such as those made from Asterisk and FreePBX.

Details here: http://nerdvittles.com/?p=12807
 

Kimberly

Member
Joined
Jul 16, 2013
Messages
44
Reaction score
13
OK, so if Simon can build a SIP gateway to Google Voice I assume the rest of us can as well. Can you provide tutorials and documentation sources for me to start learning?
 

billsimon

Experienced in Asterisk, FreePBX, and SIP
Joined
Jan 2, 2011
Messages
931
Reaction score
284
The Google Voice Gateway uses Yate as the VoIP engine, with proprietary customziations implementing the OAUTH2 security and other special features the service offers.

Asterisk can do the same and the proprietor of gvsip.com is using Asterisk for his service. He released some code that modifies the Asterisk XMPP library to work with Google's OAUTH2 security. I haven't heard any talk about it since the week it was released, but it does work. See https://github.com/gvsip/Asterisk
 
  • Like
Reactions: wardmundy

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
I'm trying to back port this to Asterisk11. Will see if it works.
 
  • Like
Reactions: Huckda

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
I have a working patch for asterisk 11 replacing the plain text authorization by OAUTH2. It requires working func_curl (you need in curl-devel centos and libcurl4-gnutls-dev in debian). It also requires libjansson (install libjansson-dev in debian, for centos try jansson-devel).
After downloading sources patch the asterisk by executing
Code:
patch -p1 < ../asterisk11-gv-o2auth.txt
in the asterisk directory. You will have to obtain the one time token from gvsip by following the link posted by billsimon above. This token replaces your normal google voice password. You configure Google Voice (Motiff) module as usual, but when entering the password use the token not your google password. The rest works as usual.
 

Attachments

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
Thanks, dziny. I found a small problem in the Asterisk 11 solution and I'm reposting what I said on the DSL Reports forum in case you missed it:

Found the problem on Asterisk 11. You used Ryan's original setup by requiring refresh_token= in xmpp.conf instead of secret=. That causes a problem on all FreePBX platforms because xmpp.conf gets overwritten whenever you make changes in FreePBX. Then Asterisk won't restart.

May I suggest the same small adjustment that Ryan made. Here was my post on the subject.

"Because of the number of folks that still use FreePBX to access Google Voice, let me suggest a minor change to make this easier. Instead of changing the nomenclature in xmpp.conf from secret to refresh_token, leave the existing nomenclature of secret and make the change in res_xmpp.c. The reason is because FreePBX refreshes xmpp.conf as part of any dialplan modification and will overwrite the modified contents. By using the existing nomenclature, it will preserve the entries even though the secret entry will, in fact, be the refresh_token. Down the road we can work on getting the FreePBX module corrected, but this will be a big help for the short term."
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
Actually no. My xmpp.conf file grabs refresh token from the line secret=. If you look at the diff file the configuration is grabbed here:

static int xmpp_client_config_post_apply(void *obj, void *arg, int flags)
{
struct ast_xmpp_client_config *cfg = obj;
@@ -4430,7 +4470,7 @@ static int load_module(void)
aco_option_register_custom(&cfg_info, "auth_policy", ACO_EXACT, global_options, "accept", global_bitfield_handler, 0);

aco_option_register(&cfg_info, "username", ACO_EXACT, client_options, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, user));
- aco_option_register(&cfg_info, "secret", ACO_EXACT, client_options, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, password));
+ aco_option_register(&cfg_info, "secret", ACO_EXACT, client_options, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, refresh_token));
aco_option_register(&cfg_info, "serverhost", ACO_EXACT, client_options, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, server));
aco_option_register(&cfg_info, "statusmessage", ACO_EXACT, client_options, "Online and Available", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, statusmsg)$

aco_option_register(&cfg_info, "pubsub_node", ACO_EXACT, client_options, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_xmpp_client_config, pubsubnode));
As you can see originally "secret=" in the config file went to internal variable "password", this is changed to "refresh_token". So you still use secret=??? in the config file, but internally it is now processed as your refresh token. Anyway, just try to compile it and test it, it works fine with the Google voice (Motiff) module on my machine.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
Thanks, dziny. Will try again. When I previously tried this using your patch, Asterisk wouldn't restart with amportal restart after setting up a Google Voice account with OAUTH credentials using the Google Voice (Motif) module in FreePBX. As soon as I changed secret to refresh_token in xmpp.conf, it started right up. This was using Asterisk 11.18.0 on the CentOS 6.6 platform.
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
Thanks, dziny. Will try again. When I previously tried this using your patch, Asterisk wouldn't restart with amportal restart after setting up a Google Voice account with OAUTH credentials using the Google Voice (Motif) module in FreePBX. As soon as I changed secret to refresh_token in xmpp.conf, it started right up. This was using Asterisk 11.18.0 on the CentOS 6.6 platform.
I suspect the reason why your asterisk did not want to start with the line "secret=" might be a missing library. You do need libjansson for this to work (on my debian machine the library is called libjansson-dev and libjansson4). You will have to find out the corresponding library on CentOS. I suspect that without the library the asterisk crashes when it encounters call to this library (check the log). If the line secret is missing you won't see the crash as the library is never called.

I suspect that when you tried refresh_token= instead of secret your asterisk has successfully started, but the xmpp did not connect (test xmpp show connections) to see whether you were connected or not.
 
  • Like
Reactions: wardmundy

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
Thanks, dziny. I'm afraid there may be a component that doesn't work correctly on the CentOS platform. I've put all the pieces in place. Will wrestle with this some more when we have a little time.
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
We are. You only need to follow the small bit about installing jansson on centOS. For the rest do what you normally do for Asterisk 11.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
dziny That was basically the code I was using with CentOS 6.6, Asterisk 11.18, and FreePBX 2.11.

Code:
cd /usr/src
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
tar -zxvf jansson-2.5.tar.gz
cd jansson*
./configure --prefix=/usr/ && make && make install && ldconfig
 
cd /usr/src/asterisk-11*
wget http://incrediblepbx.com/asterisk11-gv-o2auth.patch.zip
unzip asterisk11-gv-o2auth.patch.zip
patch -p1 < asterisk11-gv-o2auth.patch
 
./configure --with-curl
make menuselect
make
make install
 
amportal restart
Everything compiles fine. Asterisk works fine, module show like curl looks good... until you add a Google Voice trunk. Then restarting Asterisk looks OK until you try to access the CLI:
Code:
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Log shows the following. curl should be registered but it's not despite correct menuselect settings.
Code:
[2015-06-25 12:30:59] NOTICE[2053] res_xmpp.c: Command CURL(https://www.googleapis.com/oauth2/v3/token,client_id=**SOMEID**.apps.googleusercontent.com&client_secret=*SOME SECRET*&refresh_token=*SOME-TOKEN*&grant_type=refresh_token)
[2015-06-25 12:30:59] ERROR[2053] pbx.c: Function CURL not registered
[2015-06-25 12:30:59] NOTICE[2053] res_xmpp.c: Command status :
Not sure where it would get the client_secret since I didn't enter anything except the refresh_token.

As soon as I change secret to refresh_token in xmpp.conf, Asterisk starts correctly but you can't make a call:
Code:
Unable to create channel of type 'Motif' (cause 66 - Channel not implemented)
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
As soon as I change secret to refresh_token in xmpp.conf, Asterisk starts correctly but you can't make a call:
Code:
Unable to create channel of type 'Motif' (cause 66 - Channel not implemented)

What do you see in this case when you do
Code:
 xmpp show connections
?
Are you connected?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
dziny Nope. xmpp is gone from Asterisk even though res_xmpp was enabled. res_json is not. res_curl is enabled. func_curl is enabled. chan_motif is enabled. curl should be registered but it's not.
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
wardmundy I have a suggestion. Try this on the Ubuntu platform you do support (this should be much closer to my debian system). If we can make it work there, we should be able to to figure out later where is the problem on CentOS.

I have these libraries installed for curl and jansson: curl, libcurl3, libcurl3-gnutls, libcurl4-gnutls-dev
and libjansson4, libjansson-dev

Edit: you also should have ca-certificates
 
  • Like
Reactions: wardmundy

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
14,957
Reaction score
2,582
dziny: So here's the Ubuntu 14 procedure I used, and I got exactly the same fail with curl not registered. We're obviously missing a piece somewhere??

Works fine if I switch secret to refresh_token in xmpp.conf except xmpp and curl disappear from the Asterisk radar. Commenting out everything in xmpp.conf and motif.conf and restarting Asterisk brings XMPP and curl modules back from the dead. :death:

We have a plug-and-play VM image for VirtualBox (CentOS, Asterisk 11, version 12 of the GUI all preloaded and preconfigured) if you'd like to try it yourself. VirtualBox works on any desktop machine. Instructions here.

Code:
apt-get -y install curl libcurl3-gnutls libcurl4-gnutls-dev libjansson4 libjansson-dev ca-certificates unzip
 
cd /usr/src
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
tar -zxvf jansson-2.5.tar.gz
cd jansson*
./configure --prefix=/ && make && make install && ldconfig
 
cd /usr/src/asterisk-11*
wget http://incrediblepbx.com/asterisk11-gv-o2auth.patch.zip
unzip asterisk11-gv-o2auth.patch.zip
patch -p1 < asterisk11-gv-o2auth.patch
 
./configure --with-curl
make menuselect
make
make install
 
 
amportal restart
 

dziny

Guru
Joined
Sep 4, 2014
Messages
41
Reaction score
16
Skip this step. On debian I have only used the libjanson from the packages.

Code:
cd /usr/src
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
tar -zxvf jansson-2.5.tar.gz
cd jansson*
./configure --prefix=/ && make && make install && ldconfig
 
  • Like
Reactions: wardmundy

Members online

No members online now.

Latest Posts

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,273
Messages
136,528
Members
14,505
Latest member
athan