homehowtokbslinksaboutcontactprojectsmusic

Index > Help Tutorials > Asterisk 13 on Ubuntu 16.04 LTS
Content
1. Basice Setup
2. Google Voice Setup
3. MySQL Realtime Setup
Basic Setup
install packages
apt install asterisk asterisk-mysql asterisk-mp3 asterisk-dahdi
apt install asterisk asterisk-mysql
backup the default config for later reference
cp -fr /etc/asterisk/ ~
configure rtp ports
cat << eot > /etc/asterisk/rtp.conf
[general]
;icesupport=yes
rtpstart=10000
rtpend=20000
eot
configure sip and two demo accounts, make sure to change localnet and udpbindaddr to yours
cat << eot > /etc/asterisk/sip.conf
[general]
localnet=10.10.10.0/255.255.255.0
nat=force_rport,comedia
rtcachefriends=yes		
udpbindaddr=10.10.10.30:9065	
tcpenable=no
;tcpbindaddr=0.0.0.0
allowguest=yes                  
match_auth_username=yes         
allowoverlap=yes                
g726nonstandard=yes           
srvlookup=yes
pedantic=yes
useragent=Asterisk PBX
dtmfmode=rfc2833
;videosupport=yes
alwaysauthreject=yes
engine=asterisk 
disallow=all
allow=ilbc
;allow=g729
allow=gsm
;allow=g723
allow=ulaw
qualifyfreq=30
qualifygap=100
qualifypeers=1
  
[demo.10]
type=peer
secret=demo10
host=dynamic
context=internal

[demo.11]
type=peer
secret=demo11
host=dynamic
context=internal
eot
configure extensions
cat << eot > /etc/asterisk/extensions.conf
[internal]
exten => 10,1,Dial(SIP/demo.10,,r)
exten => 11,1,Dial(SIP/demo.11,,r)
Hangup()
eot
restart asterisk
/etc/init.d/asterisk restart
check peers, you should see both demo users
asterisk -rx 'sip show peers'
At this point you should be able to register two user (demo.10,demo11) and both should be able to call each other by dialing their extensions (10, 11)
Go Up
Add Google Voice
Set google voice to make and receive calls. Lets starting configuring motif
cat << eot > /etc/asterisk/motif.conf
[google]
context=incoming-motif
disallow=all
allow=ulaw
connection=google
eot
make google voice connection, update username and password to yours
cat << eot > /etc/asterisk/xmpp.conf
[general]
[google]
type=client
serverhost=talk.google.com
username=xxx@gmail.com
secret=xxx
priority=127
port=5222
usetls=yes
usesasl=yes
status=available
statusmessage="I am available"
timeout=5
eot
configure dial plan for incoming/outgoing calls, redirect incoming calls to demo.10 extension. You want to update your calling area code
cat << eot > /etc/asterisk/extensions.conf
[general]
[incoming-motif]
exten => s,1,Answer()
same => n,Wait(1)
same => n,SendDTMF(1)
same => n,Set(cid=\${CALLERID(name)})
same => n,Set(cid=\${CUT(cid,@,1)})
same => n,Set(CALLERID(all)=\${cid})
same => n,Dial(SIP/demo.10,20,D(:1))
  
[internal]
exten => 10,1,Dial(SIP/demo.10,,r) ; demo 10 can receive calls from other extensions
exten => 11,1,Dial(SIP/demo.11,,r) ; demo 11 can receive calls from other extensions
exten => _1NXXNXXXXXX,1,Dial(Motif/google/\${EXTEN}@voice.google.com,,r); allow call out to 11 digits number
exten => _NXXNXXXXXX,1,Dial(Motif/google/1\${EXTEN}@voice.google.com,,r); allow call out to 10 digit number
exten => _NXXXXXX,1,Dial(Motif/google/1xxx\${EXTEN}@voice.google.com,,r); allow call out to local numbers
Hangup()
eot
restart asterisk
/etc/init.d/asterisk restart
check google voice connections
asterisk -rx 'xmpp show connections'
All done, at this point I was able to receive calls from google voice number on my demo.10 extension and was able to make calls from demo.10 extension to anywhere using google voice number.
Go Up
Add MySQL Support
Coming soon
Go Up
sed -i s,';allowguest=no','allowguest=no',g /etc/asterisk/sip.conf