SIP domain applications

View as Markdown

A Domain Application is a SignalWire feature that allows you to send SIP traffic to a custom domain and run specified logic. To define that logic, you can set up a handler in the SIP Space of your SignalWire Dashboard.

Domain App page with the option to create a new Domain App

Domain App page with the option to create a new Domain App

RELAY Application

If you are handling incoming SIP traffic with a RELAY Application, you are defining your logic in a separate RELAY application on your own server. RELAY applications run different logic based on the topic (V4) or context (V3) attached to incoming calls, so you will need to choose a topic/context to label your incoming SIP traffic. The following example shows a RELAY client listening for the “office” topic/context then runs the logic inside the event listener callback.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({
4 project: "your-project-id",
5 token: "your-api-token",
6 // This topic must match the topic you set in your Domain App handler.
7 topics: ["office"],
8});
9
10const voiceClient = client.voice;
11
12await voiceClient.listen({
13 topics: ["office"],
14 onCallReceived: async (call) => {
15 console.log("Call received:", call.id, call.from, call.to);
16
17 try {
18 await call.answer();
19 console.log("Inbound call answered");
20 await call.playTTS({ text: "Welcome to SignalWire!" });
21 } catch (error) {
22 console.error("Error answering inbound call", error);
23 }
24 },
25});

Find the many options for what you can do with RELAY in our RELAY Realtime SDK reference.

Video Room

You can immediately connect inbound SIP calls to a video room. To use the Video Room handler, search for the video room name in the settings dropdown and select the video room you would like to use. Inbound calls will be automatically directed to this video room.

For a full guide to creating and configuring new Domain Applications, visit our SIP Space help page.