Callingai

SWAIG

View as MarkdownOpen in Claude

The SignalWire AI Gateway Interface. Allows you to create user-defined functions that can be executed during the dialogue.

Properties

ai.SWAIG
object

An object that accepts the following properties.

SWAIG.defaults
object

Default settings for all SWAIG functions. If defaults is not set, settings may be set in each function object. Default is not set.

defaults.web_hook_url
string

The default URL to send status callbacks and reports to for all SWAIG functions. If defaults is not set, web_hook_url may be set in each SWAIG function object. Authentication can also be set in the url in the format of username:password@url.

For what this URL receives and what it should return, see the tool webhook.

SWAIG.functions
object[]

An array of JSON objects to define functions that can be executed during the interaction with the AI. Default is not set. The fields of this object are the six following.

See functions for additional details.

SWAIG.includes
object[]

An array of objects to include remote function signatures. This allows you to include functions that are defined in a remote location.

See includes for additional details.

SWAIG.internal_fillers
object

An object that defines language-specific filler phrases for internal SWAIG functions. These fillers help break silence between responses and are played asynchronously during function execution. Each key is a function name, and each value is an object mapping language codes to arrays of filler phrases.

internal_fillers.check_time
object

Filler phrases played when the AI Agent is checking the time.

internal_fillers.wait_for_user
object

Filler phrases played when the AI Agent is waiting for user input.

internal_fillers.wait_seconds
object

Filler phrases played during deliberate pauses or wait periods.

internal_fillers.adjust_response_latency
object

Filler phrases played when the AI Agent is adjusting response timing.

internal_fillers.next_step
object

Filler phrases played when transitioning between conversation steps when utilizing prompt.contexts.

internal_fillers.change_context
object

Filler phrases played when switching between conversation contexts when utilizing prompt.contexts.

internal_fillers.get_visual_input
object

Filler phrases played when the AI Agent is processing visual input. Enabled when enable_vision is set to true in ai.params.

Leaving this out does not silence the agent: a built-in English set is used under en-US instead, so set this key to change the wording or to cover another language.

internal_fillers.get_ideal_strategy
object

Filler phrases played when the AI Agent is thinking or considering options. Enabled when enable_thinking is set to true in ai.params.

Leaving this out does not silence the agent: a built-in English set is used under en-US instead, so set this key to change the wording or to cover another language.

internal_fillers.pause_conversation
object

Filler phrases played when the AI Agent pauses the conversation at the caller’s request. Enabled when enable_pause is set to true in ai.params, which start_paused also turns on. Setting speak_when_spoken_to turns enable_pause back off, which leaves this key with nothing to play.

SWAIG.native_functions
string[]

Prebuilt functions the AI agent is able to call. The agent is already aware of these functions and can use them creatively based on prompting. For example, a prompt like “tell the user what time it is” will automatically use check_time.

Accepted values:

  • adjust_response_latency - Adjust how long the agent will wait for the user to stop talking.
  • check_time - Returns the current time for the time zone set in ai.local_tz.
  • wait_for_user - Causes the AI to wait until the user speaks again. Use when the user asks to wait or hold on.
  • wait_seconds - Waits for the given amount of time.
SWAIG.mcp_servers
object[]

An array of MCP (Model Context Protocol) servers whose tools and resources are made available to the AI. Each server’s tools are discovered at startup and registered as callable functions, so they can be invoked like any other SWAIG function.

mcp_servers[].url
stringRequired

The MCP server URL.

mcp_servers[].headers
object

HTTP headers sent to the MCP server. Authorization tokens go here — there is no separate auth field. Header values support variable expansion (e.g. Bearer ${global_data.token}).

mcp_servers[].resources
booleanDefaults to false

Whether to fetch the server’s resources into global_data, when the server advertises resource support.

mcp_servers[].resource_vars
object

Template variables passed to the MCP server when fetching resources. Used only when resources is enabled.

Filler language codes

Several SWAIG properties accept filler phrases keyed by language code, including internal_fillers and per-function fillers. Every one of them resolves the same way: the agent looks for an entry matching the language being spoken, then auto, then default, and plays nothing when none of the three is set.

The codes below are the ones in common use, not a closed list. Under ai.multilingual the key is whichever code the engine reports for the turn, so any code it returns works. Under ai.languages the key has to match the code set on the entry.

CodeDescription
autoNot a language: the phrases are translated into whichever language is being spoken. Takes precedence over default
defaultNot a language: the phrases play when no other entry matches the language being spoken
bgBulgarian
caCatalan
csCzech
daDanish
da-DKDanish (Denmark)
deGerman
de-CHGerman (Switzerland)
elGreek
enEnglish
en-AUEnglish (Australia)
en-GBEnglish (United Kingdom)
en-INEnglish (India)
en-NZEnglish (New Zealand)
en-USEnglish (United States)
esSpanish
es-419Spanish (Latin America)
etEstonian
fiFinnish
frFrench
fr-CAFrench (Canada)
hiHindi
huHungarian
idIndonesian
itItalian
jaJapanese
koKorean
ko-KRKorean (South Korea)
ltLithuanian
lvLatvian
msMalay
multiCode-switching: the speech recognition engine detects and transcribes whichever of its supported languages the caller speaks, rather than one fixed language
nlDutch
nl-BEFlemish (Belgian Dutch)
noNorwegian
plPolish
ptPortuguese
pt-BRPortuguese (Brazil)
pt-PTPortuguese (Portugal)
roRomanian
ruRussian
skSlovak
svSwedish
sv-SESwedish (Sweden)
thThai
th-THThai (Thailand)
trTurkish
ukUkrainian
viVietnamese
zhChinese (Simplified)
zh-CNChinese (Simplified, China)
zh-HansChinese (Simplified Han)
zh-HantChinese (Traditional Han)
zh-HKChinese (Traditional, Hong Kong)
zh-TWChinese (Traditional, Taiwan)

Examples

internal_fillers

1SWAIG:
2 internal_fillers:
3 change_context:
4 en-US:
5 - 'Let me switch gears.'
6 - 'One moment.'
7 es:
8 - 'Voy a cambiar de tema.'
9 - 'Un momento.'
10 check_time:
11 default:
12 - 'Let me check the time.'
13 - 'One moment while I get the time.'
14 - 'Just checking the current time.'

mcp_servers

1SWAIG:
2 mcp_servers:
3 - url: "https://crm.example.com/mcp"
4 headers:
5 Authorization: "Bearer ${global_data.crm_token}"
6 resources: true
7 resource_vars:
8 customer_id: "${global_data.customer_id}"