What Is a PBX?
Asterisk, first and foremost, is a Private Branch Exchange. A PBX is a piece of equipment that handles telephone switching owned by a private business, rather than a telephone company.A PBX can be thought of as a private
phone switchboard, connecting to one or more telephones on one side, and usually connecting to one or more telephone lines on the other.
What is Asterisk?
Asterisk is a complete PBX. It implements all the major features of most commercially available PBXes. It also implements, for free, features that often cost a lot in a commercial installation: Conference calling, Direct Inward System Access, Call Parking, and Call Queues, just to name a few.
The basic features provided by Asterisk are:
Caller ID
Blacklisting (Block callers by Caller ID)
Call Waiting
Call Transfer
Call Conferencing
Conference Center/Bridging
Do‐Not‐Disturb
Call Forwarding
Call Parking
Call Detail Reporting
Dial by Name Directory
Interactive Voice Response (Auto Attendant)
Time Condition Call Routing
Call Queuing
Call Back
Hold Music/Recordings (MP3)
Application Integration
Extended Call Reporting
DISA (Direct Inward System Access)
Dictation
Follow Me
Paging/Intercom
Ring Groups
Graphical Call Manager
Day/Night Controls
Among others. So let’s get started.
You can set hostname and timezone before doing any installation.Use below commands.
To set hostname type:
[root@asterisk-cloud ~]# hostnamectl set-hostname centos-asterisk-server
1. First do system update
[root@asterisk-cloud ~]# yum -y update
[root@asterisk-cloud ~]# yum install bzip2
2. Install missing dependencies
[root@asterisk-cloud ~]# yum -y install lynx mariadb-server mariadb php php-mysql php-mbstring tftp-server httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel sqlite-devel net-tools gnutls-devel php-pear
3. Install other missing dependencies not in step 2
[root@asterisk-cloud ~]# yum -y install gcc gcc-c++ php-xml php php-mysql php-pear php-mbstring mariadb-devel mariadb-server mariadb sqlite-devel lynx bison gmime-devel psmisc tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel uuid-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim
4. Setup and configure mariadb database, setting password as well.
systemctl start mariadb
systemctl enable mariadb
Now set password by running command below.
mysql_secure_installation
Just press enter if you don’t already have password set for mysql.Agree to remove test database and disallow remote login.
5. Installing Jansson which is a C library for encoding, decoding and manipulating JSON data. Let’s download, unpack and compile it using the below command.
[root@asterisk-cloud ~]#cd /usr/src
[root@asterisk-cloud ~]# mkdir asterisk-13
[root@asterisk-cloud ~]#cd asterisk-13
[root@asterisk-cloud ~]#git clone https://github.com/akheron/jansson.git
6. Install Legacy Pear requirements
[root@asterisk-cloud ~]# pear install Console_Getopt
7. Download Asterisk source files.
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
[root@asterisk-cloud ~]# wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
[root@asterisk-cloud ~]# wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
8.Compile and install DAHDI if you are connecting to PSTN. This is OPTIONAL, install if you’ll connect to PSTN.
[root@asterisk-cloud ~]#cd /usr/src/asterisk-13
[root@asterisk-cloud ~]#tar xvfz dahdi-linux-complete-current.tar.gz
[root@asterisk-cloud ~]# tar xvfz libpri-current.tar.gz
[root@asterisk-cloud ~]# rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz
[root@asterisk-cloud ~]# cd dahdi-linux-complete-*
[root@asterisk-cloud ~]# make all
[root@asterisk-cloud ~]# make install
[root@asterisk-cloud ~]# make config
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13/
[root@asterisk-cloud ~]# cd libpri-1.6.0*
[root@asterisk-cloud ~]# make
[root@asterisk-cloud ~]# make install
9.Compile and install pjproject
10. Compile and Install jansson
[root@asterisk-cloud ~]# useradd -m asterisk
[root@asterisk-cloud ~]# chown asterisk.asterisk /var/run/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /etc/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/lib/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/log/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/spool/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /usr/lib64/asterisk
[root@asterisk-cloud ~]#
To Check Status
[root@asterisk-cloud ~]#asterisk -r
centos-asterisk-server*CLI> sip show peers
Asterisk, first and foremost, is a Private Branch Exchange. A PBX is a piece of equipment that handles telephone switching owned by a private business, rather than a telephone company.A PBX can be thought of as a private
phone switchboard, connecting to one or more telephones on one side, and usually connecting to one or more telephone lines on the other.
What is Asterisk?
Asterisk is a complete PBX. It implements all the major features of most commercially available PBXes. It also implements, for free, features that often cost a lot in a commercial installation: Conference calling, Direct Inward System Access, Call Parking, and Call Queues, just to name a few.
The basic features provided by Asterisk are:
Caller ID
Blacklisting (Block callers by Caller ID)
Call Waiting
Call Transfer
Call Conferencing
Conference Center/Bridging
Do‐Not‐Disturb
Call Forwarding
Call Parking
Call Detail Reporting
Dial by Name Directory
Interactive Voice Response (Auto Attendant)
Time Condition Call Routing
Call Queuing
Call Back
Hold Music/Recordings (MP3)
Application Integration
Extended Call Reporting
DISA (Direct Inward System Access)
Dictation
Follow Me
Paging/Intercom
Ring Groups
Graphical Call Manager
Day/Night Controls
Among others. So let’s get started.
You can set hostname and timezone before doing any installation.Use below commands.
To set hostname type:
[root@asterisk-cloud ~]# hostnamectl set-hostname centos-asterisk-server
1. First do system update
[root@asterisk-cloud ~]# yum -y update
[root@asterisk-cloud ~]# yum install bzip2
2. Install missing dependencies
[root@asterisk-cloud ~]# yum -y install lynx mariadb-server mariadb php php-mysql php-mbstring tftp-server httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel sqlite-devel net-tools gnutls-devel php-pear
3. Install other missing dependencies not in step 2
[root@asterisk-cloud ~]# yum -y install gcc gcc-c++ php-xml php php-mysql php-pear php-mbstring mariadb-devel mariadb-server mariadb sqlite-devel lynx bison gmime-devel psmisc tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel uuid-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim
4. Setup and configure mariadb database, setting password as well.
systemctl start mariadb
systemctl enable mariadb
Now set password by running command below.
mysql_secure_installation
Just press enter if you don’t already have password set for mysql.Agree to remove test database and disallow remote login.
5. Installing Jansson which is a C library for encoding, decoding and manipulating JSON data. Let’s download, unpack and compile it using the below command.
[root@asterisk-cloud ~]#cd /usr/src
[root@asterisk-cloud ~]# mkdir asterisk-13
[root@asterisk-cloud ~]#cd asterisk-13
[root@asterisk-cloud ~]#git clone https://github.com/akheron/jansson.git
6. Install Legacy Pear requirements
[root@asterisk-cloud ~]# pear install Console_Getopt
7. Download Asterisk source files.
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
[root@asterisk-cloud ~]# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
[root@asterisk-cloud ~]# wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
[root@asterisk-cloud ~]# wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
8.Compile and install DAHDI if you are connecting to PSTN. This is OPTIONAL, install if you’ll connect to PSTN.
[root@asterisk-cloud ~]#cd /usr/src/asterisk-13
[root@asterisk-cloud ~]#tar xvfz dahdi-linux-complete-current.tar.gz
[root@asterisk-cloud ~]# tar xvfz libpri-current.tar.gz
[root@asterisk-cloud ~]# rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz
[root@asterisk-cloud ~]# cd dahdi-linux-complete-*
[root@asterisk-cloud ~]# make all
[root@asterisk-cloud ~]# make install
[root@asterisk-cloud ~]# make config
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13/
[root@asterisk-cloud ~]# cd libpri-1.6.0*
[root@asterisk-cloud ~]# make
[root@asterisk-cloud ~]# make install
9.Compile and install pjproject
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13 [root@asterisk-cloud ~]# tar -xjvf pjproject-2.4.tar.bz2 [root@asterisk-cloud ~]# rm -f pjproject-2.4.tar.bz2 [root@asterisk-cloud ~]# cd pjproject-2.4 [root@asterisk-cloud ~]# ./configure [root@asterisk-cloud ~]# make dep [root@asterisk-cloud ~]# make [root@asterisk-cloud ~]# make install
10. Compile and Install jansson
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13
[root@asterisk-cloud ~]# tar vxfz jansson.tar.gz
[root@asterisk-cloud ~]# rm -f jansson.tar.gz
[root@asterisk-cloud ~]# cd jansson-*
[root@asterisk-cloud ~]# autoreconf -i
[root@asterisk-cloud ~]# ./configure --libdir=/usr/lib64
[root@asterisk-cloud ~]# make
[root@asterisk-cloud ~]# make install
11. Compile and install Asterisk
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13
[root@asterisk-cloud ~]# tar xvfz asterisk-13-current.tar.gz
[root@asterisk-cloud ~]# cd asterisk-*
[root@asterisk-cloud ~]# ./configure --libdir=/usr/lib64
12. Setup menu options by running the following command
[root@asterisk-cloud ~]# make menuselect
On Addons select chan_ooh323 and format_mp3 as shown below
On Core Sound Packages, select the formats of Audio packets like below
On Music On Hold option select the following modules as shown in the picture below
On Extra Sound Packages select as shown below:
13. Now run the following command to download the mp3 decoder library into the source tree.
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13/asterisk-*
[root@asterisk-cloud ~]# contrib/scripts/get_mp3_source.sh
14. Do installation of selected modules
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13/asterisk-*/
[root@asterisk-cloud ~]# make
[root@asterisk-cloud ~]# make install
[root@asterisk-cloud ~]#make samples
[root@asterisk-cloud ~]# make config
15. Create separate user and group to run asterisk services
[root@asterisk-cloud ~]# chown asterisk.asterisk /var/run/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /etc/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/lib/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/log/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /var/spool/asterisk
[root@asterisk-cloud ~]# chown -R asterisk.asterisk /usr/lib64/asterisk
[root@asterisk-cloud ~]#
16. Make systemctl start asterisk by copying init script to init.d dir.
[root@asterisk-cloud ~]# cd /usr/src/asterisk-13/asterisk-*
[root@asterisk-cloud ~]# cp contrib/init.d/rc.redhat.asterisk /etc/init.d/asterisk
[root@asterisk-cloud ~]# chmod 755 /etc/init.d/asterisk
Locate asterisk by
[root@asterisk-cloud ~]# which asterisk
[root@asterisk-cloud ~]# vi /etc/init.d/asterisk
Replace AST_SBIN=, with your location of asterisk binary, for my case it’s /sbin/. See below image.
17. Disable SELinux
[root@asterisk-cloud ~]# sed -i 's/(^SELINUX=).*/SELINUX=disabled/' /etc/selinux/config
[root@asterisk-cloud ~]# sestatus
18. Setup Asterisk Database
[root@asterisk-cloud ~]# mysql -u root -p
Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 4 Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> create user 'asterisk'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database cdrdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create database asterisk;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON cdrdb.* TO asterisk@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
19. Make all asterisk PBX ports accessible by adding the following rules
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=5060/udp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=5060/tcp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=5061/udp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=5061/tcp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=4569/udp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=5038/tcp --permanent
[root@asterisk-cloud ~]# firewall-cmd --zone=public --add-port=10000-20000/udp --permanent
20. Commit changes
[root@asterisk-cloud ~]# firewall-cmd --reload
success
21. Confirm that the rules are added.
[root@asterisk-cloud ~]# firewall-cmd --zone=public --list-all
public (default, active)
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports: 5061/tcp 4569/udp 5060/tcp 10000-20000/udp 5061/udp 5060/udp 5038/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
Restart asterisk server
[root@asterisk-cloud ~]# systemctl restart asterisk
17. Check if running
[root@asterisk-cloud ~]# systemctl status asterisk
[root@asterisk-cloud ~]# cd /etc/asterisk/
[root@asterisk-cloud ~]# cp sip.conf sip.conf.orig
18.Now create sip account
18.Now create sip account
[root@asterisk-cloud ~]# vi /etc/asterisk/sip.conf
Just type now mention blew
Just type now mention blew
:g/^\s*;/d press enter
:g/^$/d press enter
Now add perametars after just srvlookup=yes
qualify=yes
end of file add parameters
[nafees]
type=friend
context=phones
allow=ulaw,alaw
secret=123456
host=dynamic
[jawad]
type=friend
context=phones
allow=ulaw,alaw
secret=123456
host=dynamic
[nafees]
type=friend
context=phones
allow=ulaw,alaw
secret=123456
host=dynamic
[jawad]
type=friend
context=phones
allow=ulaw,alaw
secret=123456
host=dynamic
save file
[root@asterisk-cloud ~]# asterisk -rvvv
sip reload
sip show peers
sip show peers
To Check Status
[root@asterisk-cloud ~]#asterisk -r
centos-asterisk-server*CLI> sip show peers
Now Configure Phone Dial Extension
[root@asterisk-cloud ~]# cp extensions.conf extensions.conf.orig
[root@asterisk-cloud ~]# echo "" >extensions.conf
[root@asterisk-cloud ~]# vi extensions.conf
[phones]
exten => 100,1,NoOP(First Line)
same => n,NoOp(Second Line)
same => n,Dial(SIP/nafees)
same => n,Hangup
exten => 100,1,NoOP(First Line)
same => n,NoOp(Second Line)
same => n,Dial(SIP/nafees)
same => n,Hangup
exten => 200,1,NoOP(First Line)
same => n,NoOp(Second Line)
same => n,Dial(SIP/jawad)
same => n,Hangup
-----------------------------
Note in extension.conf and sip.conf sip name should be same in case sensitive
save file
same => n,NoOp(Second Line)
same => n,Dial(SIP/jawad)
same => n,Hangup
-----------------------------
Note in extension.conf and sip.conf sip name should be same in case sensitive
save file
centos-asterisk-server*CLI> asterisk -rvvv
centos-asterisk-server*CLI> dialplan reload
centos-asterisk-server*CLI> dialplan reload
No comments:
Post a Comment