processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.11k stars 1.51k forks source link

ejabberd XEP-0215 support clarification #3926

Closed cmeng-git closed 2 years ago

cmeng-git commented 2 years ago

Before creating a ticket, please consider if this should fit the discussion forum better: https://github.com/processone/ejabberd/discussions

Environment

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml

listen:
  ##
  ## ejabberd_stun: Handles STUN Binding requests
  ##
  - 
    port: 3478
    ip: "::"
    transport: udp
    module: ejabberd_stun
    use_turn: true
    turn_min_port: 49152
    turn_max_port: 65535
    auth_type: user
    auth_realm: https://atalk.sytes.net

    ## The server's public IPv4 address:
    turn_ipv4_address: 42.60.99.4
    ## The server's public IPv6 address:
    # turn_ipv6_address: 2001:db8::3

  -
    port: 5349
    transport: tcp
    module: ejabberd_stun
    use_turn: true
    turn_min_port: 49152
    turn_max_port: 65535
    auth_type: user
    auth_realm: https://atalk.sytes.net
    turn_ipv4_address: 42.60.99.4
    certfile: /etc/letsencrypt/live/atalk.sytes.net/cert.pem

  mod_stun_disco:
    access: register
    credentials_lifetime: 12h

    services:
        -
          host: 42.60.99.4
          port: 3478
          type: stun
          transport: udp
          restricted: false
        -
          host: 42.60.99.4
          port: 3478
          type: turn
          transport: udp
          restricted: true
        -
          host: atalk.sytes.net
          port: 5349
          type: stuns
          transport: tcp
          restricted: false
        -
          host: atalk.sytes.net
          port: 5349
          type: turns
          transport: tcp
          restricted: true

Errors from error.log/crash.log

See aTalk logcat below

Bug description

Please, give us a precise description (what does not work, what is expected, etc.)

aTalk is trying to implement support for the below XEP Standard. XEP-0215: External Service Discovery v1.0.0 (2022-08-23) On request for \, instead of returning the list of services, it gives an error as shown below. Please advice on a solution if any.

2022-10-28 12:02:25.845 8305-8487/org.atalk.android D/SMACK: SENT (0): 
    <iq to='atalk.sytes.net' id='2EDM2-16' type='get'>
      <service xmlns='urn:xmpp:extdisco:2'/>
    </iq>

2022-10-28 12:02:27.180 8305-8488/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-US' to='abc123@atalk.sytes.net/atalk' from='atalk.sytes.net' type='error' id='2EDM2-16'>
      <service xmlns='urn:xmpp:extdisco:2'/>
      <error code='400' type='modify'>
        <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        <text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
          Missing attribute &apos;host&apos; in tag &lt;service/&gt; qualified by namespace &apos;urn:xmpp:extdisco:2&apos;
        </text>
      </error>
    </iq>
badlop commented 2 years ago

Can you mention what exact example number from that XEP is the client trying to send?

cmeng-git commented 2 years ago
  1. Use Cases

3.1 Requesting All Service

Example 1.

badlop commented 2 years ago

Your client is not sending the same that Example 1.

Example 1 says services, but that client is sending service.

cmeng-git commented 2 years ago

Thanks for pointing out the error in the sending stanza. After the correction, everything is working.

2022-10-29 07:23:24.063 5184-5290/org.atalk.android D/SMACK: SENT (0): 
    <iq id='J22E9-17' type='get'>
      <pubsub xmlns='http://jabber.org/protocol/pubsub'>
        <items node='eu.siacs.conversations.axolotl.devicelist'/>
      </pubsub>
    </iq>
    <r xmlns='urn:xmpp:sm:3'/>
2022-10-29 07:23:24.064 5184-5291/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-US' to='abc123@atalk.sytes.net/atalk' from='atalk.sytes.net' type='result' id='J22E9-16'>
      <services xmlns='urn:xmpp:extdisco:2'>
        <service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4'/>
        <service username='1667042604:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='wOErHymaGz0zhya4LEv98B9AP58=' host='42.60.99.4' expires='2022-10-29T11:23:24Z'/>
        <service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560'/>
        <service username='1667042604:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='wOErHymaGz0zhya4LEv98B9AP58=' host='fe80::a5e2:4bc8:f5ea:2560' expires='2022-10-29T11:23:24Z'/>
        <service type='stun' transport='tcp' restricted='false' port='5349' host='42.60.99.4'/>
        <service username='1667042604:1074796f99cde8d3' type='turn' transport='tcp' restricted='true' port='5349' password='wOErHymaGz0zhya4LEv98B9AP58=' host='42.60.99.4' expires='2022-10-29T11:23:24Z'/>
        <service type='stuns' transport='tcp' restricted='false' port='5349' host='atalk.sytes.net'/>
        <service username='1667042604:1074796f99cde8d3' type='turns' transport='tcp' restricted='true' port='5349' password='wOErHymaGz0zhya4LEv98B9AP58=' host='atalk.sytes.net' expires='2022-10-29T11:23:24Z'/>
      </services>
    </iq>