PolyAI is an accredited Five9 partner. Five9 usually completes their side in about two weeks. A Five9 demo environment is available for testing; ask your PolyAI contact if you want access.
Before you start
- Five9 IP ranges. Ask your Five9 account manager for the IP ranges your Five9 environment sends SIP and media from.
- Numbers to route. Have the phone numbers ready, written exactly as Five9 will send them as the dialed number.
- No other telephony integration on the project. Only one telephony integration can be connected to a project at a time. Once you finish this setup, Five9 is this project’s telephony integration.
If the Five9 option shows Coming soon, contact your PolyAI account manager.
Start the guided setup
- In Agent Studio, go to Integrations and open the Telephony tab.
- Click Add number. The Add a number panel opens.
- Under Integrate with your contact center platform, select Five9.
1
Trunk details
Fill in the trunk fields:
PolyAI rejects calls from any address you don’t list.Click Next.
2
Numbers
Under Numbers and routing, add each number that should reach your agent:
- Extension: the dialed number as it arrives on this trunk, for example
+441234567890. Enter it exactly as Five9 sends it. - Environment: which environment of your agent answers calls to this number.
- Variant (optional): routes calls to a specific variant of the agent. Leave empty for the default.
3
Review
Check the Basics, Network and encryption, Authentication and Numbers sections. Click Edit next to a section to change it, then click Create trunk.Agent Studio creates the trunk and connects Five9 to your project. Connecting Five9 sets your project to hand off calls with a SIP BYE. If a number fails to save, Agent Studio tells you which one. Add it again from the trunk’s card on the Telephony tab.
4
Reference
The Reference step shows Finish in Five9, the connection details, the SIP headers and the Handoff API values. See the sections below.Click Done to close the setup. The trunk and its numbers then appear on the Telephony tab.
Finish in Five9
Five9 configures their side of the trunk. Using the values on the Reference step:- Send your Five9 account manager the connection details and ask them to route your Five9 domain to this trunk, over TLS with SRTP media.
- Ask Five9 to send each number you added as the dialed number, so calls reach the right agent.
- Check that the standard INVITE headers are on. Five9 sends them by default. More can be added without Five9 professional services.
- Set the BYE headers on each handoff in Agent Studio, so Five9 knows where to route the call next.
- Give Five9 your account ID, project ID and an API key for the Handoff API.
Use an AI assistant
The Reference step includes Have an AI assistant prepare the Five9 side. Copy the prompt and paste it into an AI assistant that can work in your Five9 admin console. The prompt contains this trunk’s connection details, the standard headers and your Handoff API values. The assistant:- Asks which Five9 domain and campaigns send calls to PolyAI, which numbers reach the agent, and which skill to fall back to if routing or the Handoff API fails.
- Checks the trunk, numbers and INVITE headers, and drafts a request to your Five9 account manager if Five9 manages the trunk.
- Updates the Five9 IVR script to route on the BYE headers and call the Handoff API.
- Asks before saving anything that affects live calls, and replies with a summary of what it configured.
Connection details
The Reference step lists everything Five9 needs. Each value has a copy button.- Connection basics: Encryption, Port (5061), Signalling (SIP over TLS), Media (SRTP over UDP), RTP port range, your SIP CIDR and RTP CIDR ranges, and Authentication.
- TLS certificates: TLS version 1.2, the PolyAI root certificate (DigiCert Global Root G2), and the requirement that Your certificate is signed by a publicly trusted certificate authority.
- How to reach PolyAI: the SIP trunk A record (Recommended) and its SIP URI, plus a Global A record and an SRV service and protocol record with their SIP URIs. If one option doesn’t work for Five9, try one of the others.
- Identifying this trunk: the Trunk ID, the Header and URI parameter that carry it, and, depending on your authentication choice, the digest Username and Realm or the Token header.
SIP headers
Every Five9 customer gets these headers by default. More can be added, but use these where you can to keep setup simple.Five9 sends on INVITE
Your agent can read these values from
conv.sip_headers. See Custom SIP.
Pass call data back to Five9
Five9 projects always hand off with a SIP BYE. PolyAI sends these headers on the BYE that ends its call leg:
Set these as SIP headers on each handoff. Click Open handoffs on the Reference step, or see Handoffs.
In the Five9 IVR script that runs when the PolyAI call leg ends, read
X-RouteType and X-Value and route the call:
skilltransfers to the skill named inX-Value.agenttransfers to the agent inX-Value.externaldials the number inX-Value.hangupends the call.
Handoff API
Five9 calls the Handoff API from its script to fetch call data that doesn’t fit in a header. The Reference step shows the Account ID, Project ID and Handoff API URL to give Five9, with a link to Manage API keys.- Five9 sends a
GETto the Handoff API URL, with a PolyAI API key in thex-api-keyheader. - Five9 passes its session ID as the
shared_idquery parameter. In your project, set the shared ID from theX-CallSessionIDheader so the two match. - The response’s
datafield holds the handoff details your agent saved. - By default, Five9 also calls the Handoff API when PolyAI hangs up.
- Add error handling to the Five9 script. If the API call fails, route to a fallback skill.
Example request
Change or remove the trunk
On the Telephony tab, open the Five9 trunk’s menu:- Add number adds another number to the trunk.
- Edit configuration changes the name, CIDR ranges or authentication. Secrets are never shown again; leave a secret field blank to keep the stored one.
- Remove trunk deletes the trunk. Every call routing over it stops, including calls to its numbers. This cannot be undone. Removing the trunk also disconnects Five9 from the project.
Related pages
Handoffs
Configure handoff destinations and SIP headers.
Handoff API
Fetch handoff data from your contact center.

