Script to install Asterisk 18 with Pjsip and WEBRTC on CentOS 7
This script :
- installs Asterisk 18 with WEBRTC enabled
- installs and configures Bind9
- Installs and configures apache web server with ssl
- will change your SSH port from 22 to your desired port
- will enable and configure firewall
- will create 2 sip users 100 and 200
- installs webphone from @InnovateAsterisk/Browser-Phone
******** Note1: This Script should be installed on a fresh Installation ******** Note2: in case the script exits, there is something wrong with your configuration. unless you see the message INSTALLATION DONE ******** Note3: Please replace yourdomain.com with your own domain. ******** Note4: Before you run this script your domain registrar account set your DNS to ns1.yourdomain.com and ns2.yourdomain.com and allow up to 24 hours for your domain DNS to propagate. ******** Note5: This script should be run with options.
-d yourdomain.com -i your static IP address -p your desired ssh port -e your email address for lets encyprt -t your server timezone
INSTALLTION:
- Install a CentOS 7
- confirgure your netwrok with static IP address
- run the following commands:
sudo yum update -y sudo yum install net-tools npm svn vim curl git telnet wget nano epel-release -y sudo sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config sudo hostnamectl set-hostname voip.yourdomain.com --static sudo reboot
once your server is back, please download asterisk-webrtc.sh script and run it as follow:
wget https://github.com/mehdizeus/asterisk18-script/blob/main/asterisk18-webrtc.sh chmod 777 asterisk18-webrtc.sh bash -e asterisk18-webrtc.sh -d example.com -i x.x.x.x -p 2449 -e email@email.com -t America/New_York
during the installtion you will see a prompt like below picture. navigate to "Codec Translators" on the left menu and select coded_opus asterisk18-webrtc.png
you can also navigate to "Extra sound package" on the left side and select your prefered sound packages
one the installtion is finished: vim /etc/asterisk/extensions.conf
and insert these lines at the end of the file [speak-exte-nnum] exten => 888,1,NoOp(FEATURE: SPEAK MY EXTENSION NUMBER) same => n,Answer same => n,Wait(1) same => n,Playback(extension) same => n,Wait(1) same => n,SayDigits(${CALLERID(num)}) same => n,Wait(2) same => n,Hangup() ;END of [speak-exte-nnum]
[dial-extension]
exten => s,1,NoOp(Calling:
exten => e,1,Hangup()
[send-text]
exten => s,1,NoOp(Sending Text To:
then in terminal type asterisk -rx "reload"
******** WARNING: the password in pjsip.conf is 1234 and you should change it to a more secure password in a production server
THATS IT!!
Now visit to yourdomain.com and start configuring webphone navigate to webphone settings > account : Asterisk server Address: yourdomain.com Websocket Port: 8089 Websocket Path: /ws Subscribe Extension: 100 Full Name: 100 SIP username: 100 SIP password: 1234 and hit Save
ENJOY!!!