Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions fern/assets/images/img/how-apps-are-built-themed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fern/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Find the task that matches what you want to build, how your application connects
### Learn the platform and get started

- [Get started](/docs/platform/getting-started): Walkthrough of your Space, the build paths, and the core concepts.
- [Pick the right SignalWire product](/docs/platform/pick-a-product): Compare SWML, the REST APIs, the Browser SDK, and Relay, and match each calling, AI chat, messaging, or fax use case to one.
- [Create an account](/docs/platform/signing-up-for-a-space): Open a new Space on the SignalWire platform.
- [API credentials](/docs/platform/your-signalwire-api-space): Find the Project ID and API token that SDKs and APIs use to authenticate.
- [Projects and Subprojects](/docs/platform/projects): How a SignalWire Space, its Projects, and their Subprojects fit together, how to structure them for customers, environments, and teams, and how to manage them in the Dashboard and through the API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,43 @@ call.status$
For interactive dialpads (digits sent as the user presses), wire
the button click directly — by that point the call is connected.

## Receive user events from the call

Your server can push custom JSON to a browser that's on a call.
The SWML [`user_event`][swml-user-event] method,
a Server SDK tool result's [user event action][fr-user-event],
and the REST [`calling.user_event`][call-commands] command
each fire a `user_event` on the call.
Subscribe to it with [`subscribe`]:

```js
call.subscribe("user_event").subscribe((event) => {
const { driver, plate } = event.params.ride;
driverName.textContent = driver;
plateNumber.textContent = plate;
});
```

Your data arrives in `event.params`.
SignalWire adds call details such as `call_id`, `node_id`, and `segment_id` at the top level of `params`,
so put your own fields under a key of your own, such as `ride`, to keep them from colliding.
The event `{ "ride": { "driver": "Sam", "plate": "BAY-123" } }` reaches the browser with this shape:

```json
{
"event_type": "user_event",
"params": {
"ride": {
"driver": "Sam",
"plate": "BAY-123"
},
"call_id": "<CALL_ID>",
"node_id": "<NODE_ID>",
"segment_id": "<SEGMENT_ID>"
}
}
```

## Moderation — check the capability first

Methods on other participants exist (`participant.mute()`,
Expand Down Expand Up @@ -245,7 +282,7 @@ per-class reference:

- [`Participant`] — mute, deaf, hand raise, audio processing, server-mixed volumes; also the surface for moderation actions on other members ([`remove`], [`end`], [`setPosition`]).
- [`SelfParticipant`] — adds [`enableStudioAudio`] / [`disableStudioAudio`] on top of `Participant`.
- [`WebRTCCall`] — session-level controls: [`hangup`], [`sendDigits`], [`toggleLock`], [`toggleHold`], [`transfer`], local-mic pipeline ([`setLocalMicrophoneGain`], [`localAudioLevel$`], [`localSpeaking$`], [`enablePushToTalk`], [`setPushToTalkActive`]).
- [`WebRTCCall`] — session-level controls: [`hangup`], [`sendDigits`], [`toggleLock`], [`toggleHold`], [`transfer`], custom events ([`subscribe`]), local-mic pipeline ([`setLocalMicrophoneGain`], [`localAudioLevel$`], [`localSpeaking$`], [`enablePushToTalk`], [`setPushToTalkActive`]).
- [`SelfCapabilities`] — server-authoritative flags for gating moderation UI; see [Capabilities](/docs/browser-sdk/v4/guides/capabilities).

[reference]: /docs/browser-sdk/v4/reference
Expand Down Expand Up @@ -280,6 +317,10 @@ per-class reference:
[`toggleLock`]: /docs/browser-sdk/v4/reference/webrtc-call/toggle-lock
[`toggleHold`]: /docs/browser-sdk/v4/reference/webrtc-call/toggle-hold
[`transfer`]: /docs/browser-sdk/v4/reference/webrtc-call/transfer
[`subscribe`]: /docs/browser-sdk/v4/reference/webrtc-call/subscribe
[swml-user-event]: /docs/swml/reference/calling/user-event
[fr-user-event]: /docs/server-sdks/guides/result-actions
[call-commands]: /docs/apis/rest/calls/call-commands
[`setLocalMicrophoneGain`]: /docs/browser-sdk/v4/reference/webrtc-call/set-local-microphone-gain
[`enablePushToTalk`]: /docs/browser-sdk/v4/reference/webrtc-call/enable-push-to-talk
[`setPushToTalkActive`]: /docs/browser-sdk/v4/reference/webrtc-call/set-push-to-talk-active
Expand Down
2 changes: 2 additions & 0 deletions fern/products/platform/pages/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The Dashboard's left navigation includes **My Resources**, **Click-to-Call**, **

Let's begin by figuring out the best way for you to build.
The right approach depends on what you're creating and how you prefer to work.
To compare the products side by side and see how they combine,
see [Pick the right SignalWire product](/docs/platform/pick-a-product).

### What are you trying to build?

Expand Down
Loading
Loading