Koozali.org: home of the SME Server

Sail and fxotune after re-boot

seankav

Sail and fxotune after re-boot
« on: January 17, 2007, 12:35:42 PM »
I have been through all the info I can find on reducing echo on PSTN calls from our IP phones and fxotune has done a fantastic job.

My set up is SME7.0 with Sail 2.1.14-347 and a TDM02B board.

My question is that in the info found at http://www.voip-info.org/wiki/view/Asterisk+fxotune indicates that fxotune -s needs to be run each time we re-boot the server.

Past experience of SME has shown that this could be 18 months away, by which time I will have forgotten all about fxotune -s  :lol:

So, how and where do I set it up so the fxotune settings are loaded in the correct sequence after a re-boot?  ie: before asterisk starts.

There was a reference from Selintra about supplying a "fix" for this but the thread wandered off onto other things...http://forums.contribs.org/index.php?topic=34731.0

The second part of this question is where should I move fxotune to on my server.  Currently I have just run it via Putty directly from the Ibay where I downloaded it to.

As far as I can tell this is my last question in what has been a fantastically simple and successful install and set up.

Cheers,

Sean

Offline SARK devs

  • *****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Sail and fxotune after re-boot
« Reply #1 on: January 18, 2007, 12:07:41 AM »
Quote
So, how and where do I set it up so the fxotune settings are loaded in the correct sequence after a re-boot? ie: before asterisk starts.

Hi Sean,

I'm pretty sure we did this for one of our customers who was having echo problems but for some reason it never found its way into the product proper.  If you want to patch it yourself and you know a bit of bash scripting you can do it in the start routine in /etc/init.d/rc.d/asterisk.
Put it in at the beginning of our mods.....

Code: [Select]

  start)
#
#   selintra mod for SARK/SAIL
#
if [ -e /home/e-smith/db/selintra ]; then

    ZAPHFC=`/sbin/e-smith/db selintra getprop zaphfc status`
    WCTDM=`/sbin/e-smith/db selintra getprop wctdm  status`
    WCFXO=`/sbin/e-smith/db selintra getprop wcfxo status`
    ZTDUMMY=`/sbin/e-smith/db selintra getprop ztdummy status`

    if [ ! -e /dev/zap ]; then
        /sbin/modprobe zaptel
        WAITCNT=0
        echo "Waiting for udev."
        while [ ! -e /dev/zap -a $WAITCNT -le 60 ]; do
            sleep 1
            WAITCNT=`expr $WAITCNT + 1`
        done
        if [ $WAITCNT -gt 60 ]; then
            echo "Waited too long for udev, - aborting Asterisk  startup."
            exit 1
        fi

        if [ $ZAPHFC = 'YES' ]; then
            /sbin/modprobe zaphfc
        fi

        if [ $WCTDM = 'YES' ]; then
            /sbin/modprobe wctdm
        fi

        if [ $WCFXO = 'YES' ]; then
            /sbin/modprobe wcfxo
        fi

        if [ $ZTDUMMY = 'YES' ]; then
           /sbin/modprobe ztdummy
        fi
        /sbin/ztcfg
     fi
fi
#
#   end selintra mod
#


If you want to make the patch generic then check for the existence of fxotune (depending upon where you saved it) before you execute it.  You might even want to do it "sme-server fashion" and create a service record in the configuration database with a status of enabled/disabled and check that.  We check a similar field in the selintra database to see which drivers to load.

hint:-

Code: [Select]
/sbin/e-smith/config set fxotune service status enabled

You can then query that in the startup routine to decide whether to issue the fxotune -s or not.

Code: [Select]
FXOTUNE=`/sbin/e-smith/config getprop fxotune status`

You can put fxotune into /etc/selintra for want of somewhere better.

If you do have a go, send it to us and we'll shove it into the next release.


Kind Regards

Selintra

seankav

Sail and fxotune after re-boot
« Reply #2 on: January 30, 2007, 10:43:31 AM »
Thanks for that.

I have some more learning to do here so it may be a little while before I get in and sort out that start routine - never done any bash scripting but this is a good reason to start.

Once I have a test server up that I can kill with immunity I will give it a go.

Cheers,

Sean

Offline SARK devs

  • *****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Sail and fxotune after re-boot
« Reply #3 on: February 03, 2007, 10:50:45 AM »
We will put an official enhancement into the next release for this (we've just had to resurrect it for two customers who have echo problems on their Analogue lines).

Kind Regards

Selintra