Signalwire JS Answer Incoming Call

Hi All,

I have basic js that i’m running in python eel. Making outbound calls is working great. I can’t figure out what signalwire Resource(s) I need to setup so incoming calls route to my JS to be answered.

I started with the JS found here: unpkg.com/@signalwire/js@1.4.1/dist/index.min.js

Below is start of my app.js

// Using Signalwire JS 1.4.1 locally

// Global Variables
let client = null; // SignalWire Client
let currentCall = null; // Active Call
let projectId = “”; // SignalWire Project ID
let fromNumber = “”; // Caller ID (Your Phone Number)
let isMuted = false;
let isHeld = false;

async function initializeClient() {
await loadSettings();
const token = await fetchToken();

if (!token || !projectId) {
logMessage(“:cross_mark: [Frontend] Missing API token or Project ID. Cannot initialize client.”);
return;
}

logMessage(“:counterclockwise_arrows_button: [Frontend] Connecting to SignalWire…”);

let retries = 10;
while (typeof window.Relay === “undefined”) {
if (retries-- <= 0) {
logMessage(“:cross_mark: [Frontend] SignalWire SDK failed to load.”);
return;
}
logMessage(“:warning: [Frontend] Waiting for SignalWire SDK… Retrying in 3 seconds…”);
await new Promise(resolve => setTimeout(resolve, 3000));
}

logMessage(“:white_check_mark: [Frontend] SignalWire SDK Loaded!”);

client = new Relay({
project: projectId,
token: token
});

client.remoteElement = “remoteAudio”;
await client.connect();

logMessage(“:white_check_mark: [Frontend] Connected to SignalWire!”);
document.getElementById(“btnCall”).disabled = false;
}

No help? I’ve kind of given up, I think the v2 sdk is broken or the SWML has changed – I cannot get the JS app to answer an incoming call.