Webrtc errors and no audio established

Hi

I am using Asterisk 14.2.1 to run webrtc example provided in https://wiki.asterisk.org/wiki/display/AST/WebRTC+tutorial+using+SIPML5

I am able to connect to SIPML from asterisk server. But there is the following error seen on console when i try to generate a .call outbound call from Asterisk

[May 23 15:50:58] ERROR[29341]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo(“df7jal23ls0d.invalid”, “(null)”, …): Name or service not known
[May 23 15:50:58] WARNING[29341]: chan_sip.c:16667 __set_address_from_contact: Invalid host name in Contact: (can’t resolve in DNS) : ‘df7jal23ls0d.invalid’
[May 23 15:50:58] ERROR[29341]: netsock2.c:98 ast_sockaddr_stringify_fmt: getnameinfo(): ai_family not supported

Also when i try to generate a call towards asterisk I see “Media Stream permission denied” shown on Chrome.

Please help me resolve this

Look at doubango forums for that common error

You have not permitted the usage of the audio device, usually you see a popup asking to use the hardware, or either you are using self certificates(invalid ssl)

To elaborate this further. Please see below asterisk configurations

sip.conf

[general]
udpbindaddr=0.0.0.0:5060
realm=192.168.0.180 ;replace with your Asterisk server public IP address or host
transport=udp,ws,wss
; realm=202.65.140.19
; externip=202.65.140.19
videosupport=yes
srvlookup=yes

[6001]
type=friend
host=dynamic
username=6001
secret=password
context=from-internal
encryption=yes
srtpcapable=yes
avpf=yes
force_avp=yes
icesupport=yes
directmedia=no
allow=all
allow=ulaw
allow=gsm
dtlsenable=yes
dtlsverify=yes
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtls_setup=actpass
rtcp_mux=yes

http.conf

[general]
enabled=yes
bindaddr=192.168.0.180
bindport=8088

rtp.conf

[general]
rtpstart=10000
rtpend=20000
icesupport=yes
stunaddr:19302=stun.l.google.com

Installed the certificate as per https://wiki.asterisk.org/wiki/display/AST/Secure+Calling+Tutorial.

Running the sipml5 test using http and not https

Error seen on console when i try to create a outbound call

-- Called 6001
-- SIP/6001-00000019 is ringing
-- SIP/6001-00000019 answered
-- Executing [10@from-outbound:1] NoOp("SIP/6001-00000019", ""From outbound"") in new stack
-- Executing [10@from-outbound:2] WaitExten("SIP/6001-00000019", "10") in new stack
-- Executing [5@from-outbound:1] NoOp("SIP/6001-00000019", ""Input received from user as: "5") in new stack
-- Executing [5@from-outbound:2] SayDigits("SIP/6001-00000019", "5") in new stack
-- <SIP/6001-00000019> Playing 'digits/5.gsm' (language 'en')

[May 24 14:43:46] ERROR[18002][C-0000001a]: res_rtp_asterisk.c:2218 __rtp_recvfrom: DTLS failure occurred on RTP instance ‘0xb4626cc4’ due to reason ‘certificate verify failed’, terminating
[May 24 14:43:46] WARNING[18002][C-0000001a]: res_rtp_asterisk.c:4464 ast_rtp_read: RTP Read error: Unspecified. Hanging up.
== Spawn extension (from-outbound, 5, 2) exited non-zero on ‘SIP/6001-00000019’

Audio is enabled at browser end. But not able to hear to any audio files

Please help

You are either suffering a man in the middle attack, or you do not have a valid certificate path to a known root certificate.

Installed the mentioned ca.crt on firefox. Anything else needs to be done? SIPML5 is running on Firefox

When it comes to WebRTC you have to learn and gain this knowledge, you can’t depend on help like this for ever as it is complex and deploying it is not easy.

1 Like

Just a heads up and someone can correct me if I am wrong, but I don’t think browsers (at least Chromium and Firefox) allow insecure websocket connections anymore, so you’ll also need to set up the tls bindings in Asterisk http.conf (note example config only below):

tlsenable=yes
tlsbindaddr=0.0.0.0:8089
tlscertfile=<path to your cert>/asterisk.pem
tlsprivatekey=<path to your key>/asterisk.pem

Then you’ll also need to point your sipml5 “WebSocket Server URL” found on the expert settings page to that port and give it the correct scheme:

wss://<your ip/host>:8089/ws
1 Like

Thanks, now i could see the call being received on Browser. But still no RTP seen, Audio and Video is failing.

See below updated sip.conf, http.conf, rtp.conf.

http.conf

[general]
enabled=yes
bindaddr=192.168.0.180
bindport=8088
tlsenable=yes ; enable tls - default no.
tlsbindaddr=0.0.0.0:8089 ; address and port to bind to - default is bindaddr and port 8089.
;
tlscertfile=/etc/asterisk/keys/asterisk.pem ; path to the certificate file (.pem) only.
tlsprivatekey=/etc/asterisk/keys/asterisk.pem ; path to private key file (
.pem) only.

sip.conf

[general]
udpbindaddr=0.0.0.0:5060
realm=192.168.0.180 ;replace with your Asterisk server public IP address or host
transport=udp,ws,wss
; realm=202.65.140.19
; externip=202.65.140.19
videosupport=yes

srvlookup=yes

[6001]
type=friend
host=dynamic
username=6001
secret=password
context=from-internal
encryption=yes
srtpcapable=yes
avpf=yes
force_avp=yes
icesupport=yes
directmedia=yes
allow=all
allow=ulaw
allow=gsm
; allow=h263
dtlsenable=yes
dtlsverify=yes
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtls_setup=actpass
rtcp_mux=yes

rtp.conf

[general]
rtpstart=10000
rtpend=20000
icesupport=yes
stunaddr:19302=stun.l.google.com

Console output

-- Attempting call on SIP/6001 for 10@from-outbound:1 (Retry 1)

== DTLS ECDH initialized (secp256r1), faster PFS enabled
== DTLS ECDH initialized (secp256r1), faster PFS enabled
== Using SIP VIDEO CoS mark 6
== Using SIP RTP CoS mark 5
[May 25 09:49:06] ERROR[29852]: netsock2.c:305 ast_sockaddr_resolve: getaddrinfo(“df7jal23ls0d.invalid”, “(null)”, …): Name or service not known
[May 25 09:49:06] WARNING[29852]: chan_sip.c:16667 __set_address_from_contact: Invalid host name in Contact: (can’t resolve in DNS) : ‘df7jal23ls0d.invalid’
[May 25 09:49:06] ERROR[29852]: netsock2.c:98 ast_sockaddr_stringify_fmt: getnameinfo(): ai_family not supported
– Called 6001
– SIP/6001-00000024 is ringing
– SIP/6001-00000024 answered
– Executing [10@from-outbound:1] NoOp(“SIP/6001-00000024”, ““From outbound””) in new stack
– Executing [10@from-outbound:2] WaitExten(“SIP/6001-00000024”, “10”) in new stack
– Executing [7@from-outbound:1] NoOp(“SIP/6001-00000024”, ""Input received from user as: “7”) in new stack
– Executing [7@from-outbound:2] SayDigits(“SIP/6001-00000024”, “7”) in new stack
– <SIP/6001-00000024> Playing ‘digits/7.gsm’ (language ‘en’)
[May 25 09:49:24] ERROR[29913][C-00000024]: res_rtp_asterisk.c:2218 __rtp_recvfrom: DTLS failure occurred on RTP instance ‘0x989db7c’ due to reason ‘certificate verify failed’, terminating
[May 25 09:49:24] WARNING[29913][C-00000024]: res_rtp_asterisk.c:4464 ast_rtp_read: RTP Read error: Unspecified. Hanging up.
== Spawn extension (from-outbound, 7, 2) exited non-zero on ‘SIP/6001-00000024’

Another observation in addition to the above

When i try to open URL: https://192.168.0.180:8089/ws i see below mentioned string displayed on screen

Upgrade Required

Asterisk/14.2.1