<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Related to: <a
href="https://freeswitch.org/confluence/display/FREESWITCH/Debian+Post-Install+Tasks">https://freeswitch.org/confluence/display/FREESWITCH/Debian+Post-Install+Tasks</a></p>
<p>A story that could be added as a comment to the above page:<br>
</p>
<p>I have an installation of freeswitch "<u>Debian 10 Buster</u>"
pre-compiled packages on a PI-4.</p>
<p>When I try to start it as a service during the boot process,
freeswitch starts, but registration to the external SIP profile
fails.<br>
However, when I restart the service, then <b><font size="+1"><tt>fs_cli</tt></font></b>
returns "<b><font size="+1"><tt>REGED</tt></font></b>" for "<b><font
size="+1"><tt>sofia status</tt></font></b>". <br>
</p>
<p>As I could not find any other solution for this than restarting
the service, I have added the following to the <b><font size="+1"><tt>[Service]</tt></font></b>
section of <b><font size="+1"><tt>freeswitch.service</tt></font></b>:</p>
<p align="center"><b><font size="+1"><tt>ExecStartPost=$HOME/fs_reged.sh</tt></font></b><br>
</p>
<p>where the content of <b><font size="+1"><tt>$HOME/fs_reged.sh</tt></font></b>
is the following:</p>
<blockquote>
<pre><b><font size="+1">#!/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</font></b></pre>
</blockquote>
<p>This script prevents an infinite loop by not restarting the
service after three times of restart<br>
--></p>
<ol>
<li>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)<br>
</li>
<li>You may remove '<b><font size="+1"><tt>$n -le 3 -a </tt></font></b>'
to have as many restarts as needed for the successful sofia
registration (not tested in this form though)<br>
</li>
</ol>
<p><br>
P.S. I tried to follow the recommendation on the "Debian
Post-Install Tasks" page and "<span style="color: rgb(23, 43, 77);
font-family: -apple-system, BlinkMacSystemFont, "Segoe
UI", Roboto, Oxygen, Ubuntu, "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
font-size: 14px; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal; font-weight: 400;
letter-spacing: normal; orphans: 2; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;">submit a JIRA ticket for the DOCS
project so that we can capture this knowledge for the community</span>",
but after signing up to JIRA, I could not find any possibility for
creating a new issue...</p>
<p><br>
</p>
</body>
</html>