mod_dingaling
About
mod_dingaling is a generic xmpp registration that can be used for Google talk or any other XMPP integration.
More information about Jingle can be found here: Wikipedia Jingle Protocol
As of 2022.08.29 mod_dingaling was removed from FreeSWITCH tree and placed in https://github.com/freeswitch
It has been announced that Google Voice over xmpp service, which is a dependency of several of the below examples, will be discontinued on May 15th, 2014. Keep that in mind when planning any deployments using GV.
Getting it working
OpenSSL
OpenSSL is required to ensure that your XMPP stanzas are encrypted as required by the specifications. Before running, make sure you have the ssl package installed.
CentOS 5.x
yum install openssl-devel
Ubuntu 10.x / Debian
sudo apt-get install libssl-dev
Build Module
Make sure the following line is present and uncommented in /usr/src/freeswitch/modules.conf
endpoints/mod_dingaling
Then build and install mod_dingaling:
make mod_dingaling-install
For freeBSD, use gmake.
If you have installed SSL after building the dingaling module, you will need to re-bootstrap, re-configure and re-build freeswitch.
Run 'fs_cli'.
load mod_dingaling
Windows using MSVC 2008
- Since October 17,2011 this is no longer needed now OpenSSL is used. Mod_dingaling will now build with ssl out of the box.
- Install GnuTls for windows. Take gnutls-2.9.9.exe, maybe more recent will work.
- Build libgnutls-26.lib. This file will be used as a import library for Visual Studio projects. Open visual studio command prompt (not your normal console) and type in GnuTls bin folder:
lib /def:libgnutls-26.def
- Configure ixemel library to work with TLS library. Example
- Add additional include directory.
- Add additional dependency
- If you have problems with the iksemel compilation process try:
- for "syntax error: type" because of va_arg: include <starg.h> in config.h
- for ENOENT errors: include <errno.h> - now found that the reason was config.h in libs/win32/iksemel was not included - to be checked
- for ssize_t errors: add typedef long ssize_t in gnutls.h
- If you have problems linking iksemel.lib because of strcasecmp errors, add the following in iksemel/utility.c
- #define strcasecmp(s1, s2) stricmp(s1, s2)
- #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
- Make sure the TLS dlls are copied to the configuration environment. For example, if you’re running on debug mode, you should have the following files in <your freeswitch root>/Debug:
- libgcrypt-11.dll
- libgnutls-26.dll
- libgnutls-extra-26.dll
- libgnutls-openssl-26.dll
- libgpg-error-0.dll
- libtasn1-3.dll
Enable Module
Uncomment the following in Modules.conf.xml.
<load module="mod_dingaling"/>
Sample Configuration (Google)
Settings similar to the following should work for A basic gtalk account:
<profile type="client">
<param name="name" value="gmail.com"/>
<param name="login" value="MyUserName@gmail.com/gtalk"/>
<param name="password" value="myPassWord"/>
<param name="server" value="talk.google.com"/>
<param name="dialplan" value="XML"/>
<param name="message" value="FreeSwitch (The Future of Telephony)"/> <!-- You must specify a message for the profile to be valid -->
<param name="rtp-ip" value="auto"/>
<!-- if you are behind NAT, you should probably use STUN -->
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="auto-login" value="true"/>
<param name="auto-reply" value="Press *Call* to join my conference"/>
<param name="sasl" value="plain"/>
<param name="tls" value="true"/>
<param name="use-rtp-timer" value="true"/>
<param name="exten" value="1000"/> <!-- The extension you want a call in to connect to -->
</profile>
You may also want to enable debug mode in Dingaling.conf.xml. This will enable you to see XMPP messages.
Sample Configuration w/ Jingle & Video support (Google)
Settings similar to the following will enable Jingle support:
<profile type="client">
<param name="name" value="gmail.com"/>
<param name="login" value="MyUserName@gmail.com/gtalk"/>
<param name="password" value="myPassWord"/>
<param name="server" value="talk.google.com"/>
<param name="dialplan" value="XML"/>
<param name="message" value="FreeSwitch (The Future of Telephony)"/> <!-- You must specify a message for the profile to be valid -->
<param name="rtp-ip" value="auto"/>
<!-- if you are behind NAT, you should probably use STUN -->
<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
<param name="auto-login" value="true"/>
<param name="auto-reply" value="Press *Call* to join my conference"/>
<param name="sasl" value="plain"/>
<param name="tls" value="true"/>
<param name="use-jingle" value="true"/>
<param name="use-rtp-timer" value="true"/>
<param name="exten" value="1000"/> <!-- The extension you want a call in to connect to -->
</profile>
To enable Video support, edit dingaling.conf.xml as follows (video does NOT work with GVoice):
<configuration name="dingaling.conf" description="XMPP Jingle Endpoint">
<settings>
<param name="debug" value="1"/>
<param name="codec-prefs" value="H264,PCMU"/>
</settings>
<X-PRE-PROCESS cmd="include" data="../jingle_profiles/*.xml"/>
</configuration>
H264 codec is now enabled by default however it results in all outbound calls through Google Talk to fail immediately with a 'Fast Busy', removing it fixes issue. - Daniel Sokolowski 01:24, 13 January 2013 (EST)
Sample Configuration (Openfire)
- In Openfire:
-
- Navigate to Server -> Server Settings -> External Components Enable and set port + secret
-
- In freeswitch
- Make a copy of the included server.xml (in conf/jingle_profiles/) and configure the password and server parameters (tweak the others as applicable for your situation).
One "reloadxml" and "reload mod_dingaling" later and you should have a successful connection!
Sample Configuration (ejabberd)
<profile type="component">
<param name="name" value="xmpp.example.com"/>
<param name="password" value="123456"/>
<param name="dialplan" value="XML"/>
<param name="context" value="public"/>
<param name="rtp-ip" value="$${bind_server_ip}"/>
<param name="server" value="xmpp.example.com:5275"/>
<param name="use-rtp-timer" value="true"/>
<param name="exten" value="_auto_"/>
</profile>
Reference
Variables
mod_dingaling sets the following variables:
variable_dl_from_user: accessed as 'dl_from_user' using the getVariable API call
variable_dl_from_host: accessed as 'dl_from_host' using the getVariable API call
Lua Example:
freeswitch.consoleLog("info", "Receiving call from " .. session:getVariable('dl_from_user') .. " at the domain " .. session:getVariable('dl_from_host') .. "\n")