First steps with WebRTC

Hello,
I’m trying to set up my first WebRTC client (sipml5).
I followed the instructions, my Asterisk test lab is working with PJSIP and softphone on my local network.
So there is my config :

http.conf :

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
tlsenable=yes
tlsbindaddr=0.0.0.0:8089
tlscertfile=/etc/asterisk/keys/asterisk.crt
tlsprivatekey=/etc/asterisk/keys/asterisk.key

pjsip.conf :

[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0:8089
local_net = 192.168.1.1/32
external_media_address = 82.65.147.120
external_signaling_address = 82.65.147.120
allow_reload=yes

endpoint / auth / aor :

; Declaration
[1067]

type=auth
auth_type=userpass
; Mot de passe
password=xxxxxxxxxxxxx
; User declaration
username=1067

; Affectation
[1067]

type=endpoint
trust_id_inbound=yes
rtp_keepalive=1
webrtc=yes
transport=transport-wss
dtls_auto_generate_cer=yes
; Authentification
auth=1067
; aors
aors=1067
; Contexte
context=Streamer
message_context = instant-message
disallow=all
allow=g722
allow=ulaw
allow=alaw
call_group=1
pickup_group=1
rewrite_contact = yes
direct_media = no
force_rport = yes
rtp_symmetric = yes
; CallerID
callerid=0033743358246


; Assignation
[1067]

type=aor
max_contacts=10

I generated a self-signed certificate for my local IP with :

contrib/scripts/ast_tls_cert -C 192.168.1.60 -O "test" -b 2048 -d /etc/asterisk/keys

I installed sipml5 on the server , and when I try to follow the tutorial :
https://wiki.asterisk.org/wiki/display/AST/WebRTC+tutorial+using+SIPML5
I get this error in the CLI :

[Nov  5 21:43:51] ERROR[4256]: iostream.c:647 ast_iostream_start_tls: Problem setting up ssl connection: error:00000001:lib(0):func(0):reason(1), Internal SSL error
[Nov  5 21:43:51] ERROR[4256]: tcptls.c:179 handle_tcptls_connection: Unable to set up ssl connection with peer '192.168.1.50:64498'
[Nov  5 21:43:51] ERROR[4256]: iostream.c:552 ast_iostream_close: SSL_shutdown() failed: error:00000001:lib(0):func(0):reason(1), Internal SSL error

Am I doing something wrong ?
Thanks :slight_smile:

That’s obviously wrong, although, unless you are accessing something on the real local net, probably doesn’t matter. Oops you are!

On the other hand, I thought the whole of the directly attached networks were inferred as local.

Yes I am working only on my local network with a debian VM for the webRTC test lab.
But I don’t think it’s a network problem, the error message is about SSL

So I decided to use a subdomain and a DigiCert certificate.
But I have another issue now. Calls are working well, but with horrible quality and a delay of 1 minute on the call initiation.

Here is what I get in the CLI :

[Nov  6 12:21:19] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:20] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream
[Nov  6 12:21:21] ERROR[6197][C-00000001]: codec_opus.c:503 opus_samples_count: Opus: Unable to parse packet for number of samples: corrupted stream

I use asterisk 16.22.0 and codec_opus.

There are my files again (i followed the tutorial step by step) :

endpoint :

[1067]
type=aor
max_contacts=5
remove_existing=yes
  
[1067]
type=auth
auth_type=userpass
username=1067
password=xxxxxxx
 
[1067]
type=endpoint
aors=1067
auth=1067
dtls_auto_generate_cert=yes
webrtc=yes
context=Streamer
disallow=all
allow=opus,ulaw
callerid=0033674114870

transport :

[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0

I’m going to leave this for someone who is current and experienced on WebRTC. However, from what I’ve heard, that tutorial may be doing you a disservice by suggesting that you can succeed by just using three year old step by step guides.

Thanks for trying to help me
Will search for other guides. Anyone have idea about the error ?

Tried another webRTC phone and it works. But the audio is not exploitable on the phone, we hear “pppppppppp”. On the browser it’s working. If I call another extension (g722 codecà, it works perfectly.

Here are the RTP logs :

Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000230, ts 036800, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003309, ts 2450018680, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001502, ts 948686872, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001502, ts 948686872, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033481, ts 066112, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033482, ts 066112, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001503, ts 948687032, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001503, ts 948687032, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033483, ts 066272, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033484, ts 066272, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000231, ts 036960, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003310, ts 2450018840, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000232, ts 037120, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003311, ts 2450019000, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001504, ts 948687192, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001504, ts 948687192, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033485, ts 066432, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033486, ts 066432, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001505, ts 948687352, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001505, ts 948687352, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033487, ts 066592, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033488, ts 066592, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000233, ts 037280, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003312, ts 2450019160, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000234, ts 037440, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003313, ts 2450019320, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001506, ts 948687512, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001506, ts 948687512, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033489, ts 066752, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033490, ts 066752, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001507, ts 948687672, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001507, ts 948687672, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033491, ts 066912, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033492, ts 066912, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000235, ts 037600, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003314, ts 2450019480, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000236, ts 037760, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003315, ts 2450019640, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001508, ts 948687832, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001508, ts 948687832, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033493, ts 067072, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033494, ts 067072, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001509, ts 948687992, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001509, ts 948687992, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033495, ts 067232, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033496, ts 067232, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000237, ts 037920, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003316, ts 2450019800, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000238, ts 038080, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003317, ts 2450019960, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001510, ts 948688152, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001510, ts 948688152, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033497, ts 067392, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033498, ts 067392, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001511, ts 948688312, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001511, ts 948688312, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033499, ts 067552, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033500, ts 067552, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000239, ts 038240, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003318, ts 2450020120, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000240, ts 038400, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003319, ts 2450020280, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001512, ts 948688472, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001512, ts 948688472, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033501, ts 067712, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033502, ts 067712, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001513, ts 948688632, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001513, ts 948688632, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033503, ts 067872, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033504, ts 067872, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000241, ts 038560, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003320, ts 2450020440, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000242, ts 038720, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003321, ts 2450020600, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001514, ts 948688792, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001514, ts 948688792, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033505, ts 068032, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033506, ts 068032, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000243, ts 038880, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003322, ts 2450020760, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001515, ts 948688952, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001515, ts 948688952, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033507, ts 068192, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033508, ts 068192, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001516, ts 948689112, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001516, ts 948689112, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033509, ts 068352, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033510, ts 068352, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000244, ts 039040, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003323, ts 2450020920, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000245, ts 039200, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003324, ts 2450021080, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001517, ts 948689272, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001517, ts 948689272, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033511, ts 068512, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033512, ts 068512, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001518, ts 948689432, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001518, ts 948689432, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033513, ts 068672, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033514, ts 068672, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000246, ts 039360, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003325, ts 2450021240, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000247, ts 039520, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003326, ts 2450021400, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001519, ts 948689592, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001519, ts 948689592, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033515, ts 068832, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033516, ts 068832, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001520, ts 948689752, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001520, ts 948689752, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033517, ts 068992, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033518, ts 068992, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000248, ts 039680, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003327, ts 2450021560, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000249, ts 039840, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003328, ts 2450021720, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001521, ts 948689912, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001521, ts 948689912, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033519, ts 069152, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033520, ts 069152, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001522, ts 948690072, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001522, ts 948690072, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033521, ts 069312, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033522, ts 069312, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000250, ts 040000, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003329, ts 2450021880, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001523, ts 948690232, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001523, ts 948690232, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033523, ts 069472, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033524, ts 069472, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000251, ts 040160, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003330, ts 2450022040, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001524, ts 948690392, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001524, ts 948690392, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033525, ts 069632, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033526, ts 069632, len 000170)
Got  RTP packet from    208.100.60.34:19062 (type 00, seq 000252, ts 040320, len 000160)
Sent RTP packet to      192.168.1.50:58314 (via ICE) (type 09, seq 003331, ts 2450022200, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001525, ts 948690552, len 000170)
Got  RTP packet from    192.168.1.50:58314 (type 09, seq 001525, ts 948690552, len 000170)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033527, ts 069792, len 000160)
Sent RTP packet to      208.100.60.34:19062 (type 00, seq 033528, ts 069792, len 000170)

Are you using your own STUN/TURN server? Have you tried TURN?

We built a pretty great WebRTC solution last year and ICE was the #1 thing that got in our way. Implementing our own STUN/TURN servers solved a lot of problems.

Also we’re running Asterisk 18 and using JsSip.

Thanks for your reply.
I installed ctxSIP , it works fine but it takes a lot of time to answer in Chrome/Brave browser.
The app is out to date too, i’m looking for a SIP client right now.

@bkervaski
How did you install your STUN/TURN server ? On a VPS over the Internet, right ?
Did you use coturn or something different ?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.