InnovateAsterisk / Browser-Phone

A fully featured browser based WebRTC SIP phone for Asterisk
https://www.innovateasterisk.com
GNU Affero General Public License v3.0
498 stars 245 forks source link

One way audio #303

Closed MrLonely14 closed 2 years ago

MrLonely14 commented 2 years ago

Hi, when call start (A call B) in the begin audio work two way but after few minuets - some time few seconds - there audio be one way only (audio play only on B but A can't here anything) if B but call on hold and un hold it the audio will resume again two way.

dial plan setup:

exten => _3XXXX,1,Set(JITTERBUFFER(adaptive)=default) same => n,Dial(PJSIP/${EXTEN},30) same => n,Hangup()

also try to change the JITTERBUFFER to SET(JITTERBUFFER(fixed)=200,1000) but same issue, any advice where to look for debugging this issue

InnovateAsterisk commented 2 years ago

It’s unlikely to be jitter buffer related.

WebRTC is heavily dependent on ICE. There are various steps involved in this and a call can be re-invited inadvertently that can cause one way audio. This kind of path optimisation can occur after a few seconds into the call.

Make sure your server side ICE and Nat settings are correctly set. Take a look at the sample rtp.conf

im assuming the server is hosted and nated, correct? (These kind of issues often don’t exist over a local lan.)

MrLonely14 commented 2 years ago

"im assuming the server is hosted and nated, correct? (These kind of issues often don’t exist over a local lan.)"

yes the server is hosted in AWS lightsail (16 GB RAM, 4 vCPUs, 320 GB SSD) I use coturn as STUN/TURN server in same host

In Brower-Phone setting I set it like this:

IceStunServerJson: '[{ "urls": "stun:stun.example.com" },{ "urls": "turn:turn.example.com", "username": "user_name", "credential": "password" }]',

I also change it in sip-0.20.0.min.js from google stun to

[{urls:"stun:stun.example.com"}] (without TURN)

rtp.conf setting:

[general] rtpstart=10000 rtpend=20000 icesupport=true stunaddr=stun.example.com turnaddr=turn.example.com turnusername=user_name turnpassword=password

[ice_host_candidates] Internal_IP => Public_IP

coturn configuration in turnserver.conf :

listening-port=3478 tls-listening-port=5349 relay-ip=Internal_IP external-ip=Public_IP/Internal_IP min-port=49152 max-port=65535 fingerprint lt-cred-mech user=user_name:password server-name=app.example.com realm=app.example.com cert=/etc/letsencrypt/live/stun.example.com/cert.pem pkey=/etc/letsencrypt/live/stun.example.com/privkey.pem cipher-list="ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384" log-file=/var/log/coturn/turnserver.log simple-log verbose

InnovateAsterisk commented 2 years ago

Did you manage to solve this? I predominantly use WebRTC from a hosted Asterisk solution, and it works without fail. I don't use TURN since Asterisk cannot optimise itself out of the media path when using WebRTC's DTSL (its acting as BTBUA).

Try take a look at the RTP log. Use: rtp set debug on you should see the issue appear after a few seconds. It generates a lot of on-screen data, so make sure you use a development server.

MrLonely14 commented 2 years ago

Thanks a lot for your help, I fix this issue after moving the stun server to separate server.