Skip to main content
Phones change networks all the time: Wi-Fi to mobile data, tunnels, lifts, a locked screen. The SDK handles these for you with sensible defaults. This page explains what it does and how to tune it.

What happens by default

networkEvents reports each step. See Network events.

Reconnect policy

Signature
Each attempt must be registered within 10 seconds, or it counts as failed. After giving up, connectionState is failed and errorEvents emits reconnect_failed. The SDK tries again on the next network change, or when you call client.reconnect(), for example from a Retry button.
Set SdkConfig(autoReconnect: false) to handle reconnection yourself.

Keep-alive

Signature

Network watching and foreground re-registration

  • SdkConfig.watchNetwork (default true) watches Wi-Fi, mobile, and offline through connectivity_plus, so the SDK reacts at once instead of waiting for the keep-alive.
  • SdkConfig.reregisterOnForeground (default true) registers again each time the app returns to the foreground. On a live connection this is one REGISTER on the same connection, and a call in progress isn’t touched. A dead connection is reconnected at once. Resumes within 2 seconds of each other count as one.

Calls during a network drop

When the connection drops during a connected or held call:
  1. The call stays up for up to 12 seconds. callEvents re-emits the call’s state with reason: 'reconnecting'.
  2. The SDK reconnects and re-registers. Once it is registered, it restarts the call’s audio path on the new network (an ICE restart in a SIP re-INVITE) and emits the state again with reason: 'reconnected'.
  3. If the network isn’t back within 12 seconds, the call ends with reason network_lost.
A call that is still being set up when the network drops ends at once. While the device is offline, makeCall throws StateError('No network connection').
If you hang up while the network is down, the BYE or CANCEL is sent again after the SDK reconnects: up to 3 times, within 5 minutes, as the same user. The other side isn’t left on a silent call.
An outage longer than 12 seconds ends the call on the app side, and the BYE follows when the app reconnects. If the app never reconnects, Vobiz ends the call on its side after a media timeout.

STUN and TURN

Call audio uses WebRTC, which needs to find a network path to Vobiz’s media servers. By default the SDK uses Google’s public STUN server, which works on most networks. Behind strict corporate firewalls or symmetric NAT, add your own TURN server.
Signature
TurnServers.withFallbacks builds the TURN entries for UDP, TCP, and TLS on port 443 in one call, so calls also work on networks that block everything but HTTPS:
Signature
Vobiz doesn’t provide TURN servers: use your own or a TURN provider.

Microphone settings

Signature

Next steps