Contact Sales

All fields are required

How to Add AI Capabilities to Your FreeSWITCH | SignalWire

How to Add AI Capabilities to Your FreeSWITCH

Add an AI agent to your FreeSWITCH instance

FreeSWITCH Enterprise Support Lead

Len Graham

Adding AI capabilities to your FreeSWITCH

Did you know you can add an AI agent to your FreeSWITCH instance to handle your calls? In this post, we’ll walk through an example code snippet for bridging a FreeSWITCH dialplan to a SignalWire AI Agent. This will allow an AI agent to take over the call as a virtual assistant or an IVR replacement, which is especially useful if you’re receiving many calls at once.

What is SignalWire AI Agent?

SignalWire’s AI Agent is a low-code voice agent you can build using plain-text instructions. Personality, skills, and areas of expertise can all be customized in a simple drag-and-drop interface. You can also code your own if you want it to perform more complex functions.

You can use an AI agent as a virtual receptionist for your business, or as your own personal AI assistant. With the power of AI, the agent does not require pre-recorded messages or even text-to-speech prompts - it’s smart enough to engage in conversation with callers based on plain language instructions.

This example contains a pre-existing AI agent, but you can build and customize your own and then connect it to your FreeSWITCH as demonstrated in the below example.

FreeSWITCH Dialplan

We'll break down the components of the following code snippet:

In the bridge, be sure to replace with your SignalWire domain app SIP address.

Dialplan Details

The given dialplan defines an extension within a FreeSWITCH configuration file. Let's break down its components for a clearer understanding:


  • name="testing_ai": The name of the extension. This is a unique identifier for the extension.

  • continue="false": Indicates whether FreeSWITCH should continue processing more extensions if this extension is executed. false means no further extensions will be processed.

  • uuid="6d0ecaef-9049-4920-8d1a-fc97ff4731f0": A unique identifier for this specific extension instance.


  • field="destination_number": This specifies that the condition is based on the destination number of the call.

  • expression="^55555$": A regular expression that matches the number 55555. Only calls to this exact number will trigger the actions defined in this extension.


Each <action> element represents a step in the call handling process. This configuration is particularly useful for setting up specialized call routing and handling behaviors in FreeSWITCH.

This block provides a detailed breakdown of the extension, condition, and actions within the provided FreeSWITCH dialplan configuration.

The actions are executed sequentially when the condition is met:

Ring Ready

  • Sends a ringing signal to the caller, indicating that the call is being processed but not yet answered.


  • Answers the call.


  • Pauses the call processing for 500 milliseconds.

Set hangup_after_bridge

  • Sets a variable hangup_after_bridge to true, which means the call will be hung up immediately after the bridge application completes its execution.

Set Ringback Tone

  • Sets the ringback tone to be played to the caller. In this case, it uses a default local stream.


  • Bridges the call to the SignalWire SIP URI using the TCP transport. This effectively forwards the call to the specified SIP address.

Get started with our no-code AI agent builder today by signing up for a SignalWire space. If you have questions about connecting your AI agent to a FreeSWITCH instance, bring it to the team on our community Slack or Forum, or join us the first and third Tuesday of each month for FreeSWITCH Office Hours!

Related Articles