How to Direct SIP Dialing
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:
- Importing a custom phone number
- Creating the agent and linking it to the phone number
- 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 IDphone_number: The phone number to importfriendly_name(optional): A human-readable name for the phone numbertrunk_username(optional): SIP trunk username for authenticationtrunk_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 toinboundfor receiving callsname: A name for your agentphone_number: The custom phone number created in Step 1voice_engine_version: Set to2.0for V2 agentsagent: Agent configuration includingllm,language,prompt,greeting_message, andvoice_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:
Python Example:
Pre-Actions with Custom Variables
You can use Pre-Actions to fetch custom 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.