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
    • Quickstart
  • Basics
    • Control program flow
    • Deploy SWML from web servers
    • Handle incoming calls from code
    • Send simple HTTP requests
  • Recipes
    • Call whisper
    • Forwarding calls
    • Making and receiving phone calls
    • Recording calls
    • Setting up voicemail
    • Simple IVR
  • SWAIG Functions
    • Overview
    • Enable functions dynamically
    • Execute SWML from a function
    • Handle SWAIG function calls inline
    • Store data outside LLM context
    • Switch AI context mid-call
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Setting up the SWML scripts
  • SWML Play Example
  • SWML Connect Example
  • Conclusion
Recipes

Call whisper

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

Forwarding calls

Next
Built with

Call Whisper is a feature that allows you to play a message to the recipient of a call before connecting them to the caller. This feature is useful for informing the recipient about the nature of the call before they answer it. This guide shows you how to perform a Call Whisper using SWML to inform the recipient the number of the caller.

Setting up the SWML scripts

To perform a Call Whisper using SWML, you need to create two SWML script resources. One will utilize the connect method to connect the caller to the recipient, while the other will use the play method to play the Call Whisper message.

SWML Play Example

This will be the SWML script that is fetched when a call is successfully connected. In this example, we will play a message that says “You got a call from [Caller ID]”, where [Caller ID] is the phone number of the caller.This is done by using the say: command inside the play method and using the ${call.from} variable to get the caller’s phone number.

Example

1version: 1.0.0
2sections:
3 main:
4 - play:
5 url: 'say:You got a call from ${call.from}'

SWML Connect Example

Inside the connect method, you can use the confirm parameter to specify the URL that will return the SWML script to play the Call Whisper message. The from parameter is used to specify the caller’s phone number, which will be used in the Call Whisper message. Here we are using the ${call.from} variable to get the caller’s phone number from the initial call. The to parameter is used to specify the recipient’s phone number. Please replace +1XXXXXXXXXX with the recipient’s phone number and the confirm parameter with the URL of the SWML script that plays the Call Whisper message.

1version: 1.0.0
2sections:
3 main:
4 - connect:
5 confirm: "https://your-space.signalwire.com/relay-bins/your-first-bin-url-goes-here"
6 from: "${call.from}"
7 to: "+1XXXXXXXXXX"

Conclusion

After setting up your SWML script resources, you can now use them to perform a Call Whisper. First assign the connect example script to a SignalWire phone number. Now, when a call is made to that phone number, the Call Whisper message will be played to the recipient before connecting them to the caller.