[asterisk-users] Proper way to start Asterisk on CentOS 7? (Carlos Chavez)

Stefan Viljoen viljoens at verishare.co.za
Mon May 9 01:46:36 CDT 2016


Hi Carlos

I have experienced something similar starting Asterisk 1.8.32.3 on Centos 7
on commodity / whitebox hardware.

The problem was that Asterisk was starting "too quickly" in the systemd
startup sequence, before the required services it needs to run were up and
ready.

I eventually came up with this systemd script to start it, and this now
starts Asterisk on all our our new Centos 7-using deployments.

Maybe you can try it out...? This starts our Asterisk 1.8 instances without
problems on Centos 7 on boot:

--

[Unit]
Description=Asterisk
After=network.target
After=network-online.target
After=startup.service
After=mysql.service
Wants=mysql.service

[Service]
Type=idle
User=root
Group=root
ExecStart=/usr/sbin/asterisk -f
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'
TimeoutSec=300

LimitCORE=infinity
LimitNOFILE=8096
Restart=always
RestartSec=4

[Install]
WantedBy=multi-user.target

--

I place this in /etc/systemd/system as "asterisk.service" and then install
it via

systemctl enable asterisk.service

Hope this helps.

Stefan
-----------------
Message: 1
Date: Thu, 5 May 2016 12:07:37 -0500
From: Carlos Chavez <cursor at telecomabmex.com>
To: "asterisk-users at lists.digium.com"
	<asterisk-users at lists.digium.com>
Subject: [asterisk-users] Proper way to start Asterisk on CentOS 7?
Message-ID: <572B7DD9.4090503 at telecomabmex.com>
Content-Type: text/plain; charset=utf-8; format=flowed

     I am having a strange problem with Asterisk 13 on a CentOS 7 plataform.
I have several servers running on this configuration but a particular
installation on a Dell PowerEdge 220 server is the one giving me the most
problems.  All installations are automated via a script so there is no
difference but the hardware.  All dependencies are installed and there are
no errors during installation.  We use realtime mysql for our
configurations.

     The problem comes when Asterisk is started from init.d/asterisk.  
Asterisk loads but phones will not register and the Asterisk CLI will not
respond to commands.  Something like "pjsip show endpoints" shows nothing
and sometimes the CLI hangs. Asterisk itself is not crashing and if I open
another terminal I can get into the CLI even though the other terminal is
not responding. If I start Asterisk manually from the command line
everything works as expected, phones register and calls flow.

     I tried a systemd startup script someone published but I get the same
result as the initd script.  I wonder why I am only getting this problem on
the Dell 220 server but not on other servers (even a Dell T20 server does
not have the same problem).  My office server is an HP ML110 and has been
working with Asterisk 13 and CentOS 7 for over 6 months now with no issues.
It uses the init.d script that comes with Asterisk and it has never hanged.

     Anyone know if the PowerEdge 220 server has special issues with Linux
or Asterisk in particular?  How do you recommend starting Asterisk?

--
Telecomunicaciones Abiertas de M?xico S.A. de C.V.
Carlos Ch?vez
+52 (55)9116-91161




More information about the asterisk-users mailing list