Showing error when registering webrtc client to asterisk

Hi,
I am trying to register a WebRTC client by configuring Asterisk as per the documentation: Configuring Asterisk for WebRTC Clients.

On the client side, I am using HTML and JavaScript to connect to the WebSocket server. Below is the client code:
const userAgent = new SIP.UA({
uri: “webrtc_client@{ip}”,
transportOptions: {
wsServers: [“wss://{ip}:8089/ws”],
},
authorizationUser: “webrtc_client”,
password: “webrtc_client”,
iceCheckingTimeout: 1000,
});

But showing error like
iostream.c:647 ast_iostream_start_tls: Problem setting up ssl connection: error:00000001:lib(0):func(0):reason(1), Internal SSL error
tcptls.c:179 handle_tcptls_connection: Unable to set up ssl connection with peer ‘115.248.81.241:21494’
iostream.c:552 ast_iostream_close: SSL_shutdown() failed: error:00000001:lib(0):func(0):reason(1), Internal SSL error

Could you please help me on this?

It could be a number of reasons, but firstly you cannot have a certificate for an IP address, so: wss://{ip}:8089/ws is not technically possible.

You would use something like wss://{server_name}:8089/ws and server_name would be a “common name” when you generated the certificate.

It is possible to make your browser accept a security exception when it detects the ip address mismatch, but only on the initial web page, not the websocket connection in the javascript. This means if you navigate to https://192.168.0.1 and accept the risk of the security message your web socket connection can only connect to wss://192.168.0.1/ws (because the browser has accepted the risk only of the one single certificate).

Here is a Dockerfile that demonstrates this: