https://retellai.com/?utm_source=discord&utm_medium=seo logo
Hi there — I’m using the Retell JS SDK (v2) in a b...
# ❓・ai-evy-support
h
@AI Evy Hi there — I’m using the Retell JS SDK (v2) in a browser-based voice interview flow, and I’m running into an issue where the onCallEnded callback is never triggered after a call finishes. Here’s what I’ve confirmed: • The call completes successfully (agent finishes, mic disconnects, etc.) • The connection closes in the browser and disconnect from room logs appear • No exceptions are thrown in my own onCallEnded logic • But my callback is never called Additionally, I’m seeing this internal SDK error in the console at the end of the call: TypeError: Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender Questions: 1. Is this a known issue in the current SDK? 2. Is there a more reliable way to detect that a call has ended (e.g. a different callback, observable, or cleanup hook)? 3. Can you confirm whether onCallEnded should be guaranteed to fire in all normal disconnection scenarios? 4. Is there a newer version of the SDK or a workaround you’d recommend? Thanks — happy to provide a minimal reproducible example if helpful.
a
Thanks for tagging me @hotfudge99. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available documentation, I can provide some guidance on web call event handling and SDK updates. The Retell Web SDK does provide event listeners for call lifecycle management [(1) ]() . According to the documentation, you can listen to various events including error events :
Copy code
javascript
retellWebClient.on("error", (error) => {
 console.error("An error occurred:", error) ;
 // Stop the call
 retellWebClient.stopCall() ;
}) ;
The documentation shows that the SDK has been updated multiple times, with version 1.3.0 specifically adding auto-reconnection support for web calls [(2) ]() . There have been ongoing improvements to the Web Call Frontend with SDK upgrades that maintain backward compatibility . However, I don't see specific documentation about the
onCallEnded
callback behavior or the RTCPeerConnection error you're experiencing in the available sources. The documentation does mention that there are "a lot more events that are helpful for animation" in the Frontend SDK , including: - "audio": real time audio played in the system - "agentStartTalking", "agentStopTalking": track whether agent is speaking For your specific issue with the callback not firing and the RTCPeerConnection error, I'd recommend: Visit [Contact Sales]() or [) for direct support with this technical issue. Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] Connect to web call](https://docs.retellai.com/deploy/web-call) [[2] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.