aiUnhold

View as MarkdownOpen in Claude

Resume an AI agent session from hold. The AI resumes processing the conversation.

Parameters

prompt
string | undefined

A prompt for the AI to speak upon resuming (e.g., “Thank you for holding. I have your information now.”).

Returns

Promise<Record<string, unknown>> — Server response confirming the AI unhold.

Example

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11
12 // Start an AI agent
13 const action = await call.ai({
14 prompt: { text: 'You are a support agent.' },
15 });
16
17 // Put the AI on hold
18 await call.aiHold({ prompt: 'One moment please.' });
19
20 // Do some processing...
21 await new Promise((resolve) => setTimeout(resolve, 5000));
22
23 // Resume the AI
24 await call.aiUnhold({ prompt: 'Thanks for waiting. I found your information.' });
25});
26
27await client.run();