the end_call tool function is not working, i was u...
# agents
p
the end_call tool function is not working, i was using 0.12 livekit-agents and back then it was working just fine, then after upgrading to 1.22 version it is not working and the call keep going the code
class InoundtAgent(Agent):
def __init__(self, chat_ctx: ChatContext, instructions: str):
super().__init__(chat_ctx=chat_ctx, instructions=instructions)
async def hangup(self):
"""Helper function to hang up the call by deleting the room"""
# Allow a small delay for cleanup
await asyncio.sleep(1)
# Now delete the room
job_ctx = get_job_context()
await job_ctx.delete_room()
@function_tool()
async def end_call(self, ctx: RunContext):
"""Called when the user wants to end the call"""
current_speech = ctx.session.current_speech
if current_speech:
await current_speech.wait_for_playout()
await self.hangup()
c
Can you replace hangup with below and try again
Copy code
async def hangup(self):
    """Helper function to hang up the call by deleting the room"""

    job_ctx = get_job_context()
    await job_ctx.api.room.delete_room(
        api.DeleteRoomRequest(
            room=job_ctx.room.name,
        )
    )