Unable to send messages to a MUC room - xmpp

When I try to send a message to an XMPP MUC Room such as:
<message to="room#conference.chat.example.com" type="groupchat">
<body>TEST</body>
</message>
The message will not be delivered to other participants in the room and I get this response from the server:
<message
xmlns="jabber:client" lang="en" to="karim#chat.example.com/resource" from="room#conference.chat.example.com" type="error">
<error code="503" type="cancel">
<service-unavailable
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
</service-unavailable>
<text
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">User session not found
</text>
</error>
<body>TEST</body>
Im using ejabberd Community Server v20.07 installed into Docker using the official image.
The full ejabberd.yml configuration file that Im using can be found here.
The full server log can be found here.
The above error happen with different clients and not only one.

You have configured this, and this is completely wrong:
hosts:
- chat.example.com
- conference.chat.example.com
modules:
mod_muc:
...
I guess you didn't notice the option HOSTS in the MOD_MUC documentation: https://docs.ejabberd.im/admin/configuration/modules/#mod-muc
Try something like this:
hosts:
- chat.example.com
modules:
mod_muc:
hosts:
- conference.#HOST#
...

Related

Localhost Service Discovery For a Custom XEP-0114 Component in Prosody or ejabberd

I have written a silly hello-world XEP-0114 component and got it connected to Prosody and ejabberd. Now I want to use service discovery to announce presence of the service and provide instructions about its usage.
So I seek a way to make it discoverable for anyone with a JID, remote or local, to provide more details about it.
For Prosody I do:
Component "foo.localhost"
component_secret = "secret"
disco_items = {
{ "foo.localhost", "FOO BAR" };
}
For ejabberd I do:
modules:
mod_disco:
extra_domains:
- "foo.localhost"
- "localhost"
server_info:
-
modules: all
name: "abuse-addresses"
urls:
- "foo.com"
listen:
-
port: 8888
module: ejabberd_service
access: all
shaper_rule: fast
ip: "127.0.0.1"
hosts:
"foo.localhost":
password: "secret"
Then in Gajim I start service discovery on localhost and get error:
There is no service at the address you entered, or it is not responding. Check the address and try again.
What do I miss?
First thing to check when in trouble is a XML-console of a xmpp-client (Gajim), there I found this:
<iq xmlns="jabber:client" to="localhost" type="get" id="546">
<query xmlns="http://jabber.org/protocol/disco#info" />
</iq>
<iq xml:lang='en' to='mynickhere#jabb.im/Gajim' from='localhost' type='error' id='546'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
<error code='504' type='wait'>
<remote-server-timeout xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Stream closed by peer: host-unknown</text>
</error>
</iq>
It shows that discovery requests are sent to the server where currently used account is located (jabb.im). I don't know how things work, but this should prompt you to disconnect from remote server, create account on local server and login with it instead, then discovery will work as expected.

How to enable MUC/Sub model in ejabberd 16.09?

I installed ejabberd 16.09. But, How to enable muc/sub model in ejabberd yml file? Is this feature available in ejabberd community addition?
I am sending stanza like
<iq from='sam#localhost'
to='test#conference.localhost'
type='get'
id='ik3vs715'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
but i am not getting responcse like
<feature var="urn:xmpp:mucsub:0" />
please reply
You should query room configuration and check "enable subscription" option

Outlook Autodiscover SMTP authentication

The problem
I am trying to create an autodiscover script for the users of my website. Currently I am creating a working connection to my mail-server, however my mail server requires SMTP authentication. I am currently sending:
<AuthRequired>on</AuthRequired>
in the full XML file to enable SMTP authentication. This enables the checkmark in the details next to "My outgoing server (SMTP) requires authentication". The bullet list with the two options "use same settings as my incoming mail server" (prefered) or "Log on using" has no option selected.
What I've tried
I have tried adding the POP3 information and putting the following attribute in my SMTP part:
<UsePOPAuth>on</UsePOPAuth>
However that did not work. To create the XML file I have used the following URL: https://technet.microsoft.com/en-us/library/cc511507.aspx
My current XML document
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
<Account>
<AccountType>email</AccountType>
<Action>settings</Action>
<Protocol>
<Type>IMAP</Type>
<Server>mail.test.nl</Server>
<Port>143</Port>
<DomainRequired>on</DomainRequired>
<LoginName>me#test.nl</LoginName>
<SPA>off</SPA>
<SSL>off</SSL>
<AuthRequired>on</AuthRequired>
</Protocol>
<Protocol>
<Type>SMTP</Type>
<Server>mail.test.nl</Server>
<Port>587</Port>
<DomainRequired>on</DomainRequired>
<LoginName>me#test.nl</LoginName>
<SPA>off</SPA>
<SSL>off</SSL>
<AuthRequired>on</AuthRequired>
<SMTPLast>on</SMTPLast>
</Protocol>
</Account>
</Response>
</Autodiscover>
I found a very useful article on TechNet which basically explains why this is happening. From what i understood, specifying the SMTPLast property makes Outlook attempt to login to POP/IMAP before SMTP, without actually authenticating SMTP (some servers such as my school's only work this way).
I reproduced the same problem you had with that config but once i removed it, it worked like a charm.
I noticed there isn't a lot of useful documentation about Autodiscover, aka POX autodiscover so here's the xml template that worked for me:
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
<User>
<DisplayName>First Last</DisplayName>
</User>
<Account>
<AccountType>email</AccountType>
<Action>settings</Action>
<Protocol>
<Type>IMAP</Type>
<Server>mail.example.com</Server>
<Port>993</Port>
<AuthRequired>on</AuthRequired>
<LoginName>email#example.com</LoginName>
<SPA>off</SPA>
<SSL>on</SSL>
</Protocol>
<Protocol>
<Type>SMTP</Type>
<Server>mail.example.com</Server>
<Port>587</Port>
<AuthRequired>on</AuthRequired>
<LoginName>email#example.com</LoginName>
<SPA>off</SPA>
<Encryption>TLS</Encryption>
<UsePOPAuth>on</UsePOPAuth>
</Protocol>
</Account>
</Response>
</Autodiscover>

ejabberd MUC Archive Management Query Response

I'm using ejabberd 15.09 and have enabled archive management for every MUC in the server configuration like below:
mod_mam:
default: always
mod_muc:
## host: "conference.#HOST#"
access: muc
access_create: muc_create
access_persistent: muc_create
access_admin: muc_admin
default_room_options:
mam: true
persistent: true
public: true
Also inspection on the admin panel for Ejabberd shows that messages are getting archived as the number of elements in archive table goes up after each message is sent to the MUC. This is verifying that archiving is enabled for the session.
To query the server for message archive from MUC, I am sending this iq packet:
<iq type='set' id='testid1'>
<query xmlns='urn:xmpp:mam:1'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>urn:xmpp:mam:1</value>
</field>
<field var='with'>
<value>testmyroomnow#conference.ip/</value>
</field>
</x>
</query>
</iq>
Response received from the server doesn't contain any messages.
<message from='user#ip' to='user#ip/Gajim'>
<fin xmlns='urn:xmpp:mam:0' complete='true'>
<set xmlns='http://jabber.org/protocol/rsm'>
<count>0</count>
</set>
</fin>
</message>
This MUC already contains some messages but querying like above is not returning any message. It seems that the format of xml stanza is not correct. Either the format for sending JID for conference is not correct or something else.
Not sure what to do as I'm already using the latest version of Ejabberd which is showing to support archive of MUC. Other that what I'm doing here, I have no idea how to query a MUC archive from ejabberd server.
You need to query the MUC service for MUC archive. The user MAM service only stores message for one-to-one conversation.
Please also note that you are not using the latest ejabberd. As of today, latest version is 15.11. I recommend you use the latest one regarding MAM MUC, as several clarifications has been made to XEP-0313 and were added to latest ejabberd.
Here is example query, sending MAM query stanza to MUC room itself:
<iq type='set' id='juliet1' to='tech#conference.process-one.net'>
<query xmlns='urn:xmpp:mam:0' queryid='f27'>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>10</max>
</set>
</query>
</iq>

PubSub module returning error

I'm working on getting Jappix running. I'm using ejabberd as my XMPP server and I've got everything working except comments and viewing attachments - group chat, single chat, external authentication, private messages, friend lists, presence and other works as intended.
My configuration is the same as the one the Jappix project provides on their jappix/jappix-tools github repository. I have no errors in my ejabberd log, the only thing I got while debugging and digging everything up is that this is an example stanza sent to the server:
<iq xmlns="jabber:client" type="get" id="get_31-30" to="pubsub.mydomain.com" xml:lang="en">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
</iq>
And this is the response I get from the server:
<iq xmlns="jabber:client" from="pubsub.mydomain.com" to="arqu#mydomain.com/jappix (1378149270017)" type="error" id="get_31-30" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
And in Jappix I just get the usual "Service Unavailable" error message.
Additional info:
My BOSH is the internal one of ejabberd and works fine as far as i know, I've setup the reverse proxy and everything else to make it work. Still could be something related to this and not reaching the service on some other port maybe?
It looks like you do not have pubsub enabled/installed on your server.
Have you tried any other pubsub request?