/
HowTo recompile Freeswitch on a CentOS 5 sipXecs install

 

HowTo recompile Freeswitch on a CentOS 5 sipXecs install

Purpose

This mini howto describes the steps I executed to re-compile a debug version of Freeswitch on a CentOS 5 base ISO install of sipXecs.

Step 1: Add a new CentOS 5 yum repository

On a shell as user "root" create a new repository text file under /etc/yum.repos.d/CentOS5.repo to add this content:

[CentOS5base]
name=CentOS-5-Base
mirrorlist=[http://mirrorlist.centos.org/?release=5&arch=i386&repo=os]
gpgcheck=0
enabled=0
gpgkey=[http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5]

[CentOS5updates]
name=CentOS-5-Updates
mirrorlist=[http://mirrorlist.centos.org/?release=5&arch=i386&repo=updates]
gpgcheck=0
enabled=0
gpgkey=[http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5]

[CentOS5plus]
name=CentOS-5-Plus
mirrorlist=[http://mirrorlist.centos.org/?release=5&arch=i386&repo=centosplus]
gpgcheck=0
enabled=0
gpgkey=[http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5]
Step 2: Rename the Freeswitch executable path

Keep the original Freeswitch binary intact and create a debug version instead.

In file $INSTALL/bin/freeswitch.sh replace those lines (Note: $INSTALL is most likely "/usr").

Replace lines:

_FS_EXEC="/usr/local/freeswitch/bin/freeswitch _
     if [xecsdev: ! -x /usr/local/freeswitch/bin/freeswitch ]
   echo "Error: FreeSWITCH executable is not at /usr/local/freeswitch/bin/freeswitch" >&2

With lines:

_FS_EXEC="/usr/local/freeswitch_debug/bin/freeswitch _
     if [xecsdev: ! -x /usr/local/freeswitch_debug/bin/freeswitch ]
   echo "Error: FreeSWITCH executable is not at /usr/local/freeswitch_debug/bin/freeswitch" >&2

Step 3: Install the necessary RPMs in order to compile freeswitch
yum \--enablerepo CentOS5base install gcc-c++.i386
yum \--enablerepo CentOS5base install ncurses-devel.i386
Step 4: Download the freeswitch code and get ready to compile it
cd /tmp
wget http://latest.freeswitch.org/freeswitch-1.0.5-latest.tar.gz
tar xvfz freeswitch-1.0.5-latest.tar.gz
cd freeswitch-1.0.5-<date>-0400
./configure \--prefix=/usr/local/freeswitch_debug
Step 5: Build and re-install your debug version of Freeswitch
cd /tmp/freeswitch-1.0.5-<date>-0400
  • Make your code changes under src/...
    make
    
  • Stop the running version of Freeswitch
    sipxproc \-k FreeSWITCH
  • Wait until the Freeswitch process is stopped. You can use this command to verify.
    ps \-ef \| grep freeswitch
  • Install the re-compiled Freeswitch binary
    make install
  • Restart the debug version of the Freeswitch process.
    sipxproc \-s FreeSWITCH
Step 6: Optionally use the Freeswitch console to get more debug output

One can turn full debug level tracing using the console and redirect the output on the console.

  • Start the console
    /usr/local/freeswitch_debug/bin/fs_cli
  • Turn debug level tracing and log to console
    debug 7
    log
  • Quit the console prompt
    exit
    
  • Additional options
    help
    
    For more information on Freeswitch visit this link