> ## Documentation Index
> Fetch the complete documentation index at: https://www.vobiz.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vobiz Flutter SDK (vobiz_webrtc)

> Add voice calling to Android and iOS apps with the Vobiz Flutter SDK: sign in as a SIP endpoint or with an access token, make and receive calls, control audio, and wake a closed Android or iOS app with Vobiz push.

The Vobiz Flutter SDK (`vobiz_webrtc`) turns your Android or iOS app into a phone. It registers with Vobiz over a secure WebSocket, carries call audio over WebRTC, and gives you in-call controls: mute, speaker and Bluetooth routing, hold and resume, DTMF, and call-quality metrics. Vobiz push wakes a closed app when a call arrives: through Firebase on Android, and through PushKit and CallKit on iOS.

This guide documents every public method of the SDK, grouped by task. Each method lists its signature, parameters, return value, errors, and an example.

## Features

* **Sign in** as a [SIP endpoint](https://www.vobiz.ai/docs/integrations/flutter-sdk/create-sip-endpoint.md) (username and password), through a credentials provider your backend serves, or with a short-lived **access token**. No Vobiz Auth Token ever has to reach the device.
* **Outbound calls** to phone numbers in E.164 format, with a caller ID, recording, and custom `X-VH-` SIP headers.
* **Incoming calls** rung by your application's [`<Dial><User>`](https://www.vobiz.ai/docs/xml/dial), with the caller's number and SIP headers.
* **In-call controls:** mute, speakerphone and audio routes (earpiece, speaker, Bluetooth, wired), hold and resume, DTMF (RFC 4733 or SIP INFO).
* **Call quality:** round-trip time, jitter, packet loss, and a MOS estimate with good, fair, and poor levels.
* **Network resilience:** automatic reconnection with backoff, re-registration when the app returns to the foreground, and calls that survive a Wi-Fi to mobile switch.
* **Push-to-wake (Android):** Vobiz holds an incoming call while a push wakes your closed app, then hands the call to the SDK.
* **Conference calls:** add people to a call, mute, hold, or remove them, and end the conference for everyone.
* **Typed events** as Dart streams for connection, calls, media, network, errors, and push.

## How it works

```mermaid theme={null}
flowchart LR
  A[Your Flutter app<br/>vobiz_webrtc] -- "SIP over WSS<br/>registrar.vobiz.ai:5063" --> B[Vobiz registrar]
  A -- "WebRTC audio" --> C[Vobiz media servers]
  B --> D[Your application<br/>Answer URL + VobizXML]
  D -- "&lt;Dial&gt;" --> E[Phone network]
```

1. The app registers with the Vobiz registrar as a SIP endpoint (or as an access-token identity).
2. **Outbound:** the app sends the call to Vobiz. Vobiz requests the Answer URL of the endpoint's [application](https://www.vobiz.ai/docs/platform/voice/applications.md), and your VobizXML decides where the call goes, usually with [`<Dial>`](https://www.vobiz.ai/docs/xml/dial).
3. **Inbound:** a call reaches the app when an application rings it with `<Dial><User>sip:USERNAME@registrar.vobiz.ai</User></Dial>`, or when you place a call to that SIP address with the [Voice API](https://www.vobiz.ai/docs/call/overview.md).

## Requirements

| Requirement | Value |
| - | - |
| Flutter | 3.19 or later |
| Dart | 3.3 or later |
| Android | `minSdk` 24, `targetSdk` and `compileSdk` 36 |
| iOS | 15.0 (13.0 if you don't use Firebase or a call-screen plugin) |
| Platforms | Android and iOS. Web and desktop are not supported. |
| Vobiz | A Vobiz account with a [SIP endpoint](https://www.vobiz.ai/docs/integrations/flutter-sdk/create-sip-endpoint.md) or an access token, and an [application](https://www.vobiz.ai/docs/platform/voice/applications.md) for outbound calls |

### Platform support

| Capability | Android | iOS |
| - | - | - |
| Outbound calls | Yes | Yes |
| Incoming calls, app in the foreground | Yes | Yes |
| Incoming calls, app in the background or closed | Yes, with [Vobiz push](https://www.vobiz.ai/docs/integrations/flutter-sdk/push-notifications.md) (Firebase) | Yes, with [Vobiz push](https://www.vobiz.ai/docs/integrations/flutter-sdk/push-notifications.md#ios-pushkit-and-callkit) (PushKit and CallKit) |
| Mute, speaker, hold, DTMF, call quality | Yes | Yes |

## Quick start

**1. Create a SIP endpoint**

In the Vobiz Console, open **Voice** > **Endpoints** and click **Create endpoint**. Note the SIP username and password. See [Create a SIP endpoint](https://www.vobiz.ai/docs/integrations/flutter-sdk/create-sip-endpoint.md).

**2. Install the SDK**

Add `vobiz_webrtc` to `pubspec.yaml` and the microphone permissions to your app. See [Installation](https://www.vobiz.ai/docs/integrations/flutter-sdk/installation.md).

**3. Sign in**

```dart theme={null}
import 'package:vobiz_webrtc/vobiz_webrtc.dart';

Future<VobizClient> signIn() async {
  final client = VobizClient(config: const SdkConfig());

  client.connectionEvents.listen((event) {
    if (event.registrationState == RegistrationState.registered) {
      print('Ready to make and receive calls');
    }
  });

  await client.connectWithCredentials(
    const CredentialConfig(
      username: 'YOUR_SIP_USERNAME',
      password: 'YOUR_SIP_PASSWORD',
    ),
  );
  return client;
}
```

**4. Make a call**

```dart theme={null}
final callId = await client.makeCall(
  '+91XXXXXXXXXX',          // destination, E.164
  callerId: '+91YYYYYYYYYY', // a number your account owns
);
```

**5. Answer incoming calls**

```dart theme={null}
client.callEvents.listen((event) {
  if (event.state == CallStateStatus.incoming) {
    print('Incoming call from ${event.remoteIdentity}');
    client.acceptCall(event.callId);
  }
});
```

> [!WARNING]
>
> Never put your account **Auth ID** and **Auth Token** in a mobile app. Anyone who extracts them controls your whole account. In production, your backend gives each user their own endpoint credentials or an access token. See [Sign in](https://www.vobiz.ai/docs/integrations/flutter-sdk/sign-in.md).

## Guide

> [card] [Create a SIP endpoint](https://www.vobiz.ai/docs/integrations/flutter-sdk/create-sip-endpoint.md)
>
> Create the endpoint the app signs in as, step by step in the Console.

> [card] [Installation](https://www.vobiz.ai/docs/integrations/flutter-sdk/installation.md)
>
> Add the package, Android and iOS permissions, and platform settings.

> [card] [Sign in](https://www.vobiz.ai/docs/integrations/flutter-sdk/sign-in.md)
>
> Create the client, configure it, and sign in with credentials or access tokens.

> [card] [Make and receive calls](https://www.vobiz.ai/docs/integrations/flutter-sdk/calls.md)
>
> Place calls, answer or decline incoming calls, and follow the call lifecycle.

> [card] [In-call controls](https://www.vobiz.ai/docs/integrations/flutter-sdk/in-call-controls.md)
>
> Mute, speaker and audio routes, hold, DTMF, and audio interruptions.

> [card] [Custom SIP headers](https://www.vobiz.ai/docs/integrations/flutter-sdk/sip-headers.md)
>
> Send caller ID, recording, and your own `X-VH-` headers to your Answer URL.

> [card] [Events and states](https://www.vobiz.ai/docs/integrations/flutter-sdk/events.md)
>
> Every stream the client emits, with its event fields and states.

> [card] [Call quality](https://www.vobiz.ai/docs/integrations/flutter-sdk/call-quality.md)
>
> Round-trip time, jitter, packet loss, and MOS levels.

> [card] [Network and reconnection](https://www.vobiz.ai/docs/integrations/flutter-sdk/network.md)
>
> Reconnection, keep-alive, network changes during a call, and TURN.

> [card] [Push notifications (Android)](https://www.vobiz.ai/docs/integrations/flutter-sdk/push-notifications.md)
>
> Ring a closed app with Vobiz push-to-wake.

> [card] [Conference calls](https://www.vobiz.ai/docs/integrations/flutter-sdk/conference.md)
>
> Add people to a call and manage participants.

> [card] [Errors and troubleshooting](https://www.vobiz.ai/docs/integrations/flutter-sdk/errors.md)
>
> Exceptions, error codes, access-token codes, and common fixes.

## Resources

* **Source code and example app:** [vobiz-ai/vobiz-flutter-sdk](https://github.com/vobiz-ai/vobiz-flutter-sdk). The `example/` folder is a complete calling app built on the SDK.
* **Platform setup reference:** [PLATFORM\_SETUP.md](https://github.com/vobiz-ai/vobiz-flutter-sdk/blob/main/PLATFORM_SETUP.md)
* **Release notes:** [CHANGELOG.md](https://github.com/vobiz-ai/vobiz-flutter-sdk/blob/main/CHANGELOG.md)
* **Browser calling:** [Vobiz WebRTC SDK](https://www.vobiz.ai/docs/integrations/webrtc-sdk.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.