XMPP module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”This modules is a gateway between OpenSIPS and a jabber server. It enables the exchange of instant messages between SIP clients and XMPP(jabber) clients.
The gateway has two modes to run:
- the component-mode - the gateway requires a standalone XMPP server amd the ‘xmpp’ module acts as a XMPP component
- the server-mode - the module acts itself as a XMPP server, no requirement for another XMPP server in the system. NOTE: this is limited implementation of a XMPP server, it does not support SRV or TLS so far. This mode is in beta stage for the moment.
In the component mode, you need a local XMPP server (recommended Jabberd2); the xmpp module will relay all your connections to a tcp connection to the local jabber server. The documentation and the source for a Jabber server are located at the following link: http://jabberd.jabberstudio.org/2/#download
After you have a running XMPP server, what you need to do is set the following parameters in the OpenSIPS configuration file:
- gateway_domain, xmpp_domain (which can be the same as gateway_domain) and xmpp_host, which are explained in the Exported Parameters section;
- listen = your ip;
- alias=opensips domain and alias=gateway domain;
- in the following section of the configuration file, change to your gateway domain:
- you can also change the jabber server password, which must be the same as the xmpp_password parameter.
A use case, for the component-mode, would look like this:
- OpenSIPS is running on sip-server.opensips.org;
- the gateway is running on sip-xmpp.opensips.org;
- the jabber server is running on xmpp.opensips.org;
- the component is running on xmpp-sip.opensips.org.
In the server mode, the xmpp module is a minimal jabber server, thus you do not need to install another jabber server, the gateway will connect to the jabber servers, where the users you want to chat with have an account.
If you want to change to server-mode, you have to change the “backend” parameter, as shown in the Exported Parameters section, from component to server.
A use case, for the server-mode, would look like this:
- OpenSIPS is running on sip-server.opensips.org;
- the gateway is running on sip-xmpp.opensips.org;
- the “XMPP server” is running on xmpp-sip.opensips.org.
In both cases, the destination address must have the same pattern:
“sip:username
From a jabber client’s point of view, the destination will look like:
“sip_username
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”The following modules must be loaded before this module:
- requires ‘tm’ module.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- libexpat1-devel - used for parsing/building XML.
Exported Parameters
Section titled “Exported Parameters”backend(string)
Section titled “backend(string)”The mode you are using the module; it can be either component or server.
Default value is “component”.
... modparam("xmpp", "backend", "server")...domain_separator (string)
Section titled “domain_separator (string)”In the destination address we need an extra character as a domain separator, apart from @. The address of the XMPP(jabber) client looks like this: “sip:username<domain_separator>jabber_server@gateway_domain”. The address of a SIP client has the following pattern : “sip_username<domain_separator>opensips_domain@xmpp_domain”;
Default value is "".*
... modparam("xmpp", "domain_separator", "*")...gateway_domain (string)
Section titled “gateway_domain (string)”The domain of the gateway, which must resolve. It must be the same with the gateway_domain from the destination address of the
XMPP(jabber) client, as seen by the SIP client:
“sip:username
Default value is “sip-xmpp.example.org”.
... modparam("xmpp", "gateway_domain", "sip-xmpp.opensips.org")...xmpp_domain (string)
Section titled “xmpp_domain (string)”The xmpp domain of the component or the server, depending on the mode we are in. It can be the same as the gateway_domain.
Default value is “sip-xmpp.example.org”.
... modparam("xmpp", "xmpp_domain", "xmpp-sip.opensips.org")...xmpp_host (string)
Section titled “xmpp_host (string)”The ip address or the name of the local jabber server, if the backend is set to “component”; or the address to bind to in the server mode.
Default value is “xmpp.example.org”.
... modparam("xmpp", "xmpp_host", "xmpp.opensips.org")...xmpp_port (integer)
Section titled “xmpp_port (integer)”In the component mode, this is the port of the jabber router we connect to. In the server mode, it is the transport address to bind to.
Default value is “5347”, if backend is set to “component” and “5269”, if backend is set to “server”.
... modparam("xmpp", "xmpp_port", "5269")...xmpp_password (string)
Section titled “xmpp_password (string)”The password of the local jabber server.
Default value is “secret”; if changed here, it must also be changed in the c2s.xml, added by the jabber server. This is how the default configuration for the jabberd2 looks like:
<router> ............... <!-- Username/password to authenticate as --> <user>jabberd</user>; <!-- default: jabberd -->; <pass>secret</pass>; <!-- default: secret -->;... modparam("xmpp", "xmpp_password", "secret")...outbound_proxy (string)
Section titled “outbound_proxy (string)”The SIP address used as next hop when sending the message. Very useful when using OpenSIPS with a domain name not in DNS, or when using a separate OpenSIPS instance for xmpp processing. If not set, the message will be sent to the address in destination URI.
Default value is NULL.
... modparam("xmpp", "outbound_proxy", "sip:opensips.org;transport=tcp")...Exported Functions
Section titled “Exported Functions”xmpp_send_message()
Section titled “xmpp_send_message()”Converts SIP messages to XMPP(jabber) messages, in order to be relayed to a XMPP(jabber) client.
...xmpp_send_message();...Samples
Section titled “Samples”OpenSIPS Config Script - XMPP Usage
Section titled “OpenSIPS Config Script - XMPP Usage”Next is presented a sample configuration file one can use to implement a standalone SIP-to-XMPP gateway. You can run an instance of OpenSIPS on a separate machine or on different port with the following config, and have the main SIP server configured to forward all SIP requests for XMPP world to it.
## $Id$## simple quick-start config script for XMPP GW## make sure in your main SIP server that you send# only the adequate SIP MESSAGES to XMPP GW### ----------- global configuration parameters ------------------------
debug=9 # debug level (cmd line: -dddddddddd)fork=nolog_stderror=yes # (cmd line: -E)
/* Uncomment these lines to enter debugging modefork=nolog_stderror=yes*/
check_via=no # (cmd. line: -v)dns=no # (cmd. line: -r)rev_dns=no # (cmd. line: -R)children=4
listen=udp:10.10.10.10:5076alias=sip-xmpp.opensips.org
# ------------------ module loading ----------------------------------
mpath="/usr/local/opensips-1.1.0-xmpp/lib/opensips/modules/"loadmodule "sl.so"loadmodule "tm.so"loadmodule "rr.so"loadmodule "maxfwd.so"loadmodule "textops.so"loadmodule "mi_fifo.so"
# XMPPloadmodule "xmpp.so"
modparam("xmpp", "domain_separator", "*")modparam("xmpp", "gateway_domain", "sip-xmpp.opensips.org")modparam("xmpp", "xmpp_domain", "xmpp-sip.opensips.org")modparam("xmpp", "xmpp_host", "xmpp.opensips.org")
modparam("xmpp", "backend", "server")# modparam("xmpp", "backend", "component")
# ----------------- setting module-specific parameters ---------------
# -- mi_fifo params --
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo_xmpp")
# -- usrloc params --
# -- rr params --# add value to ;lr param to make some broken UAs happymodparam("rr", "enable_full_lr", 1)
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; };
if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); exit; };
### absorb retransmissions ### if (!t_newtran()) { sl_reply_error(); return; } if (method == "MESSAGE") { log("*** xmpp-handled MESSAGE message.\n"); if (xmpp_send_message()) { t_reply("200", "Accepted"); } else { t_reply("404", "Not found"); } return; }
log("*** xmpp: unhandled message type\n"); t_reply("503", "Service unavailable"); return;}Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Daniel-Constantin Mierla (@miconda) | 69 | 16 | 5988 | 76 |
| 2. | Bogdan-Andrei Iancu (@bogdan-iancu) | 18 | 13 | 110 | 217 |
| 3. | Stefan Darius (@dariusstefan) | 9 | 4 | 434 | 48 |
| 4. | Anca Vamanu | 6 | 2 | 132 | 96 |
| 5. | Henning Westerholt (@henningw) | 5 | 3 | 13 | 13 |
| 6. | Razvan Crainea (@razvancrainea) | 3 | 1 | 2 | 2 |
| 7. | Konstantin Bokarius | 3 | 1 | 2 | 5 |
| 8. | Juha Heinanen (@juha-h) | 3 | 1 | 1 | 1 |
| 9. | Edson Gellert Schubert | 3 | 1 | 0 | 103 |
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Jun 2026 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Oct 2006 - Oct 2008 |
| 4. | Henning Westerholt (@henningw) | Aug 2007 - Jul 2008 |
| 5. | Daniel-Constantin Mierla (@miconda) | Sep 2006 - Mar 2008 |
| 6. | Konstantin Bokarius | Mar 2008 - Mar 2008 |
| 7. | Edson Gellert Schubert | Feb 2008 - Feb 2008 |
| 8. | Anca Vamanu | Oct 2007 - Dec 2007 |
| 9. | Juha Heinanen (@juha-h) | Oct 2006 - Oct 2006 |
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Henning Westerholt (@henningw), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Anca Vamanu, Juha Heinanen (@juha-h).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0