WebRTC and error Serious Network Trouble

Hi. We are testing Jssip API with WebRTC and we have completly sucedeed with version 2.x and Asterisk 13.11.2. However we are trying new version of the API 3.x we are having some trouble when Asterisk has to send asynchronous SIP frames, for example, when sending an incoming call.

The error that appears in the CLI console is:

Really destroying SIP dialog ‘24188e5872f3b45034c618704a6eb7da@127.0.0.1:5060’ Method: INVITE
Really destroying SIP dialog ‘2cc2623d06a6cdbb523f4265799d8b9a@127.0.0.1:5060’ Method: INVITE
== DTLS ECDH initialized (secp256r1), faster PFS enabled
== Using SIP RTP CoS mark 5
Audio is at 10438
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 192.168.1.33:39466:
INVITE sip:76ejsbo0@o4di2ag4slb3.invalid;transport=ws SIP/2.0
Via: SIP/2.0/WS 192.168.3.178:5060;branch=z9hG4bK37e36339;rport
Max-Forwards: 70
From: “30000” sip:30000@192.168.3.178;tag=as0d3f1014
To: sip:76ejsbo0@o4di2ag4slb3.invalid;transport=ws
Contact: sip:30000@192.168.3.178:5060;transport=WS
Call-ID: 679d8e7d797430666c0ff8f6287676e3@192.168.3.178:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.11.2
Date: Thu, 04 May 2017 16:10:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
X-idllamada: 1493914233.1430
X-telefono: 100
Content-Type: application/sdp
Content-Length: 877

v=0
o=root 1861146601 1861146601 IN IP4 192.168.3.178
s=Asterisk PBX 13.11.2
c=IN IP4 192.168.3.178
t=0 0
m=audio 10438 RTP/SAVPF 8 3 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=ice-ufrag:3c170104446900d7450819506e839546
a=ice-pwd:0ccfa87b0640dd0b34dd0621270628a3
a=candidate:Hc0a803b2 1 UDP 2130706431 192.168.3.178 10438 typ host
a=candidate:S512fa4ad 1 UDP 1694498815 81.47.164.173 53867 typ srflx raddr 192.168.3.178 rport 10438
a=candidate:Hc0a803b2 2 UDP 2130706430 192.168.3.178 10439 typ host
a=candidate:S512fa4ad 2 UDP 1694498814 81.47.164.173 39511 typ srflx raddr 192.168.3.178 rport 10439
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 E1:9D:D7:9B:C6:2D:7C:53:76:87:38:07:8E:D0:7C:B2:85:EC:38:89:BB:90:08:48:4F:CE:B9:DE:F9:2C:BC:E0
a=sendrecv


[May 4 18:10:38] ERROR[30462][C-000000c2]: chan_sip.c:4258 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data
– Called SIP/20005
== DTLS ECDH initialized (secp256r1), faster PFS enabled
== Using SIP RTP CoS mark 5
Really destroying SIP dialog ‘52473985563621bb540e909405e633eb@127.0.0.1:5060’ Method: INVITE
Really destroying SIP dialog ‘5491191d28ac9bb94f1c45cd7eeca5ad@127.0.0.1:5060’ Method: INVITE
Really destroying SIP dialog ‘70e1ffd336602c3568b75cce3cc15cfd@127.0.0.1:5060’ Method: INVITE
Really destroying SIP dialog ‘3b5597f0673db49c4f6900d55836b73c@127.0.0.1:5060’ Method: INVITE

If we try from javascript console to send any SIP message it arrives correctly to Asterisk, you can even unregister with no problem at all.

Please ask me for any log trace or config if necessary.

Thank you very much in advance.

EDIT:

Here’s sip config:

sip.conf
[general]

port=1661
transport=udp,ws,wss
websocket_enabled=true
tcpbindaddr=0.0.0.0
tcpenable=no
udpbindaddr=0.0.0.0
jbenable=yes
jbimpl=adaptive

#include sip_operador_plantilla.conf
#include sip_operador_extensiones.conf

sip_operador_plantilla.conf
[operadora](!)
type=peer
host=dynamic
context=operadoras_salida_general
nat=force_rport,comedia
udpbindaddr=0.0.0.0
type=peer
host=dynamic
disallow=all
allow=gsm
allow=alaw
allow=ulaw
requirecalltoken=no
transport=ws,wss,udp,tcp,tls
dtlsenable=yes
dtlsverify=no
dtlscertfile=/etc/asterisk/keys/2016-2017/commercial.crt
dtlscafile=/etc/asterisk/keys/2016-2017/commercial_ca.crt
dtlsprivatekey=/etc/asterisk/keys/2016-2017/commercial.key
dtlssetup=actpass
avpf=yes
icesupport=yes
directmedia=no
encryption=yes
force_avp=yes

sip_operador_extensiones.conf
[20005](operadora)
username=Nombre Apellidos<20005>
secret=password

Hello,
I also have the same problem … I will comment if I find something, Although for the moment… :frowning:
Regards

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: https://goo.gl/Y0ZkNV ).

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