Integrating Jabber IM with sipX

From SIPfoundry sipx, The Open Source SIP PBX for Linux - Calivia

Jump to: navigation, search

This page is about integrating jabberd2 with sipXpbx.

The really nice thing about this would be an XMPP integration where Jabber accounts would be maintained by sipXconfig. This would allow for sipXpbx-users having the same account alias for sip: and xmpp: addresses.

Contents

[edit] Install jabberd2

[edit] Gentoo

On gentoo, this is done with

emerge -av jabberd

If you have postgres in your USE flags in /etc/make.conf, support for PostgreSQL will be built. That way you can use the same database for both sipXconfig and jabberd2.

[edit] Fedora

The Fedora RPM comes with mySQL support only. You can either enable PostgreSQL support in the src.rpm and re-build or simply install mySQL. I will put a modified .spec file for PostreSQL support with jabberd2 here.

jabberd-2.0s10 source RPM for FC4

Build dependencies:

yum install db4-devel libidn-devel mysql-devel openldap-devel pam-devel

[edit] Integration with sipXpbx

This is the crude script to create the config files and start the service.

File: /usr/sipx/bin/jabberd.sh
#!/bin/bash
#
# Copyright (C) 2004 SIPfoundry Inc.
# Licensed by SIPfoundry under the LGPL license.
#
# Copyright (C) 2004 Pingtel Corp.
# Licensed to SIPfoundry under a Contributor Agreement.

Action=RUN
Status=0
Args=""

while [ $# -ne 0 ]
do
    case ${1} in
        --configtest)
            Action=CONFIGTEST
            ;;

        *)
            Args="$Args $1"
            ;;
    esac

    shift # always consume 1
done

CONFIG_DEFS="/etc/sipxpbx/config.defs"

CONFIG_FILES="\
  /etc/jabberd/s2s.xml \
  /etc/jabberd/c2s.xml \
  "

# If the "config.defs" file exists and the <name>.in file exists for a
# configuration file, then run the config preprocessor to generate the
# fully resolved configuration file.
if [ -f "$CONFIG_DEFS" ]
then
  for i in $CONFIG_FILES ; do
    if [ -f "${i}.in" ]
    then
       /usr/sipx/bin/configpp --defs "${CONFIG_DEFS}" --in "${i}.in"
--out "$i"
    fi
  done
fi

case ${Action} in
   RUN)
     echo $$ > /var/run/sipxpbx/jabberd.pid
     exec /usr/bin/jabberd &
     ;;

   CONFIGTEST)
     echo ""
     ;;
esac

exit $Status

[edit] Integrating in sipX 3.6 or newer

Image:Ver3.6.png Many of the steps for editing ProcessDefinitions.xml WatchDog.xml and /etc/init.d/sipxpbx are not neccessary in 3.6. See Integrating a new service into sipX for more details

[edit] Integrating in sipX 3.4

Image:Ver3.4.png

The new service needs to be added to the list of services controlled by the sipXpx initscript. add 'jabberd' to

File: /etc/init.d/sipxpbx
     71 sipxchange_processes=(
     72     watchdog
     73     sipproxy
     74     sipxconfig
     75     sipXvxml
     76     sipxpark
     77     sipxpresence
     78     sipstatus
     79     sipregistrar
     80     sipauthproxy
     81     jabberd
     82     keepalive
     83 )


File: /etc/sipxpbx/ProcessDefinitions.xml
        <process name="Jabber">
            <dependentdelay wait="0" />
            <stdout file="/dev/null" />
            <stderr file="/dev/null" />
            <stdin  file="" />

            <start control="true">
                <execute command="/usr/sipx/bin/jabberd.sh"
                         parameters=""
                         defaultdir="/var/log/sipxpbx" />
            </start>

            <!-- If no execute, then kill -->
            <stop control="true" />

            <!-- If no execute, then stop-start -->
            <restart control="true" />

            <!-- <dependency>??</dependency> -->
        </process>
File: /etc/sipxpbx/Watchdog.xml

Jabber gets installed to run as user jabber by default. Because the sipxpbx initscripts will want to run the service as user sipxpbx we need to adapt the ownership and permissions accordingly.

This is - again - very crude.

Code: Change permissions
chgrp sipxpbx /usr/bin/resolver \
              /usr/bin/router \
              /usr/bin/s2s \
              /usr/bin/sm \
              /usr/bin/c2s \
              /usr/bin/jabberd

chown -R sipxpbx /etc/jabberd

[edit] Configuring Jabberd2

The sipXpbx mechanism of config file pre-processing can be used for the jabberd2 config files by providing an appropriate .in config file.

File: /etc/jabberd/c2s.xml.in

File:

[edit] Jabberd2 and SSL/TLS

Jabberd2 needs the certificate and key as one PEM file. You can create this file from your existing sipXpbx key and certificate.

cat /etc/sipxpbx/ssl/ssl.crt > /etc/jabberd/server.pem && \
 cat /etc/sipxpbx/ssl/ssl.key >> /etc/jabberd/server.pem

Then uncomment the SSL-related options in /etc/jabberd/c2s.xml

[edit] Configuring DNS

File: BIND zone file

Port 5222 is the IANA-attributed port for Jabber (5223 for old-style SSL). Preferred method for doing encryption is by using STARTTLS over port 5222.

Port 5269 is used for server-to-server communications if you install other transports (Yahoo, MSN, ICQ, etc).

_xmpp-server._tcp       IN      SRV     5       0       5269    sipxpbx
_xmpp-client._tcp       IN      SRV     5       0       5222    sipxpbx
_jabber._tcp            IN      SRV     5       0       5269    sipxpbx

Personal tools