fixed some mangling configuration files
[openwrt/svn-archive/archive.git] / net / freeswitch / files / freeswitch.init
index 6c26d20a858bd2677810096ff8ae135225a3dbc6..4476b47bd963f9ff14f950100eb5265d60ed3175 100644 (file)
@@ -14,10 +14,27 @@ start() {
        [ -f $DEFAULT ] && . $DEFAULT
        mkdir -p $FS_DIR_DB
        mkdir -p $FS_DIR_LOG
-       { $FS_DIR/usr/bin/freeswitch $OPTIONS -c >$FS_DIR_LOG/console.log ; } &
+       mkdir -p $FS_DIR_RECORDINGS
+       mkdir -p $FS_DIR_VM_STORAGE
+       ulimit -s 240
+       $FS_DIR/usr/bin/freeswitch $OPTIONS -nc
 }
 
 stop() {
        [ -f $DEFAULT ] && . $DEFAULT
        $FS_DIR/usr/bin/freeswitch $OPTIONS -stop
 }
+
+restart() {
+       # stopping freeswitch is non-blocking, so we wait until freeswitch's 
+       # event socket is down, and then wait an additional ten seconds so that 
+       # freeswitch should be completely shutdown before we start it again
+       local retval
+       stop
+       fs_cli -x status >/dev/null 2>&1
+       retval=$?
+       while [ $retval -eq 0 ]; do sleep 1; fs_cli -x status >/dev/null 2>&1; retval=$?; done
+       sleep 10
+       start
+}
+