These are the overall installation instructions for sipX.

sipX is composed of 11 components.  They have to be installed in
order, because some of the components are prerequisites for others.
In addition, some packages from other sources are prerequisites for
the sipX components, and there are some steps that need to be taken
after all 11 components have been installed.

When building from source, the default install location for the
sipXchange software is /usr/local/sipx/{lib,bin,...}.  If you want it
installed in a different location, add "--prefix=whatever" to the
./configure commands.

This file is mostly a frame around the instructions for building the
11 sipX components.  But it orders the builds in a way that is more
convenient for building sipX as a whole.

Prerequisite packages
---------------------

There are a number of prerequisite packages from other sources that
need to be installed.  Each of them is described in detail in the sipX
component that requires it.  But it is usually more convenient to
build all the prerequisites first, so we are listing them here, along
with a reference to which component gives the build instructions.



Notes from Doug:

        - setenv SIPXPBXUSER sipxchange
        - create a new user "sipxchange" in the group "users"
        - do "make" as "ag"
        - do "make install" as "root"
        - run sipXpbx as "root"


GLib2 - low-level core library that forms the basis of GTK+ and GNOME.

  See the instructions in sipXportLib/INSTALL.

PCRE - Perl Compatible Regular Expression Library

  See the instructions in sipXportLib/INSTALL.

Cppunit 1.10.2 - Unitesting framework for C++
  http://cppunit.sourceforge.net/

OpenSSL 0.9.7.c - Security Library
  http://www.openssl.org

*Autoconf 2.57 & Automake 1.6 - GNU build tool chain
  http://www.gnu.org/directory/GNU/
  *ONLY if building from subversion
  Note: autoconf 2.58 has a bug which does causes it not to work with
  sipX.  Verion 2.59 works as well.

libtool 1.4.3
  http://www.gnu.org/software/libtool/
  On RedHat Enterprise 3 "up2date libtool libtool-libs"


sipXportLib
-----------

See sipXportLib/INSTALL.


sipXtackLib
-----------

Download and untar binary ant-1.6.x.tar.gz into /usr/java/ directory
Erase older version of the Ant RPM if it does exist (e.g. ant-1.5.2)
Set two environmental variables:
        ANT_HOME=/usr/bin
        JAVA_HOME=/usr/java/j2sdk1.4.2_05
Make a soft link from the ${ANT_HOME}/lib directory to the /usr/share/java/junit-3.8.1.jar file
autoreconf --install --force
./configure
make
sudo make install


sipXmediaLib
------------

autoreconf --install --force
./configure
make
make check
sudo make install


sipXcallLib
-----------

autoreconf --install --force
./configure
make
make check
sudo make install


sipXcommserverLib
-----------------

autoreconf --install --force
./configure
make
make check
sudo make install


sipXconfig
----------

Download and unzip Jboss 2.4.X with Tomcat into the /usr/java directory
Download and untar SOAP Lite Perl into the /usr directory
Set two environment variables:
   JBOSS_HOME=/usr/java/JBoss-2.4.10_Tomcat-4.0.6/jboss
   TOMCAT_HOME=/usr/java/JBoss-2.4.10_Tomcat-4.0.6/catalina

See the instructions in sipXconfig/INSTALL.

You can postpone setting up the SSL key until the end of the entire
sipX installation.


sipXvxml
--------

Check if any "w3c-libwww" RPM is installed, remove it first (Note: it probably will require removal of a dependent package "tetex-xdvi"):
        - rpm -e w3c-libwww-5.4.0-9.1
    or: - rpm -e w3c-libwww-5.4.0-9.1 tetex-xdvi-2.0.2-13

Download and install the tarball for "w3c-libwww":
        - http://www.w3.org/Library/Distribution/w3c-libwww-5.4.0.tgz
        - tar -xvzf w3c-libwww-5.4.0.tgz
        - cd w3c-libwww-5.4.0
        [ Where $SANDBOX is a checked-out copy of sipX: ]
        - patch -u -o configure.patched -i $SANDBOX/sipXvxml/meta/w3c-libwww-5.4.0-configure.patch configure
        - cp configure.patched configure
        - ./configure --with-expat --with-ssl="-L/usr/local/ssl/lib -lssl -lcrypto" --with-zlib
        - make
        - sudo make install

Check if any of "xerces-c" RPMs are installed, remove them first.
(Don't confuse "xerces-j2" with "xerces-c"!)

Download and install "xerces-c-src_2_5_0.tar.gz":
        - http://apache.bestwebcover.com/xml/xerces-c/xerces-c-current.tar.gz
        - su - (become root)
        - cd /usr/local/src/
        - tar -zxvf /home/ag/downloads/xerces-c-src_2_5_0.tar.gz
        - chown -R root xerces-c-src_2_5_0/
        - setenv XERCESCROOT /usr/local/src/xerces-c-src_2_5_0
        - setenv LD_LIBRARY_PATH /usr/local/lib
        - cd $XERCESCROOT/src/xercesc
        - ./runConfigure -p linux -n libwww
        - make
        - make install

Note: if you see the following message by running ./runConfigure:

checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

         you may need to set the following environment variable:
         bash, sh:  export LD_LIBRARY_PATH=/usr/local/lib
         csh, tcsh: setenv LD_LIBRARY_PATH /usr/local/lib

Install sipXvxml:
        - autoreconf --install --force
        - ./configure
        - make
        - sudo make install


sipXregistry
------------

autoreconf --install --force
./configure
make
sudo make install


sipXpublisher
-------------

See the instructions in sipXpublisher/INSTALL.

You can postpone setting up the SSL key until the end of the entire
sipX installation.


sipXproxy
---------

autoreconf --install --force
./configure
make
sudo make install


sipXpbx
-------

1. Prepare (clean up) environment:

        1.1.Remove the "httpd" RPM along with all dependencies:
                rpm -q --whatrequires httpd
                rpm -e httpd-2.0.49-4 \
                        mod_auth_mysql-20030510-4.1 \
                        mod_perl-1.99_12-2.1 \
                        mod_python-3.1.3-1 \
                        mod_ssl-2.0.49-4 \
                        httpd-devel-2.0.49-4 \
                        mod_auth_pgsql-2.0.1-4.1 \
                        php-4.3.4-11 \
                        webalizer-2.01_10-22 \
                        php-ldap-4.3.4-11 \
                        php-mysql-4.3.4-11 \
                        php-odbc-4.3.4-11 \
                        php-pear-4.3.4-11 \
                        php-pgsql-4.3.4-11

        1.2. Remove the directory "/etc/httpd" if it exists (because
             this is a standard place for configuration of the httpd
             server built from the RPM)

2. You can now use the Red Hat Apache RPMs for building sipX.

        But if you want or need to install Apache from the source:
        - http://httpd.apache.org/download.cgi (or: http://archive.apache.org/dist/httpd)
        - tar -zxvf httpd-2.0.50.tar.gz (or: tar -zxvf httpd-2.0.49.tar.gz)
        - cd httpd-2.0.50 (or: cd httpd-2.0.49)
[Needed to add CPPFLAGS="-I/usr/kerberos/include" here:]
        - ./configure --enable-ssl
        - make
        - sudo make install

3. Download and install the Apache plugin "mod_cplusplus":
        - http://modcplusplus.sourceforge.net (or http://modcplusplus.sf.net)
        - tar -zxvf mod_cplusplus-1.3.1.tar.gz
        - cd mod_cplusplus

        - If using the RPM version of Apache, apply the following patch so
          the code can find the header file directory:

----------------------------------------------------------------------
--- configure.in.orig   2004-05-23 21:34:27.000000000 -0400
+++ configure.in        2004-09-20 13:55:06.000000000 -0400
@@ -48,7 +48,16 @@
                                 HTTPD_DIR="/usr"
                                 CPPFLAGS="$CPPFLAGS -I/usr/include/apache2"
                         else
-                                AC_MSG_ERROR($searchfile not found. Apache2 installation cannot be located!)
+                               AC_MSG_RESULT($searchfile not found)
+                               AC_MSG_CHECKING(for Red Hat packaging)
+                               searchfile="/usr/include/httpd/httpd.h"
+                               if test -f $searchfile ; then
+                                       AC_MSG_RESULT(found $searchfile)
+                                       HTTPD_DIR="/usr"
+                                       CPPFLAGS="$CPPFLAGS -I/usr/include/httpd"
+                               else
+                                       AC_MSG_ERROR($searchfile not found. Apache2 installation cannot be located!)
+                               fi
                         fi
                 fi
         fi
----------------------------------------------------------------------

        - If compiling with g++ 3.2.2, apply the following patch:

----------------------------------------------------------------------
--- src/apache_handler.cpp.orig 2004-05-23 21:34:27.000000000 -0400
+++ src/apache_handler.cpp      2004-09-19 11:43:51.000000000 -0400
@@ -1,10 +1,11 @@
 #define EXPORT_MODCPP

 #include "apr_dso.h"
 #include "apache_handler.h"
 #include "apache_protocol.h"
+#include "apache_filters.h"

 extern "C" {

 #define CALL_REQ_FUNCTION(function_name) \
     int result = DECLINED; \
----------------------------------------------------------------------

        - ./autogen.sh --with-httpd=/usr/lib/httpd
          (--with-httpd=/usr/local/apache2 if installing Apache from tar files)
          (The value is the location of build/config_vars.mk.)
        - make
        - If using the Apache RPM, install with:
            sudo cp src/.libs/libmod_cplusplus.so* /usr/lib/httpd/modules/
            sudo cp include/*.h /usr/include/httpd/include
[Hmmm, the default file tree doesn't create /usr/include/httpd/include.
And is it right, anyway?]
        - If installing Apache from tar files, install with:
            sudo cp src/.libs/libmod_cplusplus.so* /usr/local/apache2/modules/
            sudo cp include/*.h /usr/local/apache2/include

4. If Expat 1.95.7 RPM has not been installed on your machine, you have to
download and install it (and expat-devel as well).

5. Download and install the "cgicc" RPM (v. >= 3.2.2):
        - http://www.cgicc.org/
        - tar -zxvf cgicc-3.2.3.tar.gz
        - cd cgicc-3.2.3
        - ./configure
        - make
        - sudo make install

6. Install sipXpbx:
        - autoreconf --install --force
          [Make sure you have installed or built Apache by this point,
          as ./configure needs to know where Apache is.]
        - ./configure
        - make
        - sudo make install
        - Run the configuration preprocessor script
          /usr/local/sipx/bin/httpd-sipxchange-config.sh to generate
          fully resolved configuration files in the directories
          /usr/local/sipx/etc/sipxpbx, /usr/local/sipx/share/www/doc/aa_vxml,
          and /usr/local/sipx/share/www/doc/vm_vxml.
          You can run httpd-sipxchange-config.sh from any directory;
          it knows where to look for files to process.
        - For this script to work, /usr/local/sipx/etc/sipxpbx/config.defs
          must exist.  It is created by executing "sudo make install"
          for sipXcommserverLib.


Final Installation Actions
--------------------------

Change the ownership of the data directory to the sipX user:
  - chown -R $SIPXPBXUSER ...sipX.../var

If you have not already done so, generate and install SSL keys
according to the instructions in
sipXcommserverLib/bin/ssl-cert/INSTALL.ssl.

Unfortunately, if the SSL keys are not installed correctly, Apache
does not report an error, it just silently refuses to listen for SSL
connections.

To test that Apache SSL is working:

  - Generate the configuration files from the .in files:
      ...sipX.../bin/httpd-sipxchange-config.sh
  - Start Apache:
      ...Apache.../bin/httpd -k start \
                  -f ...sipX.../etc/sipxpbx/httpd.conf -DSSL

  Check SSL functionality by fetching:
          https://localhost:8091
  (It does not matter what you receive.)

  - Remember to stop Apache with
      ...Apache.../bin/httpd -k stop -f ...sipX.../etc/sipxpbx/httpd.conf
   when you are done testing, as the sipX startup script will
   start Apache itself.

----------------------------------------------------------------------

Here are the foreign RPMs I installed on the system to build sipXpbx.
At Pingtel, many of them are available on Doug's archive,
http://10.1.1.111:8080/rpms.

ls /usr/local/RPMS

ant-1.6.2-1jpp.noarch.rpm
ant-junit-1.6.2-1jpp.noarch.rpm
apr-0.9.5-0.2.i386.rpm
apr-util-0.9.5-0.1.i386.rpm
autoconf-2.59-3.noarch.rpm
automake-1.9.1-1.noarch.rpm
expat-1.95.7-1.1.i386.rpm
expat-devel-1.95.7-1.i386.rpm
j2sdk-1_4_2_05-linux-i586-rpm.bin
j2sdk-1_4_2_05-linux-i586.rpm
jboss2.4.10-tomcat4.0.6-1-sipx.noarch.rpm
jpackage-utils-1.5.38-1jpp.noarch.rpm
junit-3.8.1-1.i386.rpm
junit-3.8.1-3jpp.noarch.rpm
libgcj-3.2.3-34.i386.rpm
libgcj-devel-3.2.3-34.i386.rpm
neon-0.24.7-1.i386.rpm
pcre-3.9-10.i386.rpm
pcre-4.5-2.i386.rpm
pcre-4.5-2.src.rpm
pcre-devel-3.9-10.i386.rpm
pcre-devel-4.5-2.i386.rpm
subversion-1.0.5-1.rh90.i386.rpm
w3c-libwww-5.4.0-4.src.rpm
xml-commons-1.0-0.b2.6jpp.noarch.rpm
xml-commons-apis-1.0-0.b2.6jpp.noarch.rpm
xml-commons-resolver-1.1-1jpp.noarch.rpm

Here are the foreign tarballs I installed on the system to build sipXpbx:

cgicc-3.2.3
cppunit-1.10.2
glib-2.2.1
httpd-2.0.50
mod_cplusplus
w3c-libwww-5.4.0
xerces-c-src_2_5_0
