Below is a capture of the aTalk debug log when joining chat room protected with captcha challenge.
Detail process when join room with captcha protection in aTalk:
a. On receive an invitation to join group chat, user click accept in invitation dialog to join room.
b. Instead of accepting invitation, the server returns with a captcha challenge message.
c. aTalk displays the captcha challenge prompt to user
d. Before user replies to the captcha challenge prompt, smack throws response timeout (5 seconds)
e. aTalk ignores this timeout, and continue to allow user to reply to the captcha prompt
f. When the captcha reply is validated, server proceeds to send <presence/>, indicating the join room has been completed successfully.
e. Because of the response timeout, smack is not in sync with the server status, and created problems either in sending or receiving messages from the conference room.
In all previous aTalk releases, it extends the smack reply time to 30s before join room, so as to allow time for user to reply. This works under normal condition when aTalk is in foreground. However this approach created problem when the captcha challenge prompt is not in focus i.e. invisible to user behind other views; the whole aTalk just hangs with Android Not Response (ANR) problem.
Appreciate if smack can look into uncouple the join room reply <presence> with join room stanza sending. Alternatively to provide a method call for app to update the room join status.
2020-02-08 10:25:15.835 25311-25965/org.atalk.android D/SMACK: RECV (0):
<message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<invite from='leopard@atalk.org/atalk'>
<reason>
Group chat invitation
</reason>
</invite>
</x>
<x reason='Group chat invitation' jid='chatroom-f3ji@conference.atalk.org' xmlns='jabber:x:conference'/>
<body xml:lang='en'>
leopard@atalk.org/atalk invites you to the room chatroom-f3ji@conference.atalk.org (Group chat invitation)
</body>
</message>
2020-02-08 10:25:27.073 25311-25963/org.atalk.android D/SMACK: SENT (0):
<iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-127' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'>
</query>
</iq>
2020-02-08 10:25:27.096 25311-25965/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='result' id='W8VII-127'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity name='chatroom-f3ji' type='text' category='conference'/>
<feature var='vcard-temp'/>
<feature var='http://jabber.org/protocol/muc'/>
<feature var='muc_hidden'/>
<feature var='muc_temporary'/>
<feature var='muc_open'/>
<feature var='muc_nonanonymous'/>
<feature var='muc_moderated'/>
<feature var='muc_unsecured'/>
<feature var='urn:xmpp:mam:tmp'/>
<feature var='urn:xmpp:mam:0'/>
<feature var='urn:xmpp:mam:1'/>
<feature var='urn:xmpp:mam:2'/>
<feature var='urn:xmpp:sid:0'/>
<x type='result' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>
http://jabber.org/protocol/muc#roominfo
</value>
</field>
<field var='muc#roominfo_occupants' type='text-single' label='Number of occupants'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_roomname' type='text-single' label='Natural-Language Room Name'/>
<field var='muc#roominfo_description' type='text-single' label='Room description'/>
<field var='muc#roominfo_contactjid' type='jid-multi' label='Contact Addresses (normally, room owner or owners)'>
<value>
leopard@atalk.org
</value>
</field>
<field var='muc#roominfo_changesubject' type='boolean' label='Occupants May Change the Subject'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_allowinvites' type='boolean' label='Occupants are allowed to invite others'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_allowpm' type='list-single' label='Roles that May Send Private Messages'>
<value>
anyone
</value>
<option label='Anyone'>
<value>
anyone
</value>
</option>
<option label='Anyone with Voice'>
<value>
participants
</value>
</option>
<option label='Moderators Only'>
<value>
moderators
</value>
</option>
<option label='Nobody'>
<value>
none
</value>
</option>
</field>
<field var='muc#roominfo_lang' type='text-single' label='Natural Language for Room Discussions'>
<value/>
</field>
</x>
</query>
</iq>
2020-02-08 10:25:27.139 25311-25963/org.atalk.android D/SMACK: SENT (0):
<iq to='conference.atalk.org' id='W8VII-130' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'>
</query>
</iq>
2020-02-08 10:25:27.156 25311-25965/org.atalk.android D/SMACK: RECV (0):
<a h='25' xmlns='urn:xmpp:sm:3'/>
2020-02-08 10:25:27.163 25311-25965/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='conference.atalk.org' type='result' id='W8VII-130'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity name='Chatrooms' type='text' category='conference'/>
<feature var='http://jabber.org/protocol/disco#info'/>
<feature var='http://jabber.org/protocol/disco#items'/>
<feature var='http://jabber.org/protocol/muc'/>
<feature var='vcard-temp'/>
<feature var='urn:xmpp:mucsub:0'/>
<feature var='http://jabber.org/protocol/muc#unique'/>
<feature var='jabber:iq:register'/>
<feature var='http://jabber.org/protocol/rsm'/>
<feature var='urn:xmpp:mam:tmp'/>
<feature var='urn:xmpp:mam:0'/>
<feature var='urn:xmpp:mam:1'/>
<feature var='urn:xmpp:mam:2'/>
<x type='result' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>
http://jabber.org/network/serverinfo
</value>
</field>
</x>
</query>
</iq>
2020-02-08 10:25:27.177 25311-25963/org.atalk.android D/SMACK: SENT (0):
<a xmlns='urn:xmpp:sm:3' h='43'/>
<presence to='chatroom-f3ji@conference.atalk.org/swordfish' id='W8VII-129'>
<x xmlns='http://jabber.org/protocol/muc'>
</x>
<c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
</presence>
2020-02-08 10:25:27.400 25311-25965/org.atalk.android D/SMACK: RECV (0):
<message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='17267810418355597201'>
<x xmlns='jabber:x:oob'>
<url>
https://atalk.sytes.net:5443/captcha/17267810418355597201
</url>
</x>
<captcha xmlns='urn:xmpp:captcha'>
<x type='form' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>
urn:xmpp:captcha
</value>
</field>
<field var='from' type='hidden'>
<value>
chatroom-f3ji@conference.atalk.org/swordfish
</value>
</field>
<field var='challenge' type='hidden'>
<value>
17267810418355597201
</value>
</field>
<field var='sid' type='hidden'>
<value>
W8VII-129
</value>
</field>
<field var='ocr' type='text-single' label='Enter the text you see'>
<media xmlns='urn:xmpp:media-element'>
<uri type='image/png'>
cid:sha1+61af7e04430f1a376893222106f04341ae370944@bob.xmpp.org
</uri>
</media>
<required/>
</field>
</x>
</captcha>
<data type='image/png' max-age='0' cid='sha1+61af7e04430f1a376893222106f04341ae370944@bob.xmpp.org' xmlns='urn:xmpp:bob'>
iVBORw0KGgoAAAANSUhEUgAAAIwAAAA8CAAAAACRYQ2XAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfkAggKGRvih22ZAAAMTUlEQVRo3u1ZaXhUVbZdt4akkspIgAwQCGFKCDyJQIA0IiiCgoDdPEVpxgBGQGiIhJhGUKRpFXFolUFQEDDQTQvI2GqDUaYYGQzEGELIHJKQVGWoebh1V/+4VRk00vj1e5/9I+dP7bPvOfusc+7ea+97SiD+e5oCHWA6wHSA6QDz/9tUv3hGWZGuPqh7z1Cv/3swwp0Z2HTbpInwdzQvbN28Jiw+ItQlevUe2vduT9UhqFs6FDyS+bvoiLsHU19UkK9W1OYgvWeMfILfJD75lr/D7jTV5GXXpY/2CfL5+om94+URR07mDZqRWF6hSQD028vnyOXl1lNpkUXFcUOAovP9tN2Df+7r4NaBFQBAUQ0AxnEj3wYAXLnS/z7AdCgvwC//Y2GM39i5CtXezCGxw+Uzsm3fEB07cNBIzbZqlTrybPVBDQAs6P5uYmpcCBxl5z85nzJzTuib8gspm74rFi4lkBnVy6UQ2ing3a1gOEly5cckaZ+W5i5OTjTQ8tmeCwbaGx44Ur07eeWm/MkPnyjyFF2u
2020-02-08 10:25:32.175 25311-27026/org.atalk.android E/(ChatRoomJabberImpl.java:713)#joinAs: Failed to join room:
chatroom-f3ji@conference.atalk.org with nickname: swordfish@atalk.org.: No response received within reply timeout. Timeout was 5000ms (~5s). StanzaCollector has been cancelled. Waited for response using: AndFilter: (StanzaTypeFilter: Presence, OrFilter: (AndFilter: (FromMatchesFilter (ignoreResourcepart): chatroom-f3ji@conference.atalk.org, MUCUserStatusCodeFilter: status=110), AndFilter: (FromMatchesFilter (full): chatroom-f3ji@conference.atalk.org/swordfish, StanzaIdFilter: id=W8VII-129, PresenceTypeFilter: type=error))).
2020-02-08 10:25:32.176 25311-27026/org.atalk.android D/(ChatRoomJabberImpl.java:718)#joinAs: Join room - received captcha challenge or user canceled (Ignore NoResponseException)
2020-02-08 10:26:10.819 25311-25963/org.atalk.android D/SMACK: SENT (0):
<iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-133' type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'>
</query>
</iq>
2020-02-08 10:26:10.842 25311-25965/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='result' id='W8VII-133'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<identity name='chatroom-f3ji' type='text' category='conference'/>
<feature var='vcard-temp'/>
<feature var='http://jabber.org/protocol/muc'/>
<feature var='muc_hidden'/>
<feature var='muc_temporary'/>
<feature var='muc_open'/>
<feature var='muc_nonanonymous'/>
<feature var='muc_moderated'/>
<feature var='muc_unsecured'/>
<feature var='urn:xmpp:mam:tmp'/>
<feature var='urn:xmpp:mam:0'/>
<feature var='urn:xmpp:mam:1'/>
<feature var='urn:xmpp:mam:2'/>
<feature var='urn:xmpp:sid:0'/>
<x type='result' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>
http://jabber.org/protocol/muc#roominfo
</value>
</field>
<field var='muc#roominfo_occupants' type='text-single' label='Number of occupants'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_roomname' type='text-single' label='Natural-Language Room Name'/>
<field var='muc#roominfo_description' type='text-single' label='Room description'/>
<field var='muc#roominfo_contactjid' type='jid-multi' label='Contact Addresses (normally, room owner or owners)'>
<value>
leopard@atalk.org
</value>
</field>
<field var='muc#roominfo_changesubject' type='boolean' label='Occupants May Change the Subject'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_allowinvites' type='boolean' label='Occupants are allowed to invite others'>
<value>
1
</value>
</field>
<field var='muc#roomconfig_allowpm' type='list-single' label='Roles that May Send Private Messages'>
<value>
anyone
</value>
<option label='Anyone'>
<value>
anyone
</value>
</option>
<option label='Anyone with Voice'>
<value>
participants
</value>
</option>
<option label='Moderators Only'>
<value>
moderators
</value>
</option>
<option label='Nobody'>
<value>
none
</value>
</option>
</field>
<field var='muc#roominfo_lang' type='text-single' label='Natural Language for Room Discussions'>
<value/>
</field>
</x>
</query>
</iq>
2020-02-08 10:26:22.296 25311-25963/org.atalk.android D/SMACK: SENT (0):
<iq to='chatroom-f3ji@conference.atalk.org' id='W8VII-135' type='set'>
<captcha xmlns='urn:xmpp:captcha'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE'>
<value>
urn:xmpp:captcha
</value>
</field>
<field var='from'>
<value>
chatroom-f3ji@conference.atalk.org/swordfish
</value>
</field>
<field var='challenge'>
<value>
17267810418355597201
</value>
</field>
<field var='sid'>
<value>
W8VII-129
</value>
</field>
<field var='username'>
<value>
swordfish@atalk.org/atalk
</value>
</field>
<field var='ocr'>
<value>
122322
</value>
</field>
</x>
</captcha>
</iq>
2020-02-08 10:26:22.317 25311-25965/org.atalk.android D/SMACK: RECV (0):
<presence to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' id='17640902051881643590'>
<c ver='h/nb9v1ZWVLaSPkbUurrhICkvXA=' node='http://www.process-one.net/en/ejabberd/' hash='sha-1' xmlns='http://jabber.org/protocol/caps'/>
</presence>
2020-02-08 10:26:22.328 25311-25965/org.atalk.android D/SMACK: RECV (0):
<presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/leopard' id='RMSI4-152'>
<c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
<x xmlns='vcard-temp:x:update'>
<photo>
9df0ce43f9e27c2849ff1b317427cade4af92a74
</photo>
</x>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item jid='leopard@atalk.org/atalk' role='moderator' affiliation='owner'/>
</x>
</presence>
2020-02-08 10:26:22.351 25311-25965/org.atalk.android D/SMACK: RECV (0):
<presence xml:lang='en-GB' to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org/swordfish' id='W8VII-129'>
<c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://android.atalk.org' ver='C8m/4hb7TJHmm8dpt7KpttXz6sY='/>
<x xmlns='vcard-temp:x:update'>
<photo>
cc39fa1cc9cff4e67851a63bd1b78ba937be6a90
</photo>
</x>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item jid='swordfish@atalk.org/atalk' role='participant' affiliation='none'/>
<status code='100'/>
<status code='110'/>
</x>
</presence>
2020-02-08 10:26:22.356 25311-25965/org.atalk.android D/SMACK: RECV (0):
<message to='swordfish@atalk.org/atalk' from='chatroom-f3ji@conference.atalk.org' type='groupchat'>
<subject/>
</message>