answer

View as MarkdownOpen in Claude

Add an answer verb to the main section. Answers an incoming call.

Parameters

config
Record<string, unknown> | undefined

Optional configuration object for the answer verb. Supported keys:

  • max_duration (number) — Maximum call duration in seconds.
  • codecs (string) — Comma-separated list of codecs to offer. Valid codecs: PCMU, PCMA, G722, G729, AMR-WB, OPUS, VP8, H264.
  • username (string) — Username for SIP authentication.
  • password (string) — Password for SIP authentication.

Returns

this — The builder instance for method chaining.

Example

1import { SwmlBuilder } from '@signalwire/sdk';
2
3const builder = new SwmlBuilder();
4builder.answer({ max_duration: 3600 });
5builder.play({ url: 'https://example.com/audio.mp3' });
6builder.hangup();