WebRTC and error Serious Network Trouble

hi alvaro.gutierrez

i have same problem in this post.

i am use sipjs library and this guide

I feel that this problem arises because of https

when we use WebRTC and the html page load from web, we have to use https (see: Prefer Secure Origins For Powerful New Features ).

when we use https, we have to use wss.

i configure my asterisk (http.conf) wss service like below.
the pem file contain valid ssl cetificate (CERTIFICATE and PRIVATE KEY) that used in mydomain.com web site that contain html and sipjs.js files.
my asterisk service and web service installed in a one server with one ip .

[general]
enabled=yes
bindaddr=185.8.173.206
bindport=8088
tlsenable=yes
tlsbindaddr= 185.8.173.206:8089
tlscertfile=/etc/asterisk/conf/asterisk.pem
tlsprivatekey=/etc/asterisk/conf/asterisk.pem

my sip.conf

[general]
realm=185.8.173.206 ; Replace this with your IP address
udpbindaddr=185.8.173.206 ; Replace this with your IP address
bindaddr=185.8.173.206
transport=tcp,udp,ws,wss

[1010] ; This will be WebRTC client
type=friend
username=1010 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=tcp,udp,ws,wss ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/conf/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/conf/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
[1060] ; This will be WebRTC client
type=friend
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=tcp,udp,ws,wss ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/conf/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/conf/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS

i use same pem file in http.conf and sip.conf.

my java script sipjs.js config when page loaded from web.

var uaURI = “sip:1010@mydomain”,
config = {
userAgentString: “web.mydomain”,
traceSip: !0,
rtcpMuxPolicy: “negotiate”,
register: !1,
displayName: “1060”,
uri: “sip:1060@mydomain”,
authorizationUser: “1060”,
password: “password”,
wsServers: “wss://mydomain:8089/ws”,
hackIpInContact: !0
};

how do you get or create the certificate file?
is this the certificate file is valid?
is this the html file loaded from web or load from pc?

I feel that this problem arises because of certificate file in https and wss