diff --git a/examples/bot-ready-signalling/client/javascript/src/app.js b/examples/bot-ready-signalling/client/javascript/src/app.js index 162a3869b..afe137d77 100644 --- a/examples/bot-ready-signalling/client/javascript/src/app.js +++ b/examples/bot-ready-signalling/client/javascript/src/app.js @@ -89,13 +89,19 @@ class ChatbotClient { }); this.dailyCallObject.on("track-started", (evt) => { if (evt.track.kind === "audio" && evt.participant.local === false) { + this.log("Audio track started.") this.setupAudioTrack(evt.track); + this.log("Will send the audio message to play the audio") + this.dailyCallObject.sendAppMessage("playable") } }); this.dailyCallObject.on("track-stopped", this.handleEventToConsole.bind(this)); this.dailyCallObject.on("participant-joined", this.handleEventToConsole.bind(this)); this.dailyCallObject.on("participant-updated", this.handleEventToConsole.bind(this)); - this.dailyCallObject.on("participant-left", this.handleEventToConsole.bind(this)); + this.dailyCallObject.on("participant-left", () => { + // When the bot leaves, we are also disconnecting from the call + this.disconnect() + }); this.dailyCallObject.on("left-meeting", () => { this.updateStatus('Disconnected'); this.connectBtn.disabled = false; @@ -185,6 +191,7 @@ class ChatbotClient { try { // Disconnect the RTVI client await this.dailyCallObject.leave(); + await this.dailyCallObject.destroy(); this.dailyCallObject = null; // Clean up audio diff --git a/examples/bot-ready-signalling/server/signalling_bot.py b/examples/bot-ready-signalling/server/signalling_bot.py index e56113ef5..0a93d0cbc 100644 --- a/examples/bot-ready-signalling/server/signalling_bot.py +++ b/examples/bot-ready-signalling/server/signalling_bot.py @@ -47,7 +47,7 @@ async def main(): @transport.event_handler("on_app_message") async def on_app_message(transport, message, sender): logger.debug(f"Received app message: {message} - {sender}") - if "message" not in message: + if "playable" not in message: return await task.queue_frames( [TTSSpeakFrame(f"Hello there, how are you doing today ?"), EndFrame()]