if hasattr(config, "user_registered") and config.u...
# ask-ai
h
if hasattr(config, "user_registered") and config.user_registered is False: drop_msg = ( "We’re sorry, but your phone number isn’t registered in our system. " "Please contact the support team to get your number added before using this service." ) await session.say(drop_msg, allow_interruptions=False) await _save_transcript_and_stop_egress() ctx.shutdown(reason=drop_msg) return # register shutdown callback to save transcript and stop egress ctx.add_shutdown_callback(_save_transcript_and_stop_egress) logger.info(f"✅ Agent session started successfully. say : {config.firstMessage}") if config.firstMessage: say_start = datetime.utcnow() await session.say(config.firstMessage, allow_interruptions=True) say_end = datetime.utcnow() logger.info( f"⏱️ First message took {(say_start - start_time).total_seconds():.2f}s " f"to reach say() call, and {(say_end - start_time).total_seconds():.2f}s " f"until it finished queuing TTS." ) i have added this conditon if hasattr(config, "user_registered") and config.user_registered is False in code and i am expecting to end the call if it comes inside this condition but its speaking the message and still continues the call why so?
t
The issue happens because
ctx.shutdown(reason=drop_msg)
only disconnects the specific agent from the room—it doesn’t end the entire session or stop the call for everyone else. This method is meant to handle cleanup for that particular agent, so while it triggers a shutdown sequence for them, the room and other participants stay active. If your goal is to end the session for all participants, you’ll want to use the
deleteRoom
server API instead. This will close the room completely and disconnect everyone. Please feel free to reach out if you’d like help with setting this up—I’m here to assist! Sources: Job lifecycle | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...