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...