This is a sketch of UX and protocol considerations for a client which wishes to help users use gateways.

In every place where the UI would ask for a Jabber ID (most notably contact add, but possibly also invite to chatroom, create chatroom from 1:1 conversation, start voice/video call to non-contact, search view where a Jabber ID can be used, etc) it should scan the user's roster for JIDs which have disco#info > identity[category=gateway] and show some way of choosing to enter an identifier for that gateway instead of a Jabber ID. The simplest example might be a drop-down with disco#info > identity[type] and optional disambiguating disco#info > idenity[name] such as "sms (Cheogram)".

If a user has unambiguously selected a gateway, use https://xmpp.org/extensions/xep-0100.html#addressing-iqgateway to get a prompt:

<iq type='get' to='gateway.tld' id='gate1'>
  <query xmlns='jabber:iq:gateway'/>
</iq>

<iq type='result' from='gateway.tld' id='gate1'>
  <query xmlns='jabber:iq:gateway'>
    <desc>
      Please enter the Whatever of the
      person you would like to contact.
    </desc>
    <prompt>Whatever</prompt>
  </query>
</iq>

This text may then be used as part of the UX as makes sense to help the user feel comfortable. Getting a success here and not an error also means that jabber:iq:gateway can be used in the next step.

NOTE: it is also acceptable (and in some UX may be preferred or even necessary) to pre-emptively ask all gateways for the prompt, instead of only once one is selected.

If an identifier is (or might be, depending on UX) one for a particular gateway, use the following procedure to map it to a Jabber ID and then perform the in-context relevant action on that Jabber ID as though it had been entered directly:

  1. If a prompt was got for jabber:iq:gateway above then use that protocol to finish resolution:

    • <iq type='set' to='gateway.tld' id='gate2'>
        <query xmlns='jabber:iq:gateway'>
            <prompt>(555) 123-4567</prompt>
        </query>
      </iq>
      
      <iq type='result' from='gateway.tld' id='gate2'>
        <query xmlns='jabber:iq:gateway'>
          <jid>+15551234567@gateway.tld</jid>
        </query>
      </iq>
  2. If an error is received in response to jabber:iq:gateway protocol, print the error message to the user and allow them to try again. This allows the gateway to provide useful feedback about format errors to the user.

  3. If an error was received in response to fetching the jabber:iq:gateway prompt, then the gateway does not support this protocol. Look for a disco#info > feature[var="jid\20escaping"] and if found construct a JID using XEP-0106 escaping on the user input concatenated with @gateway.tld

  4. If jabber:iq:gateway and jid\20escaping are both unsupported, replace any @ in the user input with % and concatenate @gateway.tld

NOTE: If the result of this procedure is a string that is not a valid Jabber ID, it should be rejected just as if a user manually keyed in an invalid Jabber ID.

GatewayContactUX (last edited 2021-250 01:25:18 by Singpolyma)