Solution

When mobile client is entering inactive state it notifies server about it by sending following stanza:

<iq type="set" id="xx">
<mobile
  xmlns="http://tigase.org/protocol/mobile#v2"
  enable="true"/>
</iq>

After receiving stanza server starts queueing presence stanza which should be send to mobile client. Any other stanza (such as iq or messenge) is sent immediately to the client.

When mobile client is entering active state it notifies server by sending following stanza:

<iq type="set" id="xx">
<mobile
  xmlns="http://tigase.org/protocol/mobile#v2"
  enable="false"/>
</iq>

After receiving stanza server sends all queued presence stanzas to the client.

Also all presence stanzas from queue will be sent if number of presence stanzas in queue will reach queue size limit. By default this limit is set to 50.