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
ReferenceGuides
ReferenceGuides
  • Core
    • Introduction to SWML
    • Expressions
    • Template functions
    • Variables
    • Errors
  • Calling
    • Overview
    • ai
    • ai_sidecar
    • amazon_bedrock
    • answer
    • cond
    • connect
    • denoise
    • detect_machine
    • enter_queue
    • execute
    • goto
    • hangup
    • join_conference
    • join_room
    • label
    • live_transcribe
    • live_translate
    • pay
    • play
    • prompt
    • receive_fax
    • record
    • record_call
    • request
    • return
    • send_digits
    • send_fax
    • send_sms
    • set
    • sip_refer
    • sleep
    • stop_denoise
    • stop_record_call
    • stop_tap
    • switch
    • tap
    • transcribe
    • transcribe_stop
    • transfer
    • unset
    • user_event
  • Messaging
    • Overview
    • execute
    • goto
    • label
    • receive
    • reply
    • request
    • return
    • switch
    • transfer
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Variables
  • Examples
  • Setting variables
  • Setting multiple variables
  • See Also
Calling

set

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

sip_refer

Next
Built with

Set script variables to the specified values. Variables set using set can be removed using unset.

set
objectRequired

An object that accepts user-defined key-value pairs.

Variables

Any variable can be set by this method.

Examples

Setting variables

1version: 1.0.0
2sections:
3 main:
4 - set:
5 num_var: 1
6 - play:
7 url: 'say: ${num_var}'
8 - set:
9 num_var: 2
10 - play:
11 url: 'say: ${num_var}'

Setting multiple variables

1version: 1.0.0
2sections:
3 main:
4 - set:
5 items:
6 - drill bit
7 - drill
8 person: handyman
9 systems:
10 ventilation:
11 - inlet
12 - outlet
13 - fans
14 hr:
15 - lucy
16 - liam
17 - luke
18 - play:
19 url: 'say: The items ${items} will be used by ${person} to fix ${systems.ventilation}.'

See Also

  • Variables and Expressions: Complete reference for SWML variables, scopes, and syntax
  • unset: Remove variables from the script