• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to configure Realtime Database Connection on Asterisk on Oracle Linux 9.3

  • 00:30 cat /etc/os-release
  • 00:51 systemctl status asterisk.service
  • 01:16 dnf install mysql* -y
  • 03:41 systemctl status mysqld.service
  • 04:02 systemctl start mysqld.service
  • 04:26 systemctl status mysqld.service
  • 04:38 vim /etc/asterisk/res_config_mysql.conf
  • 05:17 vim /etc/asterisk/extconfig.conf
  • 05:55 vim /etc/asterisk/sip.conf
  • 06:26 asterisk -rx "module reload"
{{postValue.id}}

To Configure Realtime Database Connection On Asterisk On Oracle Linux 9.3

Introduction:

Configuring a real-time database connection on Asterisk involves setting up Asterisk to dynamically read its configuration and state information from a database instead of using static configuration files.

Procedure:

Step 1: Check the OS version by using the below command

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3

Step 2: Check the status of asterisk service by using the below command

[root@linuxhelp ~]# systemctl status asterisk.service
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/rc.d/init.d/asterisk; generated)
     Active: active (running) since Mon 2024-02-19 04:02:05 IST; 3 months 17 days ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1001 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
   Main PID: 1062
      Tasks: 37 (limit: 21739)
     Memory: 65.0M
        CPU: 6.277s
     CGroup: /system.slice/asterisk.service
             ├─1056 /bin/sh /usr/sbin/safe_asterisk
             └─5831 /usr/sbin/asterisk -f -vvvg -c
Feb 19 04:02:05 linuxhelp systemd[1]: Starting LSB: Asterisk PBX...
Feb 19 04:02:05 linuxhelp asterisk[1001]: Starting asterisk:
Feb 19 04:02:05 linuxhelp systemd[1]: asterisk.service: Can't open PID file /run/asterisk/asterisk.pid (yet?) after start: Operation not permitted
Feb 19 04:02:05 linuxhelp systemd[1]: asterisk.service: Supervising process 1062 which is not our child. We'll most likely not notice when it exits.
Feb 19 04:02:05 linuxhelp systemd[1]: Started LSB: Asterisk PBX.

Step 3: Install the Mysql service by using the below command

[root@linuxhelp ~]# dnf install mysql* -y
Last metadata expiration check: 0:00:19 ago on Friday 07 June 2024 02:42:31 AM.
Dependencies resolved.
=============================================================================================================================================================================================
 Package                                             Architecture                       Version                                          Repository                                     Size
=============================================================================================================================================================================================
Installing:
 mysql                                               x86_64                             8.0.36-1.el9_3                                   ol9_appstream                                 2.7 M
 mysql-common                                        x86_64                             8.0.36-1.el9_3                                   ol9_appstream                                 101 k
 mysql-errmsg                                        x86_64                             8.0.36-1.el9_3                                   ol9_appstream                                 523 k
 mysql-release-el9                                   x86_64                             1.0-1.el9                                        ol9_baseos_latest                              14 k
 mysql-selinux                                       noarch                             1.0.10-1.el9                                     ol9_appstream                                  35 k
 mysql-server                                        x86_64                             8.0.36-1.el9_3                                   ol9_appstream                                  17 M
Upgrading:
 selinux-policy                                      noarch                             38.1.35-2.0.2.el9_4                              ol9_baseos_latest                              57 k
 selinux-policy-targeted                             noarch                             38.1.35-2.0.2.el9_4                              ol9_baseos_latest                             7.8 M
Installing dependencies:
 mecab                                               x86_64                             0.996-3.el9.4                                    ol9_appstream                                 384 k
 protobuf-lite                                       x86_64                             3.14.0-13.el9                                    ol9_appstream                                 233 k
 yum-utils                                           noarch                             4.3.0-11.0.1.el9_3                               ol9_baseos_latest                              53 k
Transaction Summary
=============================================================================================================================================================================================
Install  9 Packages
Upgrade  2 Packages
Total download size: 29 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): mysql-release-el9-1.0-1.el9.x86_64.rpm                                                                                                                75 kB/s |  14 kB     00:00
(2/11): yum-utils-4.3.0-11.0.1.el9_3.noarch.rpm                                                                                                              256 kB/s |  53 kB     00:00
(3/11): mecab-0.996-3.el9.4.x86_64.rpm                                                                                                                       1.6 MB/s | 384 kB     00:00
(4/11): mysql-common-8.0.36-1.el9_3.x86_64.rpm                                                                                                               2.4 MB/s | 101 kB     00:00
(5/11): mysql-selinux-1.0.10-1.el9.noarch.rpm                                                                                                                820 kB/s |  35 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                         10 MB/s |  29 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: selinux-policy-targeted-38.1.35-2.0.2.el9_4.noarch                                                                                                                  1/1
  Preparing        :                                                                                                                                                                     1/1
  Installing       : mysql-common-8.0.36-1.el9_3.x86_64                                                                                                                                 1/13
  Upgrading        : selinux-policy-38.1.35-2.0.2.el9_4.noarch                                                                                                                          2/13
  Running scriptlet: selinux-policy-38.1.35-2.0.2.el9_4.noarch                                                                                                                          2/13
  Running scriptlet: selinux-policy-targeted-38.1.35-2.0.2.el9_4.noarch                                                                                                                 3/13
  Upgrading        : selinux-policy-targeted-38.1.35-2.0.2.el9_4.noarch                                                                                                                 3/13
  Running scriptlet: selinux-policy-targeted-38.1.35-2.0.2.el9_4.noarch                                                                                                                 3/13
  Running scriptlet: mysql-selinux-1.0.10-1.el9.noarch                                                                                                                                  4/13
  Installing       : mysql-selinux-1.0.10-1.el9.noarch                                                                                                                                  4/13
  Running scriptlet: mysql-selinux-1.0.10-1.el9.noarch                                                                                                                                  4/13
libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200.
  Verifying        : mysql-release-el9-1.0-1.el9.x86_64                                                                                                                                 1/13
  Verifying        : yum-utils-4.3.0-11.0.1.el9_3.noarch                                                                                                                                2/13
  Verifying        : mecab-0.996-3.el9.4.x86_64                                                                                                                                         3/13
  Verifying        : mysql-8.0.36-1.el9_3.x86_64                                                                                                                                        4/13
  Verifying        : mysql-common-8.0.36-1.el9_3.x86_64                                                                                                                                 5/13

Upgraded:
  selinux-policy-38.1.35-2.0.2.el9_4.noarch                                                selinux-policy-targeted-38.1.35-2.0.2.el9_4.noarch
Installed:
  mecab-0.996-3.el9.4.x86_64          mysql-8.0.36-1.el9_3.x86_64          mysql-common-8.0.36-1.el9_3.x86_64   mysql-errmsg-8.0.36-1.el9_3.x86_64    mysql-release-el9-1.0-1.el9.x86_64
  mysql-selinux-1.0.10-1.el9.noarch   mysql-server-8.0.36-1.el9_3.x86_64   protobuf-lite-3.14.0-13.el9.x86_64   yum-utils-4.3.0-11.0.1.el9_3.noarch
Complete!

Step 4: Check the status of MySQL service by using the below command

[root@linuxhelp ~]# systemctl status mysqld.service
○ mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled)
     Active: inactive (dead)

Step 5: Start the mysql service by using the below command

[root@linuxhelp ~]# systemctl start mysqld.service

Step 6: Check the status of mysql service by using the below command

[root@linuxhelp ~]# systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; preset: disabled)
     Active: active (running) since Fri 2024-06-07 02:44:41 IST; 18s ago
    Process: 8496 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 8518 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
   Main PID: 8594 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 21739)
     Memory: 456.2M
        CPU: 7.404s
     CGroup: /system.slice/mysqld.service
             └─8594 /usr/libexec/mysqld --basedir=/usr
Jun 07 02:44:33 linuxhelp systemd[1]: Starting MySQL 8.0 database server...
Jun 07 02:44:33 linuxhelp mysql-prepare-db-dir[8518]: Initializing MySQL database
Jun 07 02:44:41 linuxhelp systemd[1]: Started MySQL 8.0 database server.

Step 7: Edit the res_config_mysql.conf file by using the below command

[root@linuxhelp ~]# vim /etc/asterisk/res_config_mysql.conf
Add those following lines
[general]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = asteriskuser
dbpass = asteriskpass
dbport = 3306

Step 8: Edit the extconfig.conf file by using the below command

[root@linuxhelp ~]# vim /etc/asterisk/extconfig.conf
Add those following lines
[settings]
sippeers => mysql,asterisk,ast_sipfriends
sipusers => mysql,asterisk,ast_sipfriends

Step 9: Edit the sip.conf file by using the following command

[root@linuxhelp ~]# vim /etc/asterisk/sip.conf
Add those following lines
[general] 
rtcachefriends=yes 
rtupdate=yes 
rtautoclear=yes 
ignoreregexpire=yes 
srvlookup=yes

Step 10: Reload the Asterisk service by using the below command

[root@linuxhelp ~]# asterisk -rx "module reload"

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to configure Realtime Database Connection on Asterisk 9.3. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is a Real-Time Database Connection in Asterisk?

A

A real-time database connection in Asterisk allows Asterisk to dynamically read and write its configuration and state information from a database, enabling more flexible, scalable, and manageable configurations.

Q

Why use a Real-Time Database Connection?

A

Dynamic Configuration: Make changes on the fly without needing to reload or restart Asterisk.
Scalability: Easier to manage large configurations by centralizing them in a database.
Integration: Facilitates integration with other systems and applications.

Q

How do I apply the configuration changes?

A

Reload Asterisk to apply the changes:
sudo asterisk -rx "module reload"

Q

How do I create the necessary database schema?

A

Import the Asterisk schema into your database:
mysql -u asteriskuser -p asterisk < /usr/share/doc/asterisk/realtime/mysql/realtime.sql

Q

Can I use other databases besides MySQL?

A

Yes, Asterisk supports other databases like PostgreSQL and ODBC. The configuration steps will be similar but will require the appropriate database connector and configuration adjustments.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luk Van De Looverbosch ?
How to create a root ?

Hello,
How to create root@linuxhelp in Linux Mint 20.1 64-bit ?
Thanks in advance for your reply.
Best regards.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.