Replies: 1 comment
-
Hey! 👋 I see you’re struggling with audio issues in your WebRTC setup using JsSIP and Asterisk. It looks like you’ve tried setting up remote audio, but it’s staying muted even though everything else seems to work. Here are a few things you could check and try to potentially fix the issue: 1. Ensure Proper Media Stream AttachmentIt seems like you’re already adding the remote track to the audio element, but there could be issues with permissions or browser policies. Make sure the remote audio is correctly attached with the following code in session?.connection.addEventListener('track', (event) => {
if (event.track.kind === 'audio') {
const remoteStream = new MediaStream();
remoteStream.addTrack(event.track);
if (audioElementRemote.current) {
audioElementRemote.current.srcObject = remoteStream;
audioElementRemote.current.play().catch((error) =>
console.error("Failed to play remote audio:", error)
);
}
}
}); 2. Check Asterisk ConfigurationEnsure that Asterisk is configured to allow audio passthrough for WebRTC clients. Confirm that STUN/TURN servers are correctly set up to help with NAT traversal if your setup is behind NAT. 3. Handle Audio Context PoliciesSome browsers (like Chrome) require user interaction to play audio. Try initializing and playing the audio in response to a user action, like clicking a button, to ensure compliance with these policies. 4. Verify Media ConstraintsMake sure that you are requesting audio permissions correctly in const options = {
eventHandlers: eventHandlers,
mediaConstraints: { audio: true, video: false },
}; 5. Debugging Tips
If these steps don’t resolve the issue, feel free to share more details or any errors you’re seeing. Hope this helps! 😊 |
Beta Was this translation helpful? Give feedback.
-
Hi!
Please.. anyone can help me!
I tring everthink, but not works.
The call completes, the permission is ok, and etc.. But audio stay mute.
I having try another webphone and my asterisk is fine, works. But when i using my code, don't work.
Any onde can help me please!
Thanks.
Demo5.tsx.txt
Beta Was this translation helpful? Give feedback.
All reactions