Smack AbstractIqRequestHandler() implementation clarification

aTalk is adding support for the new XEP-0215 feature, but facing some problem in AbstractIqRequestHandler() implementation.

In the ExternalServiceDiscoveryManager class implementation, the AbstractIqRequestHandler#handleIQRequest(IQ iqRequest) method was found that:
iqRequest does not contain the ServiceElement childElement as expected; otherwise everything is working OK.
I am no sure where is the root cause, appreciate if the smack team can give some advice.

The latest aTalk source has been checked into the github master repository. You can also get a copy of the apk in the release directory i.e.:
aTalk-playstore-debug.apk

Below aTalk logcat contains the pushed IQ content and the received stazard.

2022-11-02 13:56:27.121 18822-19053/org.atalk.android D/SMACK: SENT (0): 
    <iq to='abc123@atalk.sytes.net/atalk' id='6GK22-24' type='set'>
      <services xmlns='urn:xmpp:extdisco:2'>
        <services>
          <service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4' action='delete'/>
          <service username='1667411763:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='0nPli/bYcKPhvzBXYbH52M2lgR0=' host='42.60.99.4' expires='2022-11-02T17:56:03Z' action='add'/>
          <service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560' action='modify'/>
        </services>
      </services>
    </iq>

2022-11-02 13:56:27.143 18822-19054/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-US' to='abc123@atalk.sytes.net/atalk' from='abc123@atalk.sytes.net/atalk' type='set' id='6GK22-24'>
      <services xmlns='urn:xmpp:extdisco:2'>
        <services>
          <service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4' action='delete'/>
          <service username='1667411763:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='0nPli/bYcKPhvzBXYbH52M2lgR0=' host='42.60.99.4' expires='2022-11-02T17:56:03Z' action='add'/>
          <service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560' action='modify'/>
        </services>
      </services>
    </iq>

2022-11-02 13:56:27.175 18822-19054/org.atalk.android D/(ExternalServiceDiscoveryProvider.java:62)#parse: ExternalServices: <services xmlns='urn:xmpp:extdisco:2'><services><service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4' action='delete'/><service username='1667411763:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='0nPli/bYcKPhvzBXYbH52M2lgR0=' host='42.60.99.4' expires='2022-11-02T17:56:03Z' action='add'/><service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560' action='modify'/></services></services>

// ServiceElement of the iq Request is empty???
2022-11-02 13:56:27.176 18822-19070/org.atalk.android D/(ExternalServiceDiscoveryManager.java:167)#handleESDServicePush: ESD Service Push action services: []

2022-11-02 13:56:27.178 18822-19053/org.atalk.android D/SMACK: SENT (0): 
    <iq to='abc123@atalk.sytes.net/atalk' id='6GK22-24' type='result'>
    </iq>
2022-11-02 13:56:27.185 18822-19054/org.atalk.android D/SMACK: RECV (0): 
    <iq xml:lang='en-US' to='abc123@atalk.sytes.net/atalk' from='abc123@atalk.sytes.net/atalk' type='result' id='6GK22-24'/>

You use a class called DefaultXmlElementProvider to parse this

Probably DefaultXmlElementProvider, which isn’t part of Smack, is not able to do what you think it does.

Actually the same ExtensionProvider’s for the <services xmlns=‘urn:xmpp:extdisco:2’> and <service> are used for getting the ServiceElement’s in the ExternalServiceDiscoveryManager#getExtServices(). It works without any problem, and mExtServices has all the received ServiceElement’s.

The previous attached aTalk logcat also indicates that the received stanzard is phrased properly with all the <service> elements:

2022-11-02 13:56:27.175 18822-19054/org.atalk.android D/(ExternalServiceDiscoveryProvider.java:62)#parse: ExternalServices: <services xmlns='urn:xmpp:extdisco:2'><services><service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4' action='delete'/><service username='1667411763:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='0nPli/bYcKPhvzBXYbH52M2lgR0=' host='42.60.99.4' expires='2022-11-02T17:56:03Z' action='add'/><service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560' action='modify'/></services></services>

If you refer to JingleCallManager.java class, the DefaultXmlElementProvider’s are used for RTP call handling without problem.

I believe I have found the problem. The test push IQ that was generated actually embedded the desired ExternalServices within another ExternalServices. Will make the correction, and retest.

2022-11-03 09:14:28.045 7426-7582/org.atalk.android D/SMACK: SENT (0): 
    <iq to='abc123@atalk.sytes.net/atalk' id='V4CJJ-24' type='set'>
      <services xmlns='urn:xmpp:extdisco:2'>
        <services>
          <service type='stun' transport='udp' restricted='false' port='3478' host='42.60.99.4' action='delete'/>
          <service username='1667481226:1074796f99cde8d3' type='turn' transport='udp' restricted='true' port='3478' password='yWiIQR8p32T/JBiP+J1lBBDEdD8=' host='42.60.99.4' expires='2022-11-03T13:13:46Z' action='add'/>
          <service type='stun' transport='udp' restricted='false' port='3478' host='fe80::a5e2:4bc8:f5ea:2560' action='modify'/>
        </services>
      </services>
    </iq>

Has fixed the above mentioned problem.

Has to change a couple of class files:
a. ExternalServiceDiscovery.java
b. IceCandidateHarverster
c. ServiceElement etc

All the latest source files changes have checked into the aTalk github master repository (Tag v3.0.3).

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.