[Freeswitch-docs] Concerning "Debian Post-Install Tasks"

Tazari, Mohammad Reza saied.tazari at gmail.com
Tue Jan 14 10:41:36 UTC 2020


Related to: 
https://freeswitch.org/confluence/display/FREESWITCH/Debian+Post-Install+Tasks

A story that could be added as a comment to the above page:

I have an installation of freeswitch "_Debian 10 Buster_" pre-compiled 
packages on a PI-4.

When I try to start it as a service during the boot process, freeswitch 
starts, but registration to the external SIP profile fails.
However, when I restart the service, then *fs_cli* returns "*REGED*" for 
"*sofia status*".

As I could not find any other solution for this than restarting the 
service, I have added the following to the *[Service]* section of 
*freeswitch.service*:

*ExecStartPost=$HOME/fs_reged.sh*

where the content of *$HOME/fs_reged.sh* is the following:

    *#!/bin/bash n=`cat $HOME/.fs_reged 2>/dev/null` if [ "x$n" = "x" ];
    then n=0; fi n=$(( $n + 1 )) # counter for the number of calls to
    this script fs_reged=`/usr/bin/fs_cli -x "sofia status" | grep
    REGED` if [ $n -le 3 -a "x$fs_reged" = "x" ] ; then # restart the
    service at most for the third time echo $n > $HOME/.fs_reged
    systemctl restart freeswitch else # external sip profile registered
    rm -f $HOME/.fs_reged fi*

This script prevents an infinite loop by not restarting the service 
after three times of restart
-->

 1. You may change '3' in the 'if' statement to any other number to have
    another limitation for the number of restarts (not tested with any
    other number though)
 2. You may remove '*$n -le 3  -a *' to have as many restarts as needed
    for the successful sofia registration (not tested in this form though)


P.S. I tried to follow the recommendation on the "Debian Post-Install 
Tasks" page and "submit a JIRA ticket for the DOCS project so that we 
can capture this knowledge for the community", but after signing up to 
JIRA, I could not find any possibility for creating a new issue...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-docs/attachments/20200114/97408f48/attachment.html>


More information about the Freeswitch-docs mailing list