L
L
lexbt2021-03-31 22:04:44
Asterisk
lexbt, 2021-03-31 22:04:44

How to set up asterisk + webrtc in docker?

Hello. No sound when talking between softphone and webrtc client if asterisk is deployed in docker. First I tried everything on a separate machine (centos) on the local network, and everything works. Maybe someone came across? Where to dig, rtp, firewall?
Asterisk configs:
http

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


rtp
[general]
rtpstart=10000
rtpend=10100
stunaddr=stun.l.google.com:19302
strictrtp=no
icesupport=yes


sip
[general]
udpbindaddr=172.17.0.2:5060
tcpbindaddr=172.17.0.2:5061
localnet=192.17.0.0/255.255.255.0
media_address=192.168.0.120 - IP машины в локальной сети на которой поднят докер, на ней же клиенты софтфон и webrtc
externip=192.168.0.120
transport=udp,tcp,ws
nat=force_rport,comedia
directmedia=no
icesupport=yes

[sip-softphone](!)
host=dynamic
type=friend
context=from-internal

[webrtc](!)
host=dynamic
type=friend
context=from-internal
avpf=yes
dtlsenable=yes
dtlsverify=no
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass
rtcp_mux=yes

[8000](sip-softphone) - софтфон на ПК
username=8000
secret=8000

[8001](webrtc) - клиент в браузере на этом же ПК
username=8001
secret=8001

[8002](sip-softphone) - софтфон на мобиле
username=8002
secret=8002


registered clients
8000/8000                 172.17.0.1                               D  Yes        Yes            57868    Unmonitored                                  
8001/8001                 172.17.0.1                               D  Yes        Yes            62210    Unmonitored                                  
8002/8002                 172.17.0.1                               D  Yes        Yes            57271    Unmonitored


when a debug call between softphones shows something like this
Sent RTP P2P packet to 172.17.0.1:62473 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:62473 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:60170 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:60170 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:60170 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:62473 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:62473 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:62473 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:60170 (type 00, len 000160)
Sent RTP P2P packet to 172.17.0.1:60170 (type 00, len 000160)


when between softphone and webrtc
Got  RTP packet from    172.17.0.1:56960 (type 00, seq 030790, ts 2058200046, len 000160)
Got  RTP packet from    172.17.0.1:56960 (type 00, seq 030791, ts 2058200206, len 000160)
Sent RTP packet to      61.176.2.13:33001 (via ICE) (type 00, seq 029385, ts 2058199880, len 000160)
Sent RTP packet to      61.176.2.13:33001 (via ICE) (type 00, seq 029386, ts 2058200040, len 000160)

61.176.2.13 - ip external (not white)

when calling docker I send
-p 5060:5060/udp 
-p 5061:5061/tcp 
-p 10000-10100:10000-10100/udp 
-p 8088:8088/tcp

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Soslan Aldatov, 2021-03-31
@sptm

I would try disabling STUN so that Asterisk doesn't try to send something to the external IP address.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question