[asterisk-bugs] [JIRA] (ASTERISK-26544) Delay in DTLS handshake causes audio setup delay

Rusty Newton (JIRA) noreply at issues.asterisk.org
Tue Nov 1 13:38:09 CDT 2016


     [ https://issues.asterisk.org/jira/browse/ASTERISK-26544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rusty Newton updated ASTERISK-26544:
------------------------------------

    Description: 
Hello,

It seems that there is a delay in the audio setup when using WebRTC with latest Asterisk versions and latest browser versions (described in the Environment section).

Sometimes there is no delay, but most of the time the delay goes between 1 second to a couple of minutes. 

This seems to be related to a delay in the DTLS connection handshake between Asterisk and the browser (although this is just a guess after trying to isolate the issue).

sip.conf
{code}
[100]
nat=force_rport,comedia
host=dynamic
type=friend
secret=secret
disallow=all
allow=g722
icesupport=yes
transport=wss
dtlsenable=yes
dtlsverify=no
dtlscertfile=/cert.crt
dtlsprivatekey=/cert.key
dtlssetup=actpass
videosupport=no
encryption=yes
avpf=yes
force_avp=yes
directmedia=no
canreinvite=no
context=wrtc
{code}

extensions.conf
{code}
[wrtc]
exten => _X.,1,Answer
same => n,Playback(tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys)
same => n,Hangup
{code}

rtp.conf
{code}
[general]
rtpstart=6000
rtpend=65535
icesupport=true
[ice_host_candidates]
x.x.x.x => y.y.y.y ; x.x.x.x is the internal IP, y.y.y.y is the external IP
{code}

[Edit by Rusty - removed excessive debug in description field as per issue tracker guidelines. Moving to attachment.]

FireFox shows this in its logs:
{code}
276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:612: GetAudioFrame 
276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:716: GetAudioFrame GetAudioFrame:Got samples: length 320 
{code}

But no audio is played until some (random) number of seconds pass, and this logs shows up:
{code}
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: PacketReceived(2001)
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: Checking digest, algorithm=sha-256
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[ice]:  SendPacket(75) succeeded
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ****** SSL handshake completed ******
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ALPN not negotiated, selecting default
261443584[7f89265334a0]: /builds/slave/m-rel-m64-00000000000000000000/build/src/media/mtransport/transportlayerdtls.cpp:865: Flow[568ce410feebc53d:0,rtp(none)]; 
{code}

EDIT: I forgot to mention that looking at the output from chrome://webrtc-internals, I noticed that during the delay the browser is stalled at ICEConnectionStateChecking. As soon as the audio is connected, it goes to ICEConnectionStateConnected.
 
Without changing any browser or network settings whatsoever either in the Asterisk Box or the browser's box, sometimes it just works. But most of the time the delay is present.

With FreeSWITCH (cec0cb39830546a3a1c1df7ad7a05b05f14b8975 - Fri Oct 28 15:38:25 2016 -0500) works perfectly, every single time.

Any help is greatly appreciated!

Thank you.

Best regards,

  was:
Hello,

It seems that there is a delay in the audio setup when using WebRTC with latest Asterisk versions and latest browser versions (described in the Environment section).

Sometimes there is no delay, but most of the time the delay goes between 1 second to a couple of minutes. 

This seems to be related to a delay in the DTLS connection handshake between Asterisk and the browser (although this is just a guess after trying to isolate the issue).

sip.conf
{code}
[100]
nat=force_rport,comedia
host=dynamic
type=friend
secret=secret
disallow=all
allow=g722
icesupport=yes
transport=wss
dtlsenable=yes
dtlsverify=no
dtlscertfile=/cert.crt
dtlsprivatekey=/cert.key
dtlssetup=actpass
videosupport=no
encryption=yes
avpf=yes
force_avp=yes
directmedia=no
canreinvite=no
context=wrtc
{code}

extensions.conf
{code}
[wrtc]
exten => _X.,1,Answer
same => n,Playback(tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys)
same => n,Hangup
{code}

rtp.conf
{code}
[general]
rtpstart=6000
rtpend=65535
icesupport=true
[ice_host_candidates]
x.x.x.x => y.y.y.y ; x.x.x.x is the internal IP, y.y.y.y is the external IP
{code}

{code}
<--- SIP read from WS:BROWSER-EXTERNAL-IP:57667 --->
INVITE sip:123456 at WEBRTC-FQDN SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKEwnJD94ZuargVyxGymxlcyBIreeXDvTf;rport
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>
Contact: "100"<sips:100 at df7jal23ls0d.invalid;rtcweb-breaker=yes;click2call=no;transport=wss>;impi=100;ha1=e18a080ecd528487deae793cb4eaa28d;+g.oma.sip-im;language="en,fr"
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31996 INVITE
Content-Type: application/sdp
Content-Length: 2550
Max-Forwards: 70
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

v=0
o=- 721192063149443000 2 IN IP4 127.0.0.1
s=Doubango Telecom - chrome
t=0 0
a=group:BUNDLE audio
a=msid-semantic: WMS AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk
m=audio 52335 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
c=IN IP4 BROWSER-EXTERNAL-IP
a=rtcp:60108 IN IP4 BROWSER-EXTERNAL-IP
a=candidate:2772985396 1 udp 2122265343 BROWSER-INTERNAL-IPv6 64179 typ host generation 0 network-id 2 network-cost 50
a=candidate:430735571 1 udp 2122194687 BROWSER-INTERNAL-IP 52335 typ host generation 0 network-id 1 network-cost 10
a=candidate:2772985396 2 udp 2122265342 BROWSER-INTERNAL-IPv6 52336 typ host generation 0 network-id 2 network-cost 50
a=candidate:430735571 2 udp 2122194686 BROWSER-INTERNAL-IP 60108 typ host generation 0 network-id 1 network-cost 10
a=candidate:3955989188 1 tcp 1518285567 BROWSER-INTERNAL-IPv6 9 typ host tcptype active generation 0 network-id 2 network-cost 50
a=candidate:1462729763 1 tcp 1518214911 BROWSER-INTERNAL-IP 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:3955989188 2 tcp 1518285566 BROWSER-INTERNAL-IPv6 9 typ host tcptype active generation 0 network-id 2 network-cost 50
a=candidate:1462729763 2 tcp 1518214910 BROWSER-INTERNAL-IP 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:2565113447 1 udp 1685987071 BROWSER-EXTERNAL-IP 52335 typ srflx raddr BROWSER-INTERNAL-IP rport 52335 generation 0 network-id 1 network-cost 10
a=candidate:2565113447 2 udp 1685987070 BROWSER-EXTERNAL-IP 60108 typ srflx raddr BROWSER-INTERNAL-IP rport 60108 generation 0 network-id 1 network-cost 10
a=ice-ufrag:Cd81
a=ice-pwd:awZyRbaK+C6JjzrNKY0eNTk8
a=fingerprint:sha-256 EA:7E:95:E2:50:52:7C:A7:A2:DA:D4:6D:8F:30:BD:5A:C6:A0:56:DC:3E:7B:ED:37:59:94:9B:DD:2E:4D:2B:8B
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=ssrc:3291094471 cname:43c4bgpLbedB78m/
a=ssrc:3291094471 msid:AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk ce18a2c5-5612-4176-bee2-b9590533bb50
a=ssrc:3291094471 mslabel:AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk
a=ssrc:3291094471 label:ce18a2c5-5612-4176-bee2-b9590533bb50
<------------->
--- (12 headers 44 lines) ---
Using INVITE request as basis request - 672fae6f-99fd-de1c-0347-fd15e703483c
Found peer '100' for '100' from BROWSER-EXTERNAL-IP:57667

<--- Reliably Transmitting (NAT) to BROWSER-EXTERNAL-IP:57667 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKEwnJD94ZuargVyxGymxlcyBIreeXDvTf;received=BROWSER-EXTERNAL-IP;rport=57667
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>;tag=as0fe40e33
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31996 INVITE
Server: Asterisk PBX 14.1.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="23bf6e73"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '672fae6f-99fd-de1c-0347-fd15e703483c' in 32000 ms (Method: INVITE)

<--- SIP read from WS:BROWSER-EXTERNAL-IP:57667 --->
ACK sip:123456 at WEBRTC-FQDN SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKEwnJD94ZuargVyxGymxlcyBIreeXDvTf;rport
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>;tag=as0fe40e33
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31996 ACK
Content-Length: 0
Max-Forwards: 70

<------------->
--- (8 headers 0 lines) ---

<--- SIP read from WS:BROWSER-EXTERNAL-IP:57667 --->
INVITE sip:123456 at WEBRTC-FQDN SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKXO1rg8w6ZgHQTmzbguUbIwgTaIV6zLrV;rport
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>
Contact: "100"<sips:100 at df7jal23ls0d.invalid;rtcweb-breaker=yes;click2call=no;transport=wss>;impi=100;ha1=e18a080ecd528487deae793cb4eaa28d;+g.oma.sip-im;language="en,fr"
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31997 INVITE
Content-Type: application/sdp
Content-Length: 2550
Max-Forwards: 70
Authorization: Digest username="100",realm="asterisk",nonce="23bf6e73",uri="sip:123456 at WEBRTC-FQDN",response="63b58112d226aa95421aa24f12048d1c",algorithm=MD5
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

v=0
o=- 721192063149443000 2 IN IP4 127.0.0.1
s=Doubango Telecom - chrome
t=0 0
a=group:BUNDLE audio
a=msid-semantic: WMS AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk
m=audio 52335 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126
c=IN IP4 BROWSER-EXTERNAL-IP
a=rtcp:60108 IN IP4 BROWSER-EXTERNAL-IP
a=candidate:2772985396 1 udp 2122265343 BROWSER-INTERNAL-IPv6 64179 typ host generation 0 network-id 2 network-cost 50
a=candidate:430735571 1 udp 2122194687 BROWSER-INTERNAL-IP 52335 typ host generation 0 network-id 1 network-cost 10
a=candidate:2772985396 2 udp 2122265342 BROWSER-INTERNAL-IPv6 52336 typ host generation 0 network-id 2 network-cost 50
a=candidate:430735571 2 udp 2122194686 BROWSER-INTERNAL-IP 60108 typ host generation 0 network-id 1 network-cost 10
a=candidate:3955989188 1 tcp 1518285567 BROWSER-INTERNAL-IPv6 9 typ host tcptype active generation 0 network-id 2 network-cost 50
a=candidate:1462729763 1 tcp 1518214911 BROWSER-INTERNAL-IP 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:3955989188 2 tcp 1518285566 BROWSER-INTERNAL-IPv6 9 typ host tcptype active generation 0 network-id 2 network-cost 50
a=candidate:1462729763 2 tcp 1518214910 BROWSER-INTERNAL-IP 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:2565113447 1 udp 1685987071 BROWSER-EXTERNAL-IP 52335 typ srflx raddr BROWSER-INTERNAL-IP rport 52335 generation 0 network-id 1 network-cost 10
a=candidate:2565113447 2 udp 1685987070 BROWSER-EXTERNAL-IP 60108 typ srflx raddr BROWSER-INTERNAL-IP rport 60108 generation 0 network-id 1 network-cost 10
a=ice-ufrag:Cd81
a=ice-pwd:awZyRbaK+C6JjzrNKY0eNTk8
a=fingerprint:sha-256 EA:7E:95:E2:50:52:7C:A7:A2:DA:D4:6D:8F:30:BD:5A:C6:A0:56:DC:3E:7B:ED:37:59:94:9B:DD:2E:4D:2B:8B
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=ssrc:3291094471 cname:43c4bgpLbedB78m/
a=ssrc:3291094471 msid:AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk ce18a2c5-5612-4176-bee2-b9590533bb50
a=ssrc:3291094471 mslabel:AggXYiBL3BB5upWZUJP1vuubyWvp2VBdpAFk
a=ssrc:3291094471 label:ce18a2c5-5612-4176-bee2-b9590533bb50
<------------->
--- (13 headers 44 lines) ---
Using INVITE request as basis request - 672fae6f-99fd-de1c-0347-fd15e703483c
Found peer '100' for '100' from BROWSER-EXTERNAL-IP:57667
  == DTLS ECDH initialized (automatic), faster PFS enabled
  == Using SIP RTP CoS mark 5
Found RTP audio format 111
Found RTP audio format 103
Found RTP audio format 104
Found RTP audio format 9
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 106
Found RTP audio format 105
Found RTP audio format 13
Found RTP audio format 126
Found audio description format opus for ID 111
Found unknown media description format ISAC for ID 103
Found unknown media description format ISAC for ID 104
Found audio description format G722 for ID 9
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found unknown media description format CN for ID 106
Found unknown media description format CN for ID 105
Found audio description format CN for ID 13
Found audio description format telephone-event for ID 126
Capabilities: us - (g722), peer - audio=(ulaw|alaw|g722|opus)/video=(nothing)/text=(nothing), combined - (g722)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x3 (telephone-event|CN|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port BROWSER-EXTERNAL-IP:52335
Looking for 123456 in wrtc (domain WEBRTC-FQDN)
sip_route_dump: route/path hop: <sips:100 at df7jal23ls0d.invalid;rtcweb-breaker=yes;click2call=no;transport=wss>

<--- Transmitting (NAT) to BROWSER-EXTERNAL-IP:57667 --->
SIP/2.0 100 Trying
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKXO1rg8w6ZgHQTmzbguUbIwgTaIV6zLrV;received=BROWSER-EXTERNAL-IP;rport=57667
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31997 INVITE
Server: Asterisk PBX 14.1.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:123456 at ASTERISK-INTERNAL-IP:5060;transport=WS>
Content-Length: 0


<------------>
    -- Executing [123456 at wrtc:1] Answer("SIP/100-00000001", "") in new stack
Audio is at 52848
Adding codec g722 to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (NAT) to BROWSER-EXTERNAL-IP:57667 --->
SIP/2.0 200 OK
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKXO1rg8w6ZgHQTmzbguUbIwgTaIV6zLrV;received=BROWSER-EXTERNAL-IP;rport=57667
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>;tag=as2984a23e
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31997 INVITE
Server: Asterisk PBX 14.1.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:123456 at ASTERISK-INTERNAL-IP:5060;transport=WS>
Content-Type: application/sdp
Content-Length: 624

v=0
o=root 656480106 656480106 IN IP4 ASTERISK-INTERNAL-IP
s=Asterisk PBX 14.1.1
c=IN IP4 ASTERISK-INTERNAL-IP
t=0 0
m=audio 52848 RTP/SAVPF 9 126
a=rtpmap:9 G722/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:126 0-16
a=maxptime:150
a=ice-ufrag:6db2cf0f09874f0d027752705f609348
a=ice-pwd:2f24f51c3e0a1dbf5edfd1370fc02910
a=candidate:H34ca6dca 1 UDP 2130706431 ASTERISK-EXTERNAL-IP 52848 typ host
a=candidate:H34ca6dca 2 UDP 2130706430 ASTERISK-EXTERNAL-IP 52849 typ host
a=connection:new
a=setup:active
a=fingerprint:SHA-256 35:BF:17:2A:09:FB:6E:26:75:DE:CE:A1:DE:02:AC:E8:11:55:4F:BA:39:2B:8B:45:51:D6:9E:6F:2E:80:83:4B
a=sendrecv

<------------>

<--- SIP read from WS:BROWSER-EXTERNAL-IP:57667 --->
ACK sip:123456 at ASTERISK-INTERNAL-IP:5060;transport=WS SIP/2.0
Via: SIP/2.0/WSS df7jal23ls0d.invalid;branch=z9hG4bKT3Di3kyStbskrP6Cq0SA;rport
From: "100"<sip:100 at WEBRTC-FQDN>;tag=6q5wNcGS9CnWOkMKZ92N
To: <sip:123456 at WEBRTC-FQDN>;tag=as2984a23e
Contact: "100"<sips:100 at df7jal23ls0d.invalid;rtcweb-breaker=yes;click2call=no;transport=wss>;+g.oma.sip-im;language="en,fr"
Call-ID: 672fae6f-99fd-de1c-0347-fd15e703483c
CSeq: 31997 ACK
Content-Length: 0
Max-Forwards: 70
Authorization: Digest username="100",realm="asterisk",nonce="23bf6e73",uri="sip:123456 at ASTERISK-INTERNAL-IP:5060;transport=WS",response="9a503410d8ae4acf4de2b073a5062d51",algorithm=MD5
User-Agent: IM-client/OMA1.0 sipML5-v1.2016.03.04
Organization: Doubango Telecom

<------------->
--- (12 headers 0 lines) ---
    -- Executing [123456 at wrtc:2] Playback("SIP/100-00000001", "tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys") in new stack
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004365, ts 000160, len 000160)
    -- <SIP/100-00000001> Playing 'tt-monkeys.gsm' (language 'en')
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004366, ts 000320, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004367, ts 000480, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004368, ts 000640, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004369, ts 000800, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004370, ts 000960, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004371, ts 001120, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004372, ts 001280, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004373, ts 001440, len 000160)
Sent RTP packet to      BROWSER-EXTERNAL-IP:52335 (via ICE) (type 09, seq 004374, ts 001600, len 000160)
{code}

FireFox shows this in its logs:
{code}
276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:612: GetAudioFrame 
276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:716: GetAudioFrame GetAudioFrame:Got samples: length 320 
{code}

But no audio is played until some (random) number of seconds pass, and this logs shows up:
{code}
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: PacketReceived(2001)
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: Checking digest, algorithm=sha-256
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[ice]:  SendPacket(75) succeeded
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ****** SSL handshake completed ******
261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ALPN not negotiated, selecting default
261443584[7f89265334a0]: /builds/slave/m-rel-m64-00000000000000000000/build/src/media/mtransport/transportlayerdtls.cpp:865: Flow[568ce410feebc53d:0,rtp(none)]; 
{code}

EDIT: I forgot to mention that looking at the output from chrome://webrtc-internals, I noticed that during the delay the browser is stalled at ICEConnectionStateChecking. As soon as the audio is connected, it goes to ICEConnectionStateConnected.
 
Without changing any browser or network settings whatsoever either in the Asterisk Box or the browser's box, sometimes it just works. But most of the time the delay is present.

With FreeSWITCH (cec0cb39830546a3a1c1df7ad7a05b05f14b8975 - Fri Oct 28 15:38:25 2016 -0500) works perfectly, every single time.

Any help is greatly appreciated!

Thank you.

Best regards,


> Delay in DTLS handshake causes audio setup delay
> ------------------------------------------------
>
>                 Key: ASTERISK-26544
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26544
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_rtp_asterisk
>    Affects Versions: 13.6.0, 13.9.0, 13.12.0, 13.11.2, 13.12.1, 14.0.0, 14.1.1
>         Environment: Amazon Linux: 4.4.23-31.54.amzn1.x86_64 #1 SMP x86_64 GNU/Linux
> OpenSSL: 1.0.2j
> LibSRTP: 1.5.4
> SIPml5: e3152e1edf116b651de379b3cc971bf699787c26 (Fri Mar 4 09:47:48 2016 +0100)
> Chrome: 54.0.2840.71 (64-bit)
> FireFox: 49.0.2
> Opera: 41.0
> Online JSSip Demo at: https://tryit.jssip.net/
> Amazon EC2 instance
>            Reporter: Marcelo Gornstein
>
> Hello,
> It seems that there is a delay in the audio setup when using WebRTC with latest Asterisk versions and latest browser versions (described in the Environment section).
> Sometimes there is no delay, but most of the time the delay goes between 1 second to a couple of minutes. 
> This seems to be related to a delay in the DTLS connection handshake between Asterisk and the browser (although this is just a guess after trying to isolate the issue).
> sip.conf
> {code}
> [100]
> nat=force_rport,comedia
> host=dynamic
> type=friend
> secret=secret
> disallow=all
> allow=g722
> icesupport=yes
> transport=wss
> dtlsenable=yes
> dtlsverify=no
> dtlscertfile=/cert.crt
> dtlsprivatekey=/cert.key
> dtlssetup=actpass
> videosupport=no
> encryption=yes
> avpf=yes
> force_avp=yes
> directmedia=no
> canreinvite=no
> context=wrtc
> {code}
> extensions.conf
> {code}
> [wrtc]
> exten => _X.,1,Answer
> same => n,Playback(tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys&tt-monkeys)
> same => n,Hangup
> {code}
> rtp.conf
> {code}
> [general]
> rtpstart=6000
> rtpend=65535
> icesupport=true
> [ice_host_candidates]
> x.x.x.x => y.y.y.y ; x.x.x.x is the internal IP, y.y.y.y is the external IP
> {code}
> [Edit by Rusty - removed excessive debug in description field as per issue tracker guidelines. Moving to attachment.]
> FireFox shows this in its logs:
> {code}
> 276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:612: GetAudioFrame 
> 276467712[7f8929a4aec0]: [|WebrtcAudioSessionConduit] AudioConduit.cpp:716: GetAudioFrame GetAudioFrame:Got samples: length 320 
> {code}
> But no audio is played until some (random) number of seconds pass, and this logs shows up:
> {code}
> 261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: PacketReceived(2001)
> 261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: Checking digest, algorithm=sha-256
> 261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[ice]:  SendPacket(75) succeeded
> 261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ****** SSL handshake completed ******
> 261443584[7f89265334a0]: Flow[568ce410feebc53d:0,rtp(none)]; Layer[dtls]: ALPN not negotiated, selecting default
> 261443584[7f89265334a0]: /builds/slave/m-rel-m64-00000000000000000000/build/src/media/mtransport/transportlayerdtls.cpp:865: Flow[568ce410feebc53d:0,rtp(none)]; 
> {code}
> EDIT: I forgot to mention that looking at the output from chrome://webrtc-internals, I noticed that during the delay the browser is stalled at ICEConnectionStateChecking. As soon as the audio is connected, it goes to ICEConnectionStateConnected.
>  
> Without changing any browser or network settings whatsoever either in the Asterisk Box or the browser's box, sometimes it just works. But most of the time the delay is present.
> With FreeSWITCH (cec0cb39830546a3a1c1df7ad7a05b05f14b8975 - Fri Oct 28 15:38:25 2016 -0500) works perfectly, every single time.
> Any help is greatly appreciated!
> Thank you.
> Best regards,



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list