Richard Hall | 5 May 16:16 2015

Custom Erlang Authentication Module, and Client IP Address


I am currently writing an auth module (ejabberd_auth_…), and am having an issue. While running the auth
module is running fine, I need to access the client’s IP address that they are connecting to the Ejabberd
server with. Is there an easy way to do this from the auth module?

ejabberd mailing list
ejabberd <at>
Santiago Ignacio Poli | 30 Apr 15:09 2015

Can someone tell me what am I doing wrong?

Recently I've been trying to implement my own IQ Handlers in ejabberd. I've been using the hook mechanism for some time now but I think IQ Handlers are more suitable for the features I need to implement.

I've made a simple IQ handler to learn how to do this and encountered a problem: Every time I send my custom IQ from my client, ejabberd throws this exception (and don't return anything to the client):

09:59:28.135 [error] gen_fsm <0.574.0> in state session_established terminated with reason: bad argument in call to xml:element_to_binary({xmlel,<<"iq">>,[{<<"from">>,<<"localhost">>},{<<"to">>,<<"1 <at> localhost/11909950391430398765210138">>},...],...}) in ejabberd_c2s:send_element/2 line 1908
09:59:28.136 [error] CRASH REPORT Process <0.574.0> with 0 neighbours exited with reason: bad argument in call to xml:element_to_binary({xmlel,<<"iq">>,[{<<"from">>,<<"localhost">>},{<<"to">>,<<"1 <at> localhost/11909950391430398765210138">>},...],...}) in ejabberd_c2s:send_element/2 line 1908
09:59:28.136 [error] Supervisor ejabberd_c2s_sup had child undefined started with {ejabberd_c2s,start_link,undefined} at <0.574.0> exit with reason bad argument in call to xml:element_to_binary({xmlel,<<"iq">>,[{<<"from">>,<<"localhost">>},{<<"to">>,<<"1 <at> localhost/11909950391430398765210138">>},...],...}) in ejabberd_c2s:send_element/2 line 1908 in context child_terminated

The code inside the handler is called correctly (I echoed things to test that) but the problem is when the function tries to return the response.

Here's my code:




-define(IQ_CUSTOM, <<"test:iq:custom">>).

start(Host, _) ->
error_logger:error_msg("Started mod_block"),
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?IQ_CUSTOM, ?MODULE, process_local_iq, one_queue),

stop(Host) ->
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?IQ_CUSTOM),

process_local_iq(From,_ ,IQ) ->
User = From#jid.luser,
error_logger:error_msg("User: ~s", [User]),
IQ#iq{type = result,
sub_el =
name = <<"query">>,
attrs = [{<<"xmlns">>, ?IQ_CUSTOM}, {<<"test">>,1}],
children = []
The problem occurs when I send stanzas like this:
<iq id="test1" to="localhost" type="get"><query xmlns="test:iq:custom"/></iq>

Thanks in advance!
ejabberd mailing list
ejabberd <at>
Gaurav Jain | 27 Apr 18:43 2015

gen_server terminated with reason: bad return value:

I have code - this was the last function that was executed.

process_packet(From, To, Packet) ->

    #jid{luser = LUser, lserver = LServer} = To,

    gen_mod:get_module_proc(To#jid.lserver, ?PROCNAME) !

            #offline_msg{us = {LUser, LServer},

                       from = From, to = To, packet = Packet},


I get this error:

2015-04-27 01:27:26.012 [error] <0.384.0> gen_server 'offline_test' terminated with reason: bad return value: {offline_msg,{<<"abcdef">>,<<"">>},{jid,<<"ghijklm">>,<<"">>,<<"phone">>,<<"ghijklm">>,<<"">>,<<"phone">>},{jid,<<"abcdef">>,<<"">>,<<>>,<<"abcdef">>,<<"">>,<<>>},{xmlel,<<"message">>,[{<<"type">>,<<"chat">>},{<<"to">>,<<"abcdef <at>">>}],[{xmlel,<<"body">>,[],[{xmlcdata,<<"Update: Some">>}]},{xmlel,<<"thread">>,[],[]},{xmlel,<<"subject">>,[],[{xmlcdata,<<"someData">>}]},...]}}


%% gen_server callbacks


init([Host, Opts]) ->


        ejabberd_hooks:add(offline_message_hook, Host, ?MODULE, process_packet, 49),

        {ok, #state{host = Host}}.

handle_call(stop, _From, State) ->

    {stop, normal, ok, State}.

handle_cast(_Msg, State) -> {noreply, State}.

handle_info(#offline_msg{us = _UserServer,

                from = From, to = To, packet = Packet} = _Msg, State) ->

    CustomStatus = read_custom_status(From#jid.user, To#jid.user),

    if CustomStatus == <<"available">> ->

                process_offline_packet(From, To, Packet);

       true -> ok


    {noreply, State};

handle_info(_Info, State) ->

    {noreply, State}.

terminate(_Reason, State) ->

    Host =,

    ejabberd_hooks:delete(offline_message_hook, Host, ?MODULE, process_packet, 49),


Would you be able to tell the issue?

Best Regards,

ejabberd mailing list
ejabberd <at>
Isaac Chivende | 26 Apr 00:02 2015

how do i intergrated ejabberd with my web app

i am trying to intergrate my web app with ejabberd. i dnt knw
where to start from. i have downloaded and install ejabberd on my
machine. i tried to look for online help but am not getting any
meaningfull help. please help
Jérôme Sautret | 24 Apr 16:18 2015

[ANN] ejabberd Community 15.04


ejabberd 15.04 keeps the project delivering new features and
improvements at the same fast pace.

The focus for this release is to consolidate and improve what was
delivered in the previous release, and also to integrate contributions
which has been critical for most deployment these days.

## New features

We integrated useful contributions around groupchat (mod_admin_extra
and mod_muc_admin) into ejabberd core. This means ejabberd admins get
a new set of powerful ejabberdctl command and API they can rely on
with standard ejabberd deployments.

We also made XEP-0033 Extended Stanza Addressing a default component.
This is extremely useful to build chat service that use adhoc chat
mechanisms. It brings to ejabberd the ability to send messages to
multiple recipients at once without using Multi User chat or PubSub.
You can see it a bit like email cc or bcc features. This allows to
build extremely simple and lightweight multi party chat features.

Among new features, we now have a SQLite backend that can replace
Mnesia for those who prefer a basic backend for small and simple
standalone deployments.

## Improvements

We've improved a lot of modules, added some major PubSub improvements,
better RFC compliance, many bug fixes and small tweaks all over the
place thanks to your feedback. The cluster script helpers have been
improved to work in more situations.

## Elixir

We are still pushing Elixir integration further: this new version of
ejabberd can be embedded in any Elixir application, for example in a
Phoenix Web application. Here is a tutorial showing how it works:

## PubSub

PubSub improvements include code refactor, bug fixes, minor
optimizations and removal of old mod_pubsub_odbc. mod_pubsub now uses
db_type parameter like all other ejabberd modules.
NOTE: Users of old mod_pubsub_odbc will need to alter pubsub_node
table changing the type attribute: set flat when it was flat_odbc,
hometree when it was hometree_odbc, and pep when it was pep_odbc.
Without this manual change in your database, the new mod_pubsub will
not work.

## Changelog overview

- R16B03-1 is now the minimal required Erlang/OTP version
- SQLite support
- Default db_type can be specified with global default_db option
- Included mod_muc_admin, mod_admin_extra and mod_multicast modules
- Removed ejabberd_http_poll
- PubSub improvements
- Better RFC compliance
- Several other bugfixes

ProcessOne installer now includes Erlang/OTP 17.5, with added new
configuration option in ejabberd: sqlite, redis and elixir support.
The Linux 32bit installer is no longer maintained.

## Feedback

As usual, the release is tagged in the Git source code repository on Github:

The source package and binary installers are available at ProcessOne:

If you suspect you found a bug, please search or fill a bug report on Github:
Santiago Ignacio Poli | 23 Apr 19:45 2015

Self-Contained ejabberd


I would like to know if there is a way to build a self-contained ejabberd installation (a single Linux executable containing an Erlang distribution and the ejabberd server itself).

If that's not a possibility, what is the recommended way of deploying ejabberd in production? I want to use a continuous integration server like bamboo to handle our builds.

Thanks in advance,

Santiago Ignacio Poli
Java Developer  <at> etermax

ejabberd mailing list
ejabberd <at>
ricky gutierrez | 21 Apr 17:11 2015


Hi list, I wanted to ask if anyone on the list has ejabberd monitoring
with nagios?, if you have some specific plugin for this task?


Uday Sawant | 14 Apr 18:31 2015

How to change node name on Clustered node


How can I change node name on clustered node. I tried steps mentioned in ejabberd docs Change Computer Hostname. At step 6 it logs something like following

 * Checking table: 'local_config'
   + Checking key: 'ram_copies'
     - Node: ''ejabberd <at> second' will not be modified (it is not ''ejabberd <at> first')
     - Replacing nodename: ''ejabberd <at> first'' with: ''ejabberd <at>''
   + Checking key: 'disc_copies'
   + Checking key: 'disc_only_copies'

After this I am not able to load fallback (Error: short names not allowed).

Also, Is it possible to copy data between short name node and long name node without any downtime?

ejabberd mailing list
ejabberd <at>
Tobias Kräntzer | 13 Apr 22:03 2015

Berlin XMPP Meetup #2

I'm happy to announce the second Berlin XMPP Meetup.

This time we will focus on ejabberd:

- Holger Weiß will dive us into ejabberd development, and
- I will share my experience with writing modules in Elixir (still figuring it out).

The meetup will take place at the Mozilla Berlin office on the 4th of May at 19:30h.
If you are planning to come, please register yourself so that we can better plan.

More details at:


Tobias Kräntzer
Grünberger Straße 40 | 10245 Berlin

xmpp:info <at>
Twitter:  <at> anagrom_ataf

ejabberd mailing list
ejabberd <at>
Uday Sawant | 11 Apr 14:06 2015

Clustering Ejabberd across data centres


Is it ok to create a cluster with two nodes located at two different data centres/regions?
Can you recommend any alternate setup options. 

I am planning this setup for high availability, Scaling is not an issue for now.
ejabberd mailing list
ejabberd <at>
Mickaël Rémond | 9 Apr 16:34 2015

ejabberd Paris meetup next wednesday


Next ejabberd Paris Meetup will take place next week on april 15th.

In the meantime, you can check the slides from ejabberd San Francisco Meetup: 


Mickaël Rémond
ejabberd mailing list
ejabberd <at>