# Joining & Creating Calls

This guide explains how to configure and join a call with the Stream Video ESP32 SDK. The SDK handles coordinator connection, join call (REST), SFU WebSocket, and publishing; you pass join parameters and optional callbacks.

## Join parameters

When calling `stream_video_join_call`, you pass `stream_video_join_call_params_t`. The app must obtain auth data (userId, apiKey, token) from its own backend or Stream's token service and pass it in `auth_data`. The SDK does not fetch tokens.

| Field        | Type                               | Description                                                                                         |
| ------------ | ---------------------------------- | --------------------------------------------------------------------------------------------------- |
| `auth_data`  | `const stream_video_auth_data_t *` | Auth data from your token service (required). Must contain valid `user_id`, `api_key`, and `token`. |
| `call_type`  | `const char *`                     | Call type (e.g. `"default"`).                                                                       |
| `call_id`    | `const char *`                     | Call ID; `NULL` to create a new call.                                                               |
| `create`     | `bool`                             | If true, create the call if it does not exist.                                                      |
| `location`   | `const char *`                     | Optional location hint; `NULL` for auto.                                                            |
| `result_cb`  | `stream_video_join_result_cb_t`    | Called with join success or failure (optional).                                                     |
| `user_data`  | `void *`                           | User context for `result_cb`.                                                                       |
| `mute_audio` | `bool`                             | If true, do not publish audio.                                                                      |
| `mute_video` | `bool`                             | If true, do not publish video.                                                                      |

Publishing starts automatically after the SFU join response.

## User and environment (for token service)

When your app calls the token service, you typically pass a user ID and environment (e.g. in the minimal example's `STREAM_USER_ID` and `STREAM_ENVIRONMENT`). These are used only for the **token request**; the SDK only receives the resulting `auth_data`. See [Client auth](https://getstream.io/video/docs/esp32/guides/client-auth/) for the token endpoint and response format.

## Call selection

### Call type

```c
#define STREAM_CALL_TYPE "default"  // or "livestream", etc.
```

### Call ID

**Option 1: Join existing call**

```c
#define STREAM_CALL_ID "call123"  // Join this specific call
```

**Option 2: Create new call**

```c
#define STREAM_CALL_ID NULL  // Create a new call (use with create=true in join params)
```

If `STREAM_CALL_ID` is set, the SDK joins that call. If `STREAM_CALL_ID` is NULL and `create` is true in join params, the backend creates a new call.

## SDK-managed flow

The app only calls:

1. `stream_video_init()`
2. `stream_video_join_call(&params, &client)` with the above configuration
3. `stream_video_leave_call(client)` when done
4. `stream_video_deinit()` to tear down

The app fetches auth data (e.g. via `app_request_auth_data`) before calling join. The SDK uses that auth data and then: connects to coordinator → joins call via REST → connects to SFU → starts publishing after SFU join response.

## WiFi and other options

- **WiFi** — SSID and password are set via `sdkconfig.defaults` or **idf.py menuconfig** under "Stream Video Example".
- **Runtime configuration** — Currently configuration is compile-time (`#define`). For runtime configuration you could use NVS, serial, or menuconfig.

## Next steps

- [Example configuration](https://getstream.io/video/docs/esp32/guides/example-configuration/) — Full main.c configuration guide.
- [API Reference](https://getstream.io/video/docs/esp32/guides/api-reference/) — Full API: init, join, leave, error handling, and types.

---

This page was last updated at 2026-08-10T16:01:05.254Z.

For the most recent version of this documentation, visit [https://getstream.io/video/docs/esp32/guides/joining-and-creating-calls/](https://getstream.io/video/docs/esp32/guides/joining-and-creating-calls/).