Asterisk is a CLI based software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing. In this detailed guide, you will learn how to install Asterisk 16 on CentOS / RHEL 8.
Click here to see Asterisk Features
Step 1: Install EPEL 8 Repository
Before proceed to this article, update your system
dnf update -y
Run below command to install EPEL Release 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
Step 2: Disable SELinux
Open file /etc/SELinux/config using below command and modify a line from SELINUX=enforcing to SELINUX=disabled
vi /etc/selinux/config
Then, save changes and exit
Now reboot your machine
reboot
Step 3: Install Dependencies
Install software Development tools and other required dependencies to run Asterisk using following commands.
dnf groupinstall "Development Tools" -y
dnf install git wget net-tools sqlite-devel psmisc ncurses-devel libtermcap-devel newt-devel libxml2-devel libtiff-devel gtk2-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) crontabs cronie-anacron -y
Step 4: Compile and Install Jansson
Jansson is a C library, it is used to encode/decode and manipulate JSON data. run below commands to install it.
cd /usr/src/ git clone https://github.com/akheron/jansson.git cd jansson autoreconf -i ./configure --prefix=/usr/ make && make install
Step 5: Compile and Install PJSIP
PJSIP is a free and open-source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high-level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.
run following command to install PJSIP
cd /usr/src/ git clone https://github.com/pjsip/pjproject.git cd pjproject ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr make dep make make install ldconfig
Step 6: Install and Configure Asterisk
All dependencies are installed and Asterisk is ready for installation.
cd /usr/src/ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz tar xfz asterisk-16-current.tar.gz rm -f asterisk-16-current.tar.gz cd asterisk-16*/
Install libedit packages using below commands:
dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-3.1-24.20170329cvs.fc29.x86_64.rpm -y
dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-devel-3.1-24.20170329cvs.fc29.x86_64.rpm -y
Asterisk Configuration
./configure --libdir=/usr/lib64
Step 7: Configure Asterisk Menu Options
Set Asterisk menu options by using the following command, you can also select your desired options.
Here you will use arrow keys (Up, Down, Right and Left) to navigate and Enter key to select the desired option. The selected option will be marked with * symbol.
make menuselect
i Select “app_macro” under Applications section.
ii Under “Add-ons” select “chan_ooh323” and “format_mp3”
iii Under “Core Sound Packages” select the following Audio formats.
CORE-SOUNDS-EN-ULAW
CORE-SOUNDS-EN-ALAW
CORE-SOUNDS-EN-GSM
CORE-SOUNDS-EN-G729
CORE-SOUNDS-EN-G722
CORE-SOUNDS-EN-SLN16
CORE-SOUNDS-EN-SIREN7
CORE-SOUNDS-EN-SIREN14
iv For “Music On Hold” select the following minimal modules
MOH-OPSOUND-WAV
MOH-OPSOUND-ULAW
MOH-OPSOUND-ALAW
MOH-OPSOUND-GSM
v On Extra Sound Packages select as shown below
EXTRA-SOUNDS-EN-WAV
EXTRA-SOUNDS-EN-ULAW
EXTRA-SOUNDS-EN-ALAW
EXTRA-SOUNDS-EN-GSM
Then Save and Exit.
Step 8: Build and Install Asterisk
Download the mp3 decoder library into the source tree and build Asterisk
contrib/scripts/get_mp3_source.sh
make make install make samples make config ldconfig
Step 9: Create Asterisk User and Start Asterisk
Create a group and user for asterisk services, and assign appropriate permissions using following commands
groupadd asterisk useradd -r -d /var/lib/asterisk -g asterisk asterisk usermod -aG audio,dialout asterisk chown -R asterisk.asterisk /etc/asterisk /var/{lib,log,spool}/asterisk /usr/lib64/asterisk
Set Asterisk default user:
edit /etc/sysconfig/asterisk file by using below command
vi /etc/sysconfig/asterisk
and add below lines in this file.
AST_USER="asterisk" AST_GROUP="asterisk"
Then edit /etc/asterisk/asterisk.conf file by using below command.
vi /etc/asterisk/asterisk.conf
and add below lines in this file.
runuser = asterisk ; The user to run as. rungroup = asterisk ; The group to run as.
Step 10: Setup Asterisk service
Now restart asterisk service and enable it on boot
systemctl restart asterisk systemctl enable asterisk systemctl status asterisk
Verify that you can connect to Asterisk CLI by running below command
asterisk -rvv
If you entered in above screen congratulation! you have access to Asterisk on CentOS / RHEL.
Also, you can read our posts about CentOS and RHEL.
Please share this post and join our Telegram Channel.
Oct 21 07:02:31 localhost.localdomain asterisk[14308]: Shutting down asterisk: [ OK ]
Oct 21 07:02:31 localhost.localdomain systemd[1]: Stopped LSB: Asterisk PBX.
Oct 21 07:02:31 localhost.localdomain systemd[1]: Starting LSB: Asterisk PBX…
Oct 21 07:02:31 localhost.localdomain asterisk[14339]: Starting asterisk:
Oct 21 07:02:31 localhost.localdomain systemd[1]: asterisk.service: Can’t open PID file /var/run/asterisk/asterisk.pid (yet?) after start: No such file or directory
Oct 21 07:07:31 localhost.localdomain systemd[1]: asterisk.service: Start operation timed out. Terminating.
Oct 21 07:07:31 localhost.localdomain systemd[1]: asterisk.service: Failed with result ‘timeout’.
Oct 21 07:07:31 localhost.localdomain systemd[1]: Failed to start LSB: Asterisk PBX.
——————————————————————————————————-
Me pareciĆ³ que todo corriĆ³ bien….no se en que fallo?
Did you ever find out what was this issue?
I have the same error, even though asterisk seems to be running fine …
Thanks
Muhammed:
Followed your instructions, but getting the following error after make:
[LD] abstract_jb.o acl.o adsi.o alaw.o alertpipe.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o astobj2_container.o astobj2_global.o astobj2_hash.o astobj2_rbtree.o audiohook.o autochan.o autoservice.o backtrace.o bridge.o bridge_after.o bridge_basic.o bridge_channel.o bridge_roles.o bucket.o callerid.o channel.o channel_internal_api.o chanvars.o cli.o codec.o codec_builtin.o config_options.o conversions.o core_local.o core_unreal.o crypt.o data_buffer.o datastore.o db.o devicestate.o dial.o dns.o dns_core.o dns_naptr.o dns_query_set.o dns_recurring.o dns_srv.o dns_system_resolver.o dns_test.o dns_tlsa.o dns_txt.o endpoints.o event.o features_config.o file.o fixedjitterbuf.o format.o format_cache.o format_cap.o format_compatibility.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o image.o io.o iostream.o jitterbuf.o json.o loader.o lock.o logger_category.o manager_bridges.o manager_channels.o manager_endpoints.o manager_mwi.o manager_system.o max_forwards.o md5.o media_cache.o media_index.o message.o mixmonitor.o mwi.o named_locks.o netsock2.o optional_api.o options.o parking.o pbx.o pbx_app.o pbx_builtins.o pbx_functions.o pbx_hangup_handler.o pbx_ignorepat.o pbx_include.o pbx_sw.o pbx_switch.o pbx_timing.o pbx_variables.o pickup.o poll.o presencestate.o privacy.o rtp_engine.o say.o sched.o sdp_srtp.o security_events.o sem.o serializer.o sha1.o sip_api.o slinfactory.o smoother.o sorcery.o srv.o stasis.o stasis_bridges.o stasis_cache.o stasis_cache_pattern.o stasis_channels.o stasis_endpoints.o stasis_message.o stasis_message_router.o stasis_state.o stasis_system.o stdtime/localtime.o strcompat.o stream.o stringfields.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadpool.o threadstorage.o timing.o translate.o ulaw.o uri.o utf8.o utils.o uuid.o version.o xml.o xmldoc.o ccss.o cdr.o cel.o config.o dnsmgr.o dsp.o enum.o features.o http.o indications.o logger.o manager.o named_acl.o plc.o sounds.o udptl.o -> asterisk
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_trust_dir’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_serial’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_expiration_time’
./libasteriskpj.so: undefined reference to `gnutls_transport_set_errno’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_check_hostname’
./libasteriskpj.so: undefined reference to `gnutls_global_set_log_function’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_activation_time’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_issuer_dn’
./libasteriskpj.so: undefined reference to `gnutls_server_name_set’
./libasteriskpj.so: undefined reference to `gnutls_handshake’
./libasteriskpj.so: undefined reference to `gnutls_certificate_type_get’
./libasteriskpj.so: undefined reference to `gnutls_error_is_fatal’
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_verify_function’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_subject_alt_name’
./libasteriskpj.so: undefined reference to `gnutls_record_recv’
./libasteriskpj.so: undefined reference to `gnutls_cipher_suite_info’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_version’
./libasteriskpj.so: undefined reference to `gnutls_bye’
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_system_trust’
./libasteriskpj.so: undefined reference to `gnutls_global_deinit’
./libasteriskpj.so: undefined reference to `gnutls_certificate_server_set_request’
./libasteriskpj.so: undefined reference to `gnutls_init’
./libasteriskpj.so: undefined reference to `gnutls_priority_set_direct’
./libasteriskpj.so: undefined reference to `gnutls_kx_get_name’
./libasteriskpj.so: undefined reference to `gnutls_certificate_get_peers’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_import’
./libasteriskpj.so: undefined reference to `gnutls_transport_set_pull_function’
./libasteriskpj.so: undefined reference to `gnutls_session_get_ptr’
./libasteriskpj.so: undefined reference to `gnutls_global_init’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_init’
./libasteriskpj.so: undefined reference to `gnutls_mac_get_name’
./libasteriskpj.so: undefined reference to `gnutls_session_set_ptr’
./libasteriskpj.so: undefined reference to `gnutls_protocol_get_name’
./libasteriskpj.so: undefined reference to `gnutls_global_set_log_level’
./libasteriskpj.so: undefined reference to `gnutls_deinit’
./libasteriskpj.so: undefined reference to `gnutls_strerror’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_deinit’
./libasteriskpj.so: undefined reference to `gnutls_record_send’
./libasteriskpj.so: undefined reference to `gnutls_credentials_set’
./libasteriskpj.so: undefined reference to `gnutls_rehandshake’
./libasteriskpj.so: undefined reference to `gnutls_transport_set_push_function’
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_key_mem2′
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_trust_file’
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_key_file2′
./libasteriskpj.so: undefined reference to `gnutls_certificate_free_credentials’
./libasteriskpj.so: undefined reference to `gnutls_certificate_get_ours’
./libasteriskpj.so: undefined reference to `gnutls_cipher_get’
./libasteriskpj.so: undefined reference to `gnutls_x509_crt_get_dn’
./libasteriskpj.so: undefined reference to `gnutls_transport_set_ptr’
./libasteriskpj.so: undefined reference to `gnutls_certificate_verify_peers2′
./libasteriskpj.so: undefined reference to `gnutls_certificate_set_x509_trust_mem’
./libasteriskpj.so: undefined reference to `gnutls_cipher_get_name’
./libasteriskpj.so: undefined reference to `gnutls_certificate_allocate_credentials’
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:322: asterisk] Error 1
make: *** [Makefile:387: main] Error 2
Thanks a lot -> great tutorial !
except this two commands are outdated:
dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-3.1-24.20170329cvs.fc29.x86_64.rpm -y
dnf install https://rpmfind.net/linux/fedora/linux/releases/29/Everything/x86_64/os/Packages/l/libedit-devel-3.1-24.20170329cvs.fc29.x86_64.rpm -y
but found them somewhere else whatever they do. I’m a non coder.