由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CellularPlan版 - Connect Obi1x0 to google voice with asterisk (Naf’s gvsip) (转载)
相关主题
Asterisk电话回拨asterisk 1.8+gtalk总结
智能手机有什么自动Google Voice回拨应用吗?完美Asterisk+GV,折腾ipkall/sipgate的可以休矣
google voice 在obi 上不work了无耻地问一些ASTERISK加GV加DOCK STAR的问题
Freedompop 测试asterisk + gv无法打入
Shadowsocks 翻墙教程 (转载)asterisk gtalk接不起来的,你们有没有试过
除了callcentric还有没有好用的free did拨的是0118613312345678,asterisk给我拨少了一个号。
小白求教: 把gv转换成sip的问题Asterisk 1.4, GV call out problem
Freedompop:使用linphone打SIP电话caller id?
相关话题的讨论汇总
话题: asterisk话题: sudo话题: oauth话题: sip话题: token
进入CellularPlan版参与讨论
1 (共1页)
j**f
发帖数: 28
1
【 以下文字转载自 PDA 讨论区 】
发信人: jmrf (daimao), 信区: PDA
标 题: Connect Obi1x0 to google voice with asterisk (Naf’s gvsip) only
发信站: BBS 未名空间站 (Tue Aug 28 02:58:37 2018, 美东)
For better view please see it at https://github.com/jmrfdm/gvsip
# Connect Obi1x0 to google voice with asterisk (Naf’s gvsip) only
Long story short, google dropped XMMP and Obitalk dropped Obi1x0, we didn't
hear/make calls from obi anymore.
Until I saw [Nafs Gvsip] worked with openPBX and Incredible PBX. But I don't
like the idea of DDD and LAMP.
I'm able to set up a asterisk server with Naf’s gvsip, to work with obi100
and google voice without DDD and OPENPBX.
It show that asterisk alone could easy work for one google voice number and
one sipphone.
It should work with a few google voice numbers and a few sipphones at the
same time if you know how to write the extensions.conf manually.
The tutorial is based on Ubuntu 18.04 minimal (any ubuntu 18.04 will do,
minimal will be smallet, you could consider adding ssh server for remote
acess).
## Install asterisk
Modified from [asterisk installation].
### Clone Naf’s gvsip branch:
```
cd /usr/src
sudo git clone --depth=1 https://github.com/naf419/asterisk.git --branch
gvsip ##narrow clone
cd asterisk
sudo sed -i 's/MAINLINE_BRANCH=.*/MAINLINE_BRANCH=15/' build_tools/make_
version
sudo contrib/scripts/install_prereq install
sudo contrib/scripts/get_mp3_source.sh
```
### Build asterisk:
```
cd /usr/src/asterisk
sudo ./configure
sudo make menuselect.makeopts
sudo menuselect/menuselect --enable format_mp3 --enable app_macro
--enable CORE-SOUNDS-EN-WAV --enable CORE-SOUNDS-EN-ULAW menuselect.
makeopts
sudo make
sudo make install
sudo make config
sudo ldconfig
```
### Set initial config:
```
sudo touch /etc/asterisk/{modules,ari,statsd}.conf
sudo cp configs/samples/modules.conf.sample /etc/asterisk/modules.conf #
neccsary for load modules
sudo cp configs/samples/logger.conf.sample /etc/asterisk/logger.conf #for
debug, could be deleted after system works
sudo cp configs/samples/smdi.conf.sample /etc/asterisk/smdi.conf #for
voicemail, could be deleted
```
### Set rtp.conf:
```
cat << EOF | sudo tee /etc/asterisk/rtp.conf
[general]
stunaddr=stun.l.google.com:19302
EOF
```
### Set pjsvp.conf for google voice:
Could be checked with asteriks command "pjsip show auths".
```
cat << EOF | sudo tee /etc/asterisk/pjsip.conf
[global]
type=global
debug=true
keep_alive_interval=90
; if using chan_sip to host sip clients instead of chan_pjsip,
; you wont have the (required) udp transport that supports those
; clients. if so, just make a dummy one on a port that won't
; conflict with chan_sip
;[incoming-registrations-unused-but-required]
;type=transport
;protocol=udp
;bind=0.0.0.0:9999
[transport_tls]
type=transport
protocol=tls
bind=0.0.0.0:5061
[gvsip1]
type=registration
outbound_auth=gvsip1
server_uri=sip:obihai.sip.google.com
outbound_proxy=sip:obihai.telephony.goog:5061;transport=tls;lr;hide
client_uri=sip:[email protected]
retry_interval=60
support_path=yes
support_outbound=yes
line=yes
endpoint=gvsip1
contact_additional_params=obn=msi
transport=transport_tls
transport_reuse=no
[gvsip1]
type=auth
auth_type=oauth
refresh_token=your_own_refresh_token
oauth_clientid=your_own_oauth_clientid
oauth_secret=your_own_oauth_secret
username=gv17775551234
realm=obihai.sip.google.com
[gvsip1]
type=aor
contact=sip:obihai.sip.google.com
[gvsip1]
type=endpoint
context=from-external
outbound_auth=gvsip1
outbound_proxy=sip:obihai.telephony.goog:5061;transport=tls;lr;hide
aors=gvsip1
direct_media=no
ice_support=yes
rtcp_mux=yes
media_use_received_transport=yes
outbound_registration=gvsip1
EOF
```
### Set sip.conf as sip server
Could be checked with asteriks command "sip show peers" and "sip show peer
201".
```
cat < [general]
context=from-internal
bindport=5060
[201]
type=friend
secret = secret1 ;Change to you own password
dtmfmode = rfc2833
host = dynamic
dial=SIP/201
[email protected]
EOF
```
### Set up extensions.conf by bridge from-internal and from-external with
dialplan
Could be checked with asteriks command "dialplan show".
```
cat < [from-internal]
; local extensions go here
exten => 201,1,Dial(SIP/201,20)
; These Google Voice outbound calling with no extension prefix
exten => _NXXXXXX,1,Set(CALLERID(dnid)=1xxx${CALLERID(dnid)}) ; replace
xxx with your area code
exten => _NXXXXXX,n,Goto(1xxx${EXTEN},1) ; replace
xxx with your area code
exten => _NXXNXXXXXX,1,Set(CALLERID(dnid)=1${CALLERID(dnid)})
exten => _NXXNXXXXXX,n,Goto(1${EXTEN},1)
exten => _1NXXNXXXXXX,1,Dial(PJSIP/${EXTEN}@gvsip1)
; International call
exten => _011aaXXXXXXXX.,1,Dial(PJSIP/${EXTEN}@gvsip1) ; replace aa
with other national code
[from-external]
exten => s,1,NoOp()
same => n,Set(crazygooglecid=${CALLERID(name)})
same => n,Set(stripcrazysuffix=${CUT(crazygooglecid,@,1)})
same => n,Set(CALLERID(all)=${stripcrazysuffix})
same => n,Dial(SIP/201,20,D(:1))
EOF
```
Examples of [pjsip.conf and rtp.conf example], [sip.conf and extensions.conf
example EN], and [sip.conf and extensions.conf example CN]
### Set up your personal information
You have get your google voice number, your own refresh token ready or take
a look at [OAuth 2 refresh_token for Incredible PBX] or [OAuth 2 refresh_
token for your own client]
```
gvnum="yourgoogle voice number"
#follow instruction from [OAuth 2 refresh_token for Incredible PBX] or [
OAuth 2 refresh_token for your own client]
token="your own refresh token"
#clientid for [OAuth 2 refresh_token for Incredible PBX] or [OAuth 2 refresh
_token for your own client]
oauth_clientid=466295438629-prpknsovs0b8gjfcrs0sn04s9hgn8j3d.apps.
googleusercontent.com
#secret for [OAuth 2 refresh_token for Incredible PBX] or [OAuth 2 refresh_
token for your own client]
oauth_secret=4ewzJaCx275clcT4i4Hfxqo2
sudo sed -i -e 's/gv17775551234/'$gvnum'/' -e 's/your_own_refresh_token/'$
token'/'
-e 's/your_own_oauth_clientid/'$oauth_clientid'/' -e 's/your_own
_oauth_secret/'$oauth_secret'/' /etc/asterisk/pjsip.conf

areacode="your the digit area code"
natcode="other nation code"
sudo sed -i -e 's/xxx/'$areacode'/' -e 's/aa/'$natcode'/' /etc/asterisk/sip.
conf
```
### Set permissions
```
sudo useradd -m asterisk
sudo chown asterisk. /var/run/asterisk
sudo chown -R asterisk. /var/{lib,log,spool}/asterisk
sudo chown -R asterisk. /etc/asterisk /usr/lib/asterisk
```
## Debug asterisk
### Start asterisk
```
sudo asterisk -cvvvvv
```
You could see some module load error, that's ok.
Then you'll see *CLI>, this the place to type in asterisk command
Tips: You could always look up asterisk command after *CLI> by asterisk
command "core show help".
### Connect to google voice, controlled by pjsip.conf
A few second after *CLI>, your should see both "Transmitting SIP request"
and "Received SIP response" message.
If you only see "Transmitting SIP request", and see SSL STATUS_FROM_SSL_ERR,
you are using old openssl. [known Issues]
If a simple update of openssl couldn't fix it, you are out of luck. For an
old system, YMMY, I failed to fix the SSL STATUS_FROM_SSL_ERR even after
upgrading openssl.
### Connect to sipphone
It's better to use a softphone from [softphone list] to connect at first and
then play with your Obi1x0. I test my system with MicroSip, it works well.
For phone setting, you need set the ip address of you asterisk machine as
server, port is 5060, Transport is UDP, username is 201 and password is
secret1.
You could use asterisk command "sip show peers" to check if phone is
connected, and use "sip show peer 201" to check the detail of the phone.
### Check the dialplan
Asterisk it's self is a PBX through extensions.conf, which are called
dialplan in asterisk.
The dialplan coud be checked by asterisk command "dialplan show". You should
see infomation that's very similar to what's in extensions.conf.
Dial other phone number (it's better to not use google number, there's lack
of ringback as in [known Issues]) from sipphone to see if the from-internal
part works.
Dial your google voice number to see if if the from-external part works.
### End asterisk
Ctrl+C should terminal asterisk.
### Start asterisk as service
```
sudo update-rc.d asterisk defaults
sudo service asterisk start
```
## Acknowledgement
Thanks for sharing from [email protected], [email protected], ward [email protected]
, [email protected], [email protected]
## References
[Nafs Gvsip]: https://github.com/naf419/asterisk/tree/gvsip
[known Issues]: https://github.com/naf419/asterisk/wiki
[asterisk installation]: https://community.freepbx.org/t/how-to-guide-for-
google-voice-with-freepbx-14-asterisk-gvsip-ubuntu-18-04/50933
[OAuth 2 refresh_token for Incredible PBX]: http://nerdvittles.com/?p=26204#GVsetup
[OAuth 2 refresh_token for your own client]: http://www.obifirmware.com/OAuth2/
[pjsip.conf and rtp.conf example]: https://github.com/naf419/asterisk/blob/
gvsip/README.md
[sip.conf and extensions.conf example EN]: https://hobbiesbytwinclouds.
wordpress.com/2018/05/27/how-to-make-and-receive-calls-using-google-voice-
without-xmpp-may-2018-revision/
[sip.conf and extensions.conf example CN]: https://www.mitbbs.com/article_t/
PDA/33028435.html
[softphone list]: https://www.mitbbs.com/article_t/CellularPlan/971.html
s**i
发帖数: 220
2
c**c
发帖数: 5
3
以下步骤出错:
sudo contrib/scripts/get_mp3_source.sh
错误信息:
contrib/scripts/get_mp3_source.sh: 18: contrib/scripts/get_mp3_source.sh:
svn: not found
试图安装subversion,但是还是出错,请问如何解决?
sudo apt -y install subversion
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package subversion is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'subversion' has no installation candidate
j**f
发帖数: 28
4
svn should be available in Ubuntu 18.04.
Looks like your apt package is messed up, which is quiet possible if your
package system is not updated
you could try
sudo apt-get update
first
However I highly recommend that you try this on a new installation of Ubuntu
18.04.
It take some time but you didn't need worry about dependence problem.
In an old system, I get everything compiled, but the connect to google oauth
failed.
c****9
发帖数: 5402
5
超赞!
刚刚买了个Pi0W,好像装不上ubuntu啊?
j**f
发帖数: 28
6
You should follow this one
The Gold Standard: It’s Incredible PBX for Raspberry Pi 3B+
http://nerdvittles.com/?p=21255
It should be easier just
Download and unzip Incredible PBX 13 GVSIP image from SourceForge
no need to compile at all.
specifily for Pi0W
https://pbxinaflash.com/community/threads/10-raspberry-pi-zero-w.18143/page-
2#post-129611

【在 c****9 的大作中提到】
: 超赞!
: 刚刚买了个Pi0W,好像装不上ubuntu啊?

c****9
发帖数: 5402
7
太感谢了! 看来Pi0W可以折腾的啊

page-

【在 j**f 的大作中提到】
: You should follow this one
: The Gold Standard: It’s Incredible PBX for Raspberry Pi 3B+
: http://nerdvittles.com/?p=21255
: It should be easier just
: Download and unzip Incredible PBX 13 GVSIP image from SourceForge
: no need to compile at all.
: specifily for Pi0W
: https://pbxinaflash.com/community/threads/10-raspberry-pi-zero-w.18143/page-
: 2#post-129611

c**c
发帖数: 5
8

Ubuntu
oauth
Thanks! I did sudo apt-get update already, but that doesn't help. I am
surprised too. I have googled around but couldn't find any solutions to this
issue. I installed the server version of Ubuntu, that should have more
stuff than the minimal. Not sure Ubuntu Desktop version would help, I doubt
it.

【在 j**f 的大作中提到】
: svn should be available in Ubuntu 18.04.
: Looks like your apt package is messed up, which is quiet possible if your
: package system is not updated
: you could try
: sudo apt-get update
: first
: However I highly recommend that you try this on a new installation of Ubuntu
: 18.04.
: It take some time but you didn't need worry about dependence problem.
: In an old system, I get everything compiled, but the connect to google oauth

j**f
发帖数: 28
9
you may miss some repository
try
sudo add-apt-repository universe
sudo apt update
sudo apt install subversion
https://
askubuntu.com/questions/885830/how-do-i-install-a-subversion-client-on-
ubuntu-16-04

this
doubt

【在 c**c 的大作中提到】
:
: Ubuntu
: oauth
: Thanks! I did sudo apt-get update already, but that doesn't help. I am
: surprised too. I have googled around but couldn't find any solutions to this
: issue. I installed the server version of Ubuntu, that should have more
: stuff than the minimal. Not sure Ubuntu Desktop version would help, I doubt
: it.

c**c
发帖数: 5
10

Thanks a lot! This is working!

【在 j**f 的大作中提到】
: you may miss some repository
: try
: sudo add-apt-repository universe
: sudo apt update
: sudo apt install subversion
: https://
: askubuntu.com/questions/885830/how-do-i-install-a-subversion-client-on-
: ubuntu-16-04
:
: this

1 (共1页)
进入CellularPlan版参与讨论
相关主题
重新来过了.Shadowsocks 翻墙教程 (转载)
nonoh caller id?除了callcentric还有没有好用的free did
gv+sipgate+freepbx+ata, 15分钟限制?小白求教: 把gv转换成sip的问题
问一下,版上有没大牛分享过asterisk的配置文件?Freedompop:使用linphone打SIP电话
Asterisk电话回拨asterisk 1.8+gtalk总结
智能手机有什么自动Google Voice回拨应用吗?完美Asterisk+GV,折腾ipkall/sipgate的可以休矣
google voice 在obi 上不work了无耻地问一些ASTERISK加GV加DOCK STAR的问题
Freedompop 测试asterisk + gv无法打入
相关话题的讨论汇总
话题: asterisk话题: sudo话题: oauth话题: sip话题: token