How do we detect that the host has ended the zoom call and that the ai bot has disconnected?

Open a separate WebSocket connection to listen to events happening over the telephony API. The ‘on close’ handler will give notice when the connection is no longer active. The WebSocket URL is wss://{connectionId} where you pass the connectionId received from the initial telephony API connection, along with an auth token in the ‘X-API-Key’ header.