  console.log("Twilio.Device is ready.");
          document.getElementById("status").textContent = "Ready";
        });

        device.on("error", (error) => {
          console.error("Twilio.Device error:", error.message);
          document.getElementById("status").textContent =
            "Error: " + error.message;
        });

        device.on("disconnect", () => {
          console.log("Call ended.");
          document.getElementById("status").textContent = "Disconnected";
          document.getEl