For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
      • ContextBuilder
      • DataMap
      • FunctionResult
        • addAction
        • addActions
        • addDynamicHints
        • clearDynamicHints
        • connect
        • createPaymentAction
        • createPaymentParameter
        • createPaymentPrompt
        • enableExtensiveData
        • enableFunctionsOnTimeout
        • executeRpc
        • executeSwml
        • hangup
        • hold
        • joinConference
        • joinRoom
        • pay
        • playBackgroundFile
        • recordCall
        • removeGlobalData
        • removeMetadata
        • replaceInHistory
        • rpcAiMessage
        • rpcAiUnhold
        • rpcDial
        • say
        • sendSms
        • setEndOfSpeechTimeout
        • setMetadata
        • setPostProcess
        • setResponse
        • setSpeechEventTimeout
        • simulateUserInput
        • sipRefer
        • stop
        • stopBackgroundFile
        • stopRecordCall
        • stopTap
        • switchContext
        • swmlChangeContext
        • swmlChangeStep
        • swmlTransfer
        • swmlUserEvent
        • tap
        • toDict
        • toggleFunctions
        • updateGlobalData
        • updateSettings
        • waitForUser
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Parameters
  • Returns
  • Examples
  • Enable waiting (no timeout)
  • Wait with timeout
  • Disable waiting
AgentsFunctionResult

waitForUser

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

Helper Functions & Utilities

Next
Built with

Control how the agent pauses and waits for the user to speak. The arguments are evaluated in priority order: answer_first takes precedence, then timeout, then enabled. If none are provided, waiting is enabled with no timeout.

Parameters

opts
object

Optional configuration object.

opts.enabled
boolean

Explicitly enable (true) or disable (false) waiting for user input.

opts.timeout
number

Number of seconds to wait for the user to speak before the agent continues.

opts.answerFirst
boolean

When true, activates the special "answer_first" mode. This answers the call and waits for the user to speak before the agent begins its greeting.

Returns

FunctionResult — this, for chaining.

Examples

Enable waiting (no timeout)

1import { FunctionResult } from '@signalwire/sdk';
2
3const result = new FunctionResult('Take your time.')
4 .waitForUser();

Wait with timeout

1import { FunctionResult } from '@signalwire/sdk';
2
3const result = new FunctionResult('Please respond within 30 seconds.')
4 .waitForUser({ timeout: 30 });

Disable waiting

1import { FunctionResult } from '@signalwire/sdk';
2
3const result = new FunctionResult('Continuing without waiting.')
4 .waitForUser({ enabled: false });