Questions about astpp 6

in version 6 after restarting the server, it seems that the freeswitch does not go up, you need to do a fw reload for the sip devices to re-register. my question is: what does this reset procedure do within ASTPP
would it be the monitor?
and in this case we have to create a rule in crontab?

Hello @maxxsolutions ,
Please check your monit servic, is it working?
Thanks.

yes, monit and freeswitch services are started

Hello @maxxsolutions ,
Please check if in monitrc conf file the freeswitch path is correct as monit service is helping the services to restart itself.
Thanks.

I did the following
I disabled the freeswitch service at system startup
what happens is the following, the monit ignores the commands
check process freeswitch with pidfile /var/run/freeswitch/freeswitch.pid
start program=“/bin/systemctl start freeswitch”
stop program=“/bin/systemctl stop freeswitch”
because the pid is already running
the problem is? why the freeswitch does not start correctly with the system?
however as mentioned above
on restart, the monit will see that the service is not active and starts correctly, thus registering the sip devices, without needing a restart via the command line or via the web interface

Hello @maxxsolutions ,
Please add this line
/usr/share/freeswitch/run/freeswitch.pid , below file if not added already.

vim /etc/monit/monitrc
Thanks.

Hi,
just add extra line
/usr/share/freeswitch/run/freeswitch.pid

on /etc/monit/monitrc? Or change it for
check process freeswitch with pidfile /var/run/freeswitch/freeswitch.pid?

I still haven’t been able to solve this problem,
because what does not start is mod_sofia,
it only goes up after a restart on the freeswitch

I have the same problem here. Freeswitch somehow hang/killed, Monitr did start the freeswitch services, but when check sofia status, mod_sofia is not load. Have to run freeswitch restart manually to make it work. Any fix for this?

I have seen this also upon boot/reboot mod_sofia not running, and you have to manually restart FreeSwitch.

With reboot, possibility of freeswitch having higher priority with boot order then mysql and that is the reason when FS started DB is still starting and modules of FS responsible to fetch data from DB did try unsuccessfully.

Simply add cron @reboot sleep 20 && and fs_cli -x ‘reload mod_sofia’

1 Like

I will test this and give you feedback.

I added cron @reboot sleep 30 && sudo systemctl restart freeswitch
Freeswitch is working after reboot.

1 Like

Sounds to me like a systemd problem. What database server are you running? MySQL or MariaDB. Freeswitch needs to start after the database and the way to do that is with the systemd unit file.

Add this systemd file to /etc/systemd/system and modify the first part if using mariadb instead of MySQL so it waits until the database has started.

[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target mysql.service

[Service]
Type=forking
RuntimeDirectory=freeswitch
PIDFile=/run/freeswitch/freeswitch.pid
Environment="DAEMON_OPTS=-ncwait -nonat"
EnvironmentFile=-/etc/default/freeswitch
ExecStart=/usr/bin/freeswitch $DAEMON_OPTS
TimeoutSec=45s
Restart=always

User=www-data
Group=www-data
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPriority=89
UMask=0007

; Comment this out if using OpenVZ
CPUSchedulingPolicy=rr

[Install]
WantedBy=multi-user.target

It’s for sure a FreeSwitch issue as @devangn mentioned.

I fixed this issue by adding “mysql.service” to the “After” line in the freeswitch.service systemd configuration file.
Quick question, regarding this PID path file (I read some answers here on this thread about that)

My monitrc file includes this path:

— FreeSWITCH ----
check process freeswitch with pidfile /var/run/freeswitch/freeswitch.pid

then the systemd file states:

[Service]
; service
Type=forking
PIDFile=/run/freeswitch/freeswitch.pid
Environment=“DAEMON_OPTS=-nonat”
Environment=“USER=freeswitch”
Environment=“GROUP=freeswitch”
EnvironmentFile=-/etc/default/freeswitch
ExecStartPre=/bin/chown -R ${USER}:${GROUP} /var/lib/freeswitch /var/log/freeswitch /etc/freeswitch />usr/share/freeswitch /var/run/freeswitch
ExecStart=/usr/bin/freeswitch -u ${USER} -g ${GROUP} -ncwait ${DAEMON_OPTS}
TimeoutSec=45s
Restart=always

No matter if I change that path in the systemd config file to /var/run/freeswitch/freeswitch.pid I still see (after rebooting) 2 PID files (one inside “/var/run/freeswitch/” directory, and the other under “/run/freeswitch/” directory). Is this a normal behavior -and I have to be leave it as it is- or is it some kind of duplicated process running for same freeswitch installation ? (I’m not a Linux expert, just curious how this works, and trying to minimize any impact to this platform performance)

What is the correct path to the PID file to set in both files (systemd and monirc) ?

/var/run is just a symlink to /run for backwards compatibility. It is mounted as a tmpfs so it is recreated on boot. I seem to remember having problems using symlinks in systemd files at one time, so I think it’s best to use the /run directory instead.

Thank you for the reply, and teaching me about that.
That make sense then. I will leave the systemd file with “/run/freeswitch/” path