Setup Network config
- vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
DHCP_HOSTNAME=pbx.dev
HOSTNAME="pbx.dev"
IPV6INIT=yes
MTU=1500
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:00:00:00:00 #YOUR MAC ADDRESS of VirtualBox
DNS1=8.8.8.8
USERCTL=no
IPADDR=0.0.0.0 #IP YOU NEED i.e. 172.16.1.56
NETMASK=255.255.255.0
GATEWAY=0.0.0.0 #YOUR GATEWAY i.e. 172.16.1.1
- service network restartIf any fail, you may need to run- reboot
- ifconfig | grep "inet addr"Check for IP address
- service iptables save
- service iptables stop
- chkconfig iptables off
Update Server Hostname
- vi /etc/sysconfig/network
- HOSTNAME=pbx.devSet the HOSTNAME to- pbx.devor whatever you want your hostname to be
- vi /etc/hosts
172.16.1.56 pbx.dev #use your IP address
127.0.0.1 localhost pbx.dev
::1 localhost pbx.dev
- hostname pbx.dev
- service network restart
Install Virtualbox Guest Additions
- Devices > Insert Guest Additions CD Image
- mkdir /media/VirtualBoxGuestAdditions
- mount -r /dev/cdrom /media/VirtualBoxGuestAdditions
- yum update -y
- yum groupinstall -y "Development Tools"
- rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
- yum install -y gcc kernel-devel kernel-headers dkms make bzip2 perl
- yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
- KERN_DIR=/usr/src/kernels/$(uname -r)/
- export KERN_DIR
- cd /media/VirtualBoxGuestAdditions
- ./VBoxLinuxAdditions.run
- reboot
Configure Terminal
- vi /etc/grub.conf
- Find the kernel line and add vga=791to the end of the line
- vi /etc/bashrc
- update PS1 to PS1='\[\033[02;32m\]\u@\h\[\033[02;34m\]\w\$\[\033[00m\] '
- add alias currip="ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print \$1}'"
- save and exit
- sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
- reboot
Install Asterisk Current
- yum install -y wget gcc-c++ ncurses-devel libxml2-devel sqlite-devel libsrtp-devel libuuid-devel openssl-devel iksemel-devel jansson-devel
- cd /usr/local/src/
- wget downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
- wget downloads.asterisk.org/pub/telephony/dahdi-tools/dahdi-tools-current.tar.gz
- wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
- wget downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
- wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz
- tar zxvf dahdi-linux*
- cd dahdi-linux*
- make && make install && make config
- cd ..
- tar zxvf dahdi-tools*
- cd dahdi-tools*
- make && make install && make config
- cd ..
- tar zxvf libpri*
- cd libpri*
- make && make install
- cd ..
- tar -xjvf pjproject-2.2.1.tar.bz2
- cd pjproject*
- ./configure --prefix=/usr/lib64/ --enable-shared
- make dep
- make && make install
- pjproject installs files to /usr/lib64/lib cd /usr/lib64/libmv lib* ..mv pkgconfig/libpjproject.pc ../pkgconfig/
- cd /usr/local/src/pjproject*
- ldconfig
- ldconfig -p | grep pjshould return a huge list of symlinked .so files
- PKG_CONFIG_PATH=/usr/lib64/pkgconfig/
- export PKG_CONFIG_PATH
- cd ..
- tar zxvf asterisk*
- cd asterisk*
- ./configure --libdir=/usr/lib64
- make menuselect
- Select Resource Modulesthen scroll down to ensure a * is next tores_srtp. Pressxto save & quit
- vi include/asterisk/autoconfig.hthis is a super hack >_<
- replace #undef HAVE_PJ_TRANSACTION_GRP_LOCKwith#define HAVE_PJ_TRANSACTION_GRP_LOCK 1
- make && make install
- make samples
- make config
Configure Asterisk for WebRTC
- mkdir /etc/asterisk/keys
- cd /usr/local/src/asterisk*/contrib/scripts
- ./ast_tls_cert -C $(currip) -O "My Super Company" -d /etc/asterisk/keys
- vi /etc/asterisk/http.conf
[general]
enabled=yes
bindaddr=127.0.0.1 ; Replace this with your IP address
bindport=8088 ; Replace this with the port you want to listen on
- vi /etc/asterisk/sip.conf
[general]
context=default
allowguest=no
allowoverlap=no
accept_outofcall_message=yes
outofcall_message_context=default
realm=127.0.0.1 ; Replace this with your IP address
udpbindaddr=127.0.0.1 ; Replace this with your IP address
transport=ws,wss,udp
language=en
icesupport=yes
videosupport=yes
nat=auto_force_rport,auto_comedia
allow=!all,alaw,ulaw,gsm
;
[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=ws,wss,udp ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8,h264
;
[1061] ; This will be the legacy SIP client
type=friend
username=1061
host=dynamic
secret=password
context=default
directmedia=no
transport=udp
force_avp=yes
dtlsenable=no
videosupport=yes
nat=no
disallow=all
allow=ulaw,vp8
- vi /etc/asterisk/extensions.conf
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1061,1,Dial(SIP/1061) ; Dialing 1061 will call the SIP client registered to 1061
- vi /etc/asterisk/manager.conf
[general]
enabled=yes
port=5038
bindaddr=0.0.0.0
;
[admin]
secret=password
read=all
write=all
writetimeout=5000
- service asterisk restart
- Ensure Linphone is installed, and all Video and Audio codecs are turned on
- SIP account should be sip:1061@CENT_OS_IP_ADDRESSwithudptransport
Install & Configure ejabberd
- yum install -y ejabberd
- vi /etc/ejabberd/ejabberd.cfg
% Find this line and add the pbx.dev
{hosts, ["localhost", "pbx.dev"]}.
- service ejabberd start
- ejabberdctl register admin pbx.dev passwordto create an account called admin on pbx.dev with the password "password"
- vi /etc/ejabberd/ejabberd.cfg
% This goes under the ACCESS CONTROL section
{acl, admin, {user, "admin", "pbx.dev"}}.
- service ejabberd restart
- Browse to http://pbx.dev:5280/adminand use admin/password to log in
- Virtual Hosts > pbx.dev > Users - Make a user called "asterisk". Also make yourself a user
- vi /etc/asterisk/xmpp.conf
[general]
autoregister=yes
autoprune=no
;
[ejabberd]
type=client
serverhost=pbx.dev
username=asterisk@pbx.dev
secret=password ;your password you chose for asterisk
priority=1
port=5222
usetls=no
usesasl=yes
status=available
statusmessage="It's Asterisk!"
timeout=5
- asterisk -r
- module reload res_xmpp- should show reloading
- xmpp show connections- should show 1 client connected. If so, then- exit
- vi /etc/asterisk/extensions.conf
; replace the exten 1061 dialplan with this
exten => 1061,1,Set(JSTATUS=${JABBER_STATUS(ejabberd,youruser@pbx.dev/Desktop)}) ; /Desktop is the resource you will set in your xmpp client like Adium/Pidgin
same => n,GotoIf($[0${JSTATUS}=1]?available:unavailable)
same => n(available), JabberSend(ejabberd,youruser@pbx.dev,"Incoming call from ${CALLERID(num)}")
same => n,Dial(SIP/1061)
same => n,Hangup()
same => n(unavailable),JabberSend(ejabberd,youruser@pbx.dev,"Missed call from ${CALLERID(num)}")
; do other dialplan stuff when you're not available
- service asterisk restart
0 comments: