userEvent

View as MarkdownOpen in Claude

Send a custom user-defined event on an active call. User events allow you to pass arbitrary data between call control applications and event handlers. Listeners registered for user events on the RELAY side will receive the payload you send here.

Request

dialobjectRequired
OR
updateobjectRequired
OR
calling.endobjectRequired
OR
calling.disconnectobjectRequired
OR
calling.ai_holdobjectRequired
OR
calling.ai_unholdobjectRequired
OR
calling.ai_messageobjectRequired
OR
calling.ai.stopobjectRequired
OR
calling.playobjectRequired
OR
calling.play.pauseobjectRequired
OR
calling.play.resumeobjectRequired
OR
calling.play.stopobjectRequired
OR
calling.play.volumeobjectRequired
OR
calling.recordobjectRequired
OR
calling.record.pauseobjectRequired
OR
calling.record.resumeobjectRequired
OR
calling.record.stopobjectRequired
OR
calling.collectobjectRequired
OR
calling.collect.stopobjectRequired
OR
calling.collect.start_input_timersobjectRequired
OR
calling.detectobjectRequired
OR
calling.detect.stopobjectRequired
OR
calling.tapobjectRequired
OR
calling.tap.stopobjectRequired
OR
calling.streamobjectRequired
OR
calling.stream.stopobjectRequired
OR
calling.denoiseobjectRequired
OR
calling.denoise.stopobjectRequired
OR
calling.transcribeobjectRequired
OR
calling.transcribe.stopobjectRequired
OR
calling.live_transcribeobjectRequired
OR
calling.live_translateobjectRequired
OR
calling.transferobjectRequired
OR
calling.send_fax.stopobjectRequired
OR
calling.receive_fax.stopobjectRequired
OR
calling.referobjectRequired
OR
calling.user_eventobjectRequired

Response

Call LegobjectRequired
OR
Fabric Subscriber Device LegobjectRequired

Response Example

Response
1{
2 "id": "0e9c80d7-a149-4917-892d-420043709f45",
3 "from": "+12069708643",
4 "to": "+15550198765",
5 "direction": "outbound-api",
6 "source": "realtime_api",
7 "charge": 0,
8 "created_at": "2024-05-06T12:20:00Z",
9 "charge_details": [
10 {
11 "description": "Outbound Voice",
12 "charge": 0.004
13 }
14 ],
15 "status": "queued",
16 "type": "relay_pstn_call"
17}

Example

1import { RestClient } from "@signalwire/sdk";
2
3const client = new RestClient({
4 project: "your-project-id",
5 token: "your-api-token",
6 host: "your-space.signalwire.com"
7});
8
9await client.calling.userEvent("call-id-xxx", {
10 event: { action: "order.confirmed", order_id: "ORD-12345", amount: 49.99 },
11});