Why doesn't the llm tool wait for playout here? it...
# agents
a
Why doesn't the llm tool wait for playout here? it continues executing the tool before finishing the play.
Copy code
llm.tool({
	description: config?.tool_description || 'Hngup the phone call.',
	execute: async (_, { ctx }) => {
		console.log('SIP Hangup Tool: Starting execution.');
		
		if (config.speak_during_execution && config?.speak_message) {
			await ctx.waitForPlayout();
			ctx.session.generateReply({
				instructions: config.speak_message,
			});
			await ctx.waitForPlayout();
		}
		
		try {
			const jobCtx = getJobContext();
			await hangupSipCall(jobCtx);
			return `SIP call has been hung up successfully.`;
		} catch (err) {
			const message =
				err instanceof Error ? err.message : 'SIP transfer failed.';
			return `Failed to hang up SIP call: ${message}`;
		}
	},
});