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.
AcademyContact SalesHelp CenterDashboard
DocumentationAPI ReferenceIntegrationsAdministrationChangelog
DocumentationAPI ReferenceIntegrationsAdministrationChangelog
  • Get Started
    • Introduction
    • Aurora
  • Build
    • Create an Agent
    • The Agent Editor
    • Single-Prompt Agents
    • Memory
    • Knowledge Base
    • Variables
    • Version Control
  • Evaluate
    • Manual Testing
    • Custom Evaluations
    • Simulations
  • Launch
    • Deployment Options
      • Overview
      • Connect your Phone System
      • SIP Trunking Network ACL
      • Egress IP Addresses
      • Performance Metrics
      • Concurrency
      • Telephony Errors
      • Forward Calls to Synthflow
      • Call Transfer to SIP
        • How to Direct SIP Dialing
        • Viewing the SIP call ladder
        • Use Action Variables in Inbound SIP Calls
        • Forward Calls to the SIP Trunk
        • Forward Calls Using SIP Diversion Headers
        • Use the X-EI SIP Header
        • Use SIP X-Headers in Prompts, Actions & Transfers
      • Deploy in LATAM Regions
    • WhatsApp
    • Website and Apps
    • Launching a Chat Agent
    • Workflows
  • Learn
    • Analytics Dashboard
    • Logs
    • Export Call Data
  • Legal
    • Subscriber Terms
    • GTC - Direct Use (DACH)
    • GTC - Direct Use (US)
    • GTC - Distribution (DACH)
    • GTC - Distribution (US)
    • Business Associate Agreement
    • Privacy Policy
    • Imprint
    • AI Transparency Statement
    • Trust Vault
LogoLogo
AcademyContact SalesHelp CenterDashboard
On this page
  • Step 1: Import a Custom Phone Number
  • Step 2: Create an agent
  • Step 3: Configure Twilio
  • Pre-actions with pre-call variables
LaunchTelephonyDial to the SIP Endpoint

How to Direct SIP Dialing

||View as Markdown|
Was this page helpful?
Previous

SIP Call Ladder

Next
Built with

In scenarios where your telephony provider does not offer elastic SIP trunking or if you have a more complex telephony setup unsuitable for elastic SIP trunking, you can use direct SIP dialing to our endpoint.

In this scenario, Synthflow does not directly place or receive calls. Rather, your telephony system manages the dialing process to connect with the specified SIP endpoint. You will need to develop the integration logic tailored to your telephony provider’s requirements. From Synthflow’s standpoint, all call interactions will be treated as incoming, so your integration must explicitly define call direction handling.

The process involves three primary steps:

  1. Importing a custom phone number
  2. Creating the agent and linking it to the phone number
  3. Dialing to the SIP Endpoint

Step 1: Import a Custom Phone Number

Use the Create a custom phone number API endpoint to import a custom phone number into your workspace.

You will need to provide:

  • workspace_id: Your workspace ID
  • phone_number: The phone number to import
  • friendly_name (optional): A human-readable name for the phone number
  • trunk_username (optional): SIP trunk username for authentication
  • trunk_pwd (optional): SIP trunk password for authentication

Step 2: Create an agent

Use the Create an agent API endpoint to create an agent and link it to the custom phone number created in Step 1. Ensure the phone number is successfully created before proceeding.

You will need to provide:

  • type: Set to inbound for receiving calls
  • name: A name for your agent
  • phone_number: The custom phone number created in Step 1
  • voice_engine_version: Set to 2.0 for V2 agents
  • agent: Agent configuration including llm, language, prompt, greeting_message, and voice_id

Step 3: Configure Twilio

After the trunk is set up on SynthFlow, redirect Twilio calls to it using TwiML commands. Be sure to include the GHL unique call ID or Twilio Call SID in the SIP header using the X-EI key.

Javascript Example:

Dialing via TWIML
1const express = require('express');
2const { twiml: { VoiceResponse } } = require('twilio');
3
4const app = express();
5const PORT = process.env.PORT || 3000;
6const TERMINATION = "sipin.synthflow.ai:32681";
7
8/**
9 * Redirects a call to SynthFlow SIP endpoint.
10 */
11app.get('/redirect_call', (req, res) => {
12 const { Called, CallSid } = req.query;
13
14 if (!Called) {
15 return res.status(400).send('Missing "Called" query parameter');
16 }
17
18 const voiceResponse = new VoiceResponse();
19 voiceResponse.dial().sip(`sip:${Called}@${TERMINATION}?X-EI=${CallSid}`);
20
21 res.set('Content-Type', 'text/xml');
22 res.status(200).send(voiceResponse.toString());
23});
24
25app.listen(PORT, () => {
26 console.log(`Server is running on http://localhost:${PORT}`);
27});

Python Example:

Dialing via TWIML
1from fastapi import FastAPI, Response
2from twilio.twiml.voice_response import VoiceResponse
3
4app = FastAPI()
5TERMINATION = "sipin.synthflow.ai:32681"
6
7@app.get("/redirect_call")
8async def redirect_call(Called: str, CallSid: str): # pylint: disable=invalid-name
9 voice = VoiceResponse()
10 voice.dial().sip(f"sip:{Called}@{TERMINATION}?X-EI={CallSid}")
11 return Response(str(voice), media_type="text/xml", status_code=200)

Pre-actions with pre-call variables

You can use Pre-Actions to fetch pre-call variables via API and incorporate them into the agent prompt for more personalized responses by using the <twilio_call_sid> verb in API request.

Note: The transfer call will work the same as before.