A DNIs Pool is a rotating pool of Dynamic Number Insertion (DNI) numbers that lets you connect to your Virtual Agent hosted on PolyAI’s infrastructure. This integration passes metadata through PSTN numbers when SIP headers are unavailable.Documentation Index
Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
DNI pooling lets you:- Share structured JSON metadata with your agent at the start of a call
- Retrieve call state information at the end of the conversation
- Avoid custom SIP header requirements
- You’re using PSTN, which does not support sharing metadata
- You’re using SIP installations that do not support custom SIP headers
Requirements
To set up the DNIs Pool integration, you’ll need the following from your PolyAI contact:- API token for the
Reserve DNIendpoint - API token for the
Get Handoffendpoint - Your
account_idandproject_id - Agree with your PolyAI contact on the attributes the Agent will need to extract
Integration Runtime
The integration involves two main API endpoints:
Call flow
The integration flow works as follows:- Client sends project-specific attributes to the Reserve DNI endpoint. An example payload would look like this:
- PolyAI stores the attributes and returns a reserved DNI (e.g.,
+12345). - Client initiates a call to the DNI.
- PolyAI looks up the attributes for that DNI.
- Attributes are forwarded to the Virtual Agent based on your API Key.
- The Virtual Agent handles the conversation and stores any agreed data (e.g., handoff status).
- The call ends, and PolyAI sends a SIP BYE message.
- Client queries the Get Handoff endpoint to retrieve the call outcome.
An example response will look like this - note that the
shared_idis the same ID you would have sent above:
- If a handoff state is present, the Client can transfer the call to a human agent; otherwise, the call is considered complete.
Agent setup
For the integration to work, your agent needs to:- Store the attributes you are sending through the
Reserve DNIAPI - Save the handoff info into state to have the
Get HandoffAPI expose them when invoked
Store attributes
Attributes received from the API can only be accessed in thestart_function.
Not doing it here would mean losing them for all the conversations, making it impossible for the integration to work.
In your start_function, attributes are stored in the integration_attributes field as a dictionary.
Retrieve them like this (assuming the attributes sent are the ones in the example above):
Save handoff info
The conversation will always end with this integration. Handoff information must be prepared to be exposed by the Handoff API. The Handoff API can be configured to expose all thestate variables you desire. The most useful variables are often:
conv.state.handoff_reason- the reason for handoffconv.state.handoff_to- the destination for the call
state variables, the Handoff API will expose them (if configured to do so).
Configuration is handled by your PolyAI contact. Send them all the variables you want to expose, and they will set up the Handoff API accordingly.

