Mobile XMPP and VoIP

Scalable, multi-region chat and calling

Ralph Meijer – VEON Digital

Overview

  • Project Context
  • Architecture
  • Contact management
  • Voice Calls
  • Chat
  • Group Chat
  • Miscellaneous

Context

  • External identity management
  • No Roster: contacts based on phone address book
  • Conversation Index
  • Initial restriction: single resource
  • Multi-region: federation
  • Design to scale up

Conversation Index

Architecture

  • One server cluster per region
  • External components:
    • History service (MAM)
    • Push services
    • User Service
    • MIX
    • TURN
  • TURN

Identity Management

  • Onboarding via HTTPS APIs
  • OAuth2 Access Key
  • XMPP Authentication using OAuth2 SASL mechanism
  • Server checks JID+key with IDM user info lookup
  • IDM provides internal API for lookup by e-mail, MSISDN

Contacts

Contact Discovery

  • No roster, so no explicitly stored contacts
  • Push contacts from phone book
  • Matches by User Service
  • Cached in Redis
  • Auto-expires
  • Cache miss:
    • Ask IDM
    • Ask other regions

Contact Discovery Request


<iq from='romeo@montague.lit/orchard' id='uw72g179'
    to='contacts.montague.lit' type='get'>
  <contacts xmlns='urn:xmpp:contact-disco:0' bid='100000'>
    <contact id='1234'>
      <address uri='tel:5550909090'/>
      <address uri='tel:5550909091'/>
      <address uri='mailto:elvis@rock.com'/>
    </contact>
    <contact id='1235'>
      <address uri='tel:5550909092'/>
      <address uri='tel:5550909094'/>
    </contact>
  </contacts>
</iq>
            

Contact Discovery Async Result (1)


<message from='contacts.montague.lit'
         to='romeo@montague.lit' type='headline'>
  <contacts xmlns='urn:xmpp:contact-disco:0' bid='100000'>
    <contact id='1234'>
      <address uri='tel:5550909090'>
        <discovery uri='xmpp:juliet@capulet.lit'/>
        <discovery uri='mailto:juliet@capulet.lit'/>
      </address>
      <address uri='tel:5550909091' >
        <discovery uri='xmpp:juliet@capulet.lit'/>
      </address>
      <address uri='mailto:elvis@rock.com'/>
    </contact>
  </contacts>
</message>
            

Contact Discovery Async Result (2)


<message from='contacts.montague.lit'
         to='romeo@montague.lit' type='headline'>
  <contacts xmlns='urn:xmpp:contact-disco:0' bid='100000'>
    <contact id='1235'>
      <address uri='tel:5550909092' >
        <discovery uri='mailto:tristan@capulet.lit'/>
      </address>
      <address uri='tel:5550909094' >
        <discovery uri='xmpp:tristan@capulet.lit'/>
      </address>
    </contact>
  </contacts>
</message>
            

Contact Metadata

Display names only:

  1. Local address book
  2. vCard4 iq request
  3. Unknown

Service Discovery

  • Old-style (pre-hash) CAPS
  • Mostly used to discover voice capability

Avatars

  • Fully HTTP based
  • Lookup by JID

Calling

Jingle Signaling

TURN Authentication

Call Push

Call Records

  • Call Detail Records
  • Headline message stanzas
  • To be part of chat history
  • After Jingle session-termination
  • Used to inform parties of:
    • Placed calls
    • Missed calls
    • Call Failures

CDR Example


<cdr xmlns='urn:xmpp:cdr:0'
     sid='sessionNumber1'
     initiator='northumberland@shakespeare.lit/westminster'
     responder='kingrichard@royalty.england.lit'
     answer='true'
     ring='true'
     termination-reason='success'
     duration='324'>
  <ssrc>a73sjjvkla37jfea</ssrc>
  <optional-value>a73sjjvkla37jfea</optional-value>
</cdr>  
            

CDR in Chat

Chat

  • Reuse of existing standards
  • Regular message stanzas
  • Explicitly made <body/> fallback

Chat Markers

Archive Management

Multimedia Sharing

Other Sharing

  • Stickers
  • News
  • Offers

Group Chat

Service Notices

  • Headline message for important notices
  • Example: suggestion to upgrade without disabling whole app
  • Originating from server
  • Modal dialog