blt909
blt909

Reputation: 102

Cannot list muc rooms from ejabberd

I'm stucked with an error on my ejabberd server. It seems that ejabberd want to list from conference.localhost and not from my real host conference.xmpp.mydomain.com.

2016-04-14 11:03:49.167 [info] <0.982.0>@ejabberd_s2s:new_connection:406 New s2s connection started <0.992.0>
2016-04-14 11:03:49.168 [info] <0.992.0>@ejabberd_s2s_out:log_s2s_out:1253 Trying to open s2s connection: xmpp.mydomain.com -> conference.localhost with TLS=true
2016-04-14 11:03:49.183 [info] <0.992.0>@ejabberd_s2s_out:open_socket:246 s2s connection: xmpp.mydomain.com -> conference.localhost (remote server not found)
2016-04-14 11:03:51.939 [info] <0.992.0>@ejabberd_s2s_out:handle_info:940 Reconnect delay expired: Will now retry to connect to conference.localhost when needed.

Here is my ejabberd.yml [EDITED]:

websocket_ping_interval: 60
websocket_timeout: 86400

loglevel: 4
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1

hosts:
  - "xmpp.mydomain.com"

listen: 
  - 
    port: 5222
    module: ejabberd_c2s
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
  - 
    port: 5269
    module: ejabberd_s2s_in

  -
    port: 5280
    ip: "::"
    module: ejabberd_http
    hosts:
      - "xmpp.mydomain.com"
    request_handlers:
      "/websocket": ejabberd_http_ws
    web_admin: true
    http_bind: true
  -
    port: 5285
    module: ejabberd_http
    hosts:
      - "xmpp.mydomain.com"
    request_handlers:
       "/rest": mod_rest

s2s_use_starttls: optional
s2s_certfile: "/etc/ejabberd/ejabberd.pem"

##
## MySQL server:
##
odbc_type: mysql
odbc_server: "localhost"
odbc_database: "ejabberd"
odbc_username: "ejabberd"
odbc_password: "pwd"

shaper:
  normal: 1000
  fast: 50000

max_fsm_queue: 1000

###.   ====================
###'   ACCESS CONTROL LISTS
acl:    
  admin:
    user:
      - "admin": "xmpp.mydomain.com"
  local: 
    user_regexp: ""

  loopback:
    ip:
      - "127.0.0.0/8"

###.  ============
###'  ACCESS RULES
access:
  ## Maximum number of simultaneous sessions allowed for a single user:
  max_user_sessions: 
    all: 10
  ## Maximum number of offline messages that users can have:
  max_user_offline_messages: 
    admin: 5000
    all: 100
  ## This rule allows access only for local users:
  local: 
    local: allow
  ## Only non-blocked users can use c2s connections:
  c2s: 
    blocked: deny
    all: allow
  ## For C2S connections, all users except admins use the "normal" shaper
  c2s_shaper: 
    admin: none
    all: normal
  ## All S2S connections use the "fast" shaper
  s2s_shaper: 
    all: fast
  ## Only admins can send announcement messages:
  announce: 
    admin: allow
  ## Only admins can use the configuration interface:
  configure: 
    admin: allow
  ## Admins of this server are also admins of the MUC service:
  muc_admin: 
    admin: allow
  ## Only accounts of the local ejabberd server can create rooms:
  muc_create: 
    local: allow
  ## All users are allowed to use the MUC service:
  muc: 
    all: allow
  ## Only accounts on the local ejabberd server can create Pubsub nodes:
  pubsub_createnode: 
    local: allow
  ## In-band registration allows registration of any possible username.
  ## To disable in-band registration, replace 'allow' with 'deny'.
  register: 
    all: allow
  ## Only allow to register from localhost
  trusted_network: 
    loopback: allow

language: "en"

###.  =======
###'  MODULES

modules: 
  mod_adhoc: {}
  mod_admin_extra: {}
  mod_announce: # recommends mod_adhoc
    access: announce
  mod_blocking: {} # requires mod_privacy
  mod_caps: {}
  mod_carboncopy: {}
  mod_client_state:
    drop_chat_states: true
    queue_presence: false
  mod_configure: {} # requires mod_adhoc
  mod_disco: {}
  ## mod_echo: {}
  mod_irc: {}
  mod_http_bind: {}
  ## mod_http_fileserver:
  ##   docroot: "/var/www"
  ##   accesslog: "/var/log/ejabberd/access.log"
  mod_last: 
    iqdisc: one_queue
    db_type: odbc
  mod_mam:
    iqdisc: one_queue
    db_type: odbc
    default: always
  mod_muc: 
    ## host: "conference.@HOST@"
    access: muc
    access_create: muc_create
    access_persistent: mud_create
    access_admin: muc_admin
    db_type: odbc
    default_room_options:
        mam: true
        public: false
        public_list: false
        allow_change_subj: false
        allow_user_invites: false
        members_only: false
        members_by_default: false
        anonymous: false
        allow_private_messages: true
        persistent: true
  mod_muc_admin: {}
  ## mod_muc_log: {}
  ## mod_multicast: {}
  mod_offline:
    db_type: odbc 
    access_max_user_messages: max_user_offline_messages
  mod_ping: {}
  ## mod_pres_counter:
  ##   count: 5
  ##   interval: 60
  mod_privacy: {}
  mod_private: {}
  ## mod_proxy65: {}
  mod_rest:
    allowed_ips: all
  mod_pubsub: 
    access_createnode: pubsub_createnode
    ## reduces resource comsumption, but XEP incompliant
    ignore_pep_from_offline: true
    ## XEP compliant, but increases resource comsumption
    ## ignore_pep_from_offline: false
    last_item_cache: false
    plugins: 
      - "flat"
      - "hometree"
      - "pep" # pep requires mod_caps
  mod_register: 
    welcome_message: 
      subject: "Welcome!"
      body: |-
        Hi.
        Welcome to this XMPP server.

    access: register
  mod_roster: {}
  mod_shared_roster: {}
  mod_stats: {}
  mod_time: {}
  mod_vcard: {}
  mod_version: {}

I used the same configuration on a other machine with no errors. I don't understand what I'm missing here

Thanx for your help

[EDIT] 18/04/2016 : 1/ client :

<iq from='[email protected]/null' to='xmpp.mydomain.com' type='get' xmlns='jabber:client' id='2:sendIQ'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq> 

2/ server :

<iq xmlns='jabber:client' from='xmpp.mydomain.com' to='[email protected]/null' id='2:sendIQ' type='result'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='conference.xmpp.mydomain.com'/>
<item jid='echo.xmpp.mydomain.com'/>
<item jid='irc.xmpp.mydomain.com'/>
<item jid='pubsub.xmpp.mydomain.com'/>
</query>
</iq> 

3/ client :

<iq to='conference.xmpp.mydomain.com' from='[email protected]/null' type='get' xmlns='jabber:client' id='78:sendIQ'>
<query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>

4/ server :

<iq xmlns='jabber:client' from='conference.xmpp.mydomain.com' to='[email protected]/null' id='78:sendIQ' type='result'>
<query xmlns='http://jabber.org/protocol/disco#items'>
<item jid='conference.localhost' node='emptyrooms' name='Empty Rooms'/>
</query>
</iq>

Upvotes: 0

Views: 1478

Answers (1)

Karol Danutama
Karol Danutama

Reputation: 46

We just encountered the same issue a few days ago. We dig down to Ejabberd code. Refer to mod_muc around line 614. We found out:

  1. iq_disco_items(Host, From, Lang, <<>>, none) checks whether the available rooms in given host exceeds MAX_ROOMS_DISCOITEMS or not, which is set to 100.
  2. Following the case statement, it will further call iq_disco_items(Host, From, Lang, <<"nonemptyrooms">>, none)

    XmlEmpty = #xmlel{name = <<"item">>, attrs = [{<<"jid">>, <<"conference.localhost">>}, {<<"node">>, <<"emptyrooms">>}, {<<"name">>, translate:translate(Lang, <<"Empty Rooms">>)}], children = []}

That's where <item jid='conference.localhost' node='emptyrooms' name='Empty Rooms'/> comes from.

Solution

We decided to send disco query with RSM. It will be pattern-matched with iq_disco_items(Host, From, Lang, _DiscoNode, Rsm). Hope it helps.

Upvotes: 3

Related Questions