autoMapSipUsernames

View as MarkdownOpen in Claude

Automatically register SIP usernames based on the agent’s name and route properties. Convenience method that derives common username variations so callers can reach the agent via SIP without manual registration.

The method registers:

  • A lowercase, alphanumeric-only version of the agent name (e.g., "supportagent")
  • A lowercase, alphanumeric-only version of the route when different from the name
  • A vowel-stripped abbreviation of the name when the cleaned name is longer than 3 characters and the stripped result is longer than 2 characters

enableSipRouting() calls this method automatically when invoked without arguments. You only need to call autoMapSipUsernames() directly to trigger it after disabling auto-mapping.

Parameters

None.

Returns

AgentBase — Returns this for method chaining.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'Support Agent', route: '/support' });
4agent.setPromptText('You are a support assistant.');
5agent.autoMapSipUsernames();
6// Registers: "supportagent", "support", "spprtgnt"
7await agent.serve();

To register specific usernames instead, use registerSipUsername():

1agent.registerSipUsername('helpdesk');
2agent.registerSipUsername('support');