How to disable to load asterisk?

I am using version 16,
The problem MySQL is loading before the asterisk, so the cel_odbc and cdr_odbc modules do not write data to the database.
Reloading these modules helps resolve the issue.

I’m thinking of running the asterisk through the script, but for this you need to turn it off.

This depends on the OS you are using to run Asterisk, as is the detail of the order in which start-up scripts are run.

That’s the correct order, for Asterisk to be be able to use the database.

Depending on your system, one or chkconfig or systemctl might be of use.

more precisely, on the contrary, the asterisk starts before MySQL I tried it through systemctl - it still loads,
and chkconfig: command not found

I don’t know where to look yet.

systemctl’s not working sounds like an OS problem, not an Asterisk one. The two commands are mutually incompatible, because they relate to two different start-up systems. As such, I wouldn’t expect to find both on one system.

asterisks in the logs

[2021-06-21 19:46:06] WARNING[906] codec_g729a.c: Failed to initialize G.729 copy protection!
[2021-06-21 19:46:06] NOTICE[976] chan_sip.c: Peer ‘SIP_SERVER_LOCAL’ is now Reachable. (1ms / 2000ms)
[2021-06-21 19:46:06] ERROR[906] cdr_mysql.c: Failed to connect to mysql database asterisk on 127.0.0.1.
[2021-06-21 19:46:06] WARNING[906] loader.c: Module ‘cdr_mysql’ has been loaded but may be removed in a future release. Its replacement is ‘cdr_adaptive_odbc’.

I made a crutch, I share

vi /lib/systemd/system/runscript.service
[Unit]
Description=My Script Service
Requires=mysql.service
After=mysql.service
Requires=asterisk.service
After=asterisk.service
[Service]
Type=simple
User=root
Group=root
ExecStart=/bin/sh -c “sleep 10 && asterisk -rx ‘module reload cel_odbc.so’ && asterisk -rx ‘module reload cdr_odbc.so’”
[Install]
WantedBy=multi-user.target

sudo chmod 644 /lib/systemd/system/runscript.service
sudo systemctl daemon-reload
sudo systemctl enable runscript.service

If anyone has a more elegant way to solve this problem, please share.

Thank you.

Hello,
in /etc/asterisk/modules.conf

try:

[modules]
autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so

Regards

[modules]
autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so

not effect

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.