Give Your AI Agent a Real Phone Number
Give an AI voice system a real local phone number and route inbound calls through PBXMe telephony. Provision the DID via API, then configure its forwarding destination programmatically.
Why AI Agents Need a Real Phone Number
AI voice systems that can receive telephone calls need a telephony destination in front of the AI application. With a PBXMe virtual number, callers dial a normal local number and PBXMe forwards the inbound call to the destination configured for that DID. The supplied API reference documents DID provisioning and forwarding configuration; the exact media handoff method depends on the destination type supported by your telephony setup.
How to Connect PBXMe to Your AI Agent
Three steps from zero to a ringing AI agent.
Provision a Virtual Number via API
First whitelist the source IP address of the server making the API calls in your account portal. Use the Login endpoint with your account username/password and the fixed initial x-auth-token from the API documentation. A successful Login returns your account id, account_token, and a generated session x-auth-token. Use that session x-auth-token in subsequent request headers. Then call DID Available List (/customer/did_crud/, action=available_list) using the optional numeric country_id provided in the Country List reference/example. Use DID Assign (/customer/did_management/, action=assign) with the selected did_id and the required account fields to add the number to your account.
Set the Forwarding Destination to Your AI System
Use the DID Forward Setting endpoint (/customer/did_management/, action=forward) to configure the purchased DID destination. The supplied API reference example uses call_type=2 and a trunk IP in call_type_value. The destination can be updated without releasing the DID.
Receive Calls — Your AI Agent Answers
When someone dials the number, PBXMe forwards the inbound call to the destination configured for that DID. Your AI voice platform or telephony application then answers and processes the call according to its own configuration.
Python: Provision a Number & Route to Your AI Agent
Example based on the supplied API reference: whitelist the sending server IP, authenticate with the fixed initial x-auth-token, switch to the generated session x-auth-token, list available DIDs, assign one, and configure forwarding to a trunk IP.
import requests
BASE = "https://newsip.pbxme.com"
# Before calling the API, whitelist this server's source IP
# in the user's PBXMe account portal.
INITIAL_HEADERS = {
"x-auth-token": "YOUR_INITIAL_X_AUTH_TOKEN",
"Content-Type": "application/json"
}
# ── Step 1: Login with the fixed initial x-auth-token ───────
login = requests.post(
f"{BASE}/api/login/",
headers=INITIAL_HEADERS,
json={
"username": "YOUR_ACCOUNT_NUMBER",
"password": "YOUR_PASSWORD"
}
)
login.raise_for_status()
login_data = login.json()
account_id = login_data["id"]
token = login_data["account_token"]
session_x_auth_token = login_data["x-auth-token"]
# Use the generated session x-auth-token after Login.
SESSION_HEADERS = {
"x-auth-token": session_x_auth_token,
"Content-Type": "application/json"
}
# ── Step 2: List available DIDs ─────────────────────────────
# country_id is the optional numeric country ID provided in the Country List reference/example.
available = requests.post(
f"{BASE}/customer/did_crud/",
headers=SESSION_HEADERS,
json={
"action": "available_list",
"parent_id": "0",
"country_id": "YOUR_COUNTRY_ID",
"id": account_id,
"token": token
}
)
print("Available DIDs:", available.json())
# ── Step 3: Assign a DID ────────────────────────────────────
# Replace with a did_id returned by DID Available List.
did_id = "YOUR_DID_ID"
assign = requests.post(
f"{BASE}/customer/did_management/",
headers=SESSION_HEADERS,
json={
"action": "assign",
"did_id": did_id,
"accountid": account_id,
"reseller_id": "0",
"id": account_id,
"token": token
}
)
print("Assigned:", assign.json())
# ── Step 4: Configure forwarding toward your AI telephony stack ──
# The supplied API reference example uses call_type=2 and a trunk IP.
forward = requests.post(
f"{BASE}/customer/did_management/",
headers=SESSION_HEADERS,
json={
"action": "forward",
"did_id": "YOUR_PURCHASED_DID_ID",
"call_type": "2",
"call_type_value": "YOUR_TRUNK_IP",
"always": "5",
"user_busy": "5",
"user_not_registered": "5",
"no_answer": "5",
"extensions": "",
"call_type_vm_flag": "",
"always_destination": "",
"always_vm_flag": "",
"user_busy_destination": "",
"user_busy_vm_flag": "",
"user_not_registered_destination": "",
"user_not_registered_vm_flag": "",
"no_answer_destination": "",
"no_answer_vm_flag": "",
"id": account_id,
"token": token
}
)
print("Forwarding configured:", forward.json())AI Voice Platforms to Evaluate for Compatibility
PBXMe can be used with AI voice platforms that can accept calls through a telephony destination compatible with your PBXMe forwarding setup. The supplied API example demonstrates forwarding to a trunk IP. Verify the receiving requirements with your AI provider before deployment. The platforms below are examples of external AI voice platforms to evaluate for compatibility; they are not presented as Postman-validated integrations.
Bland.ai | Vapi | Retell AI |
Twilio Flex | Custom LLM | Compatible Telephony Platform |
More API Guides
|
| ||||
|
|
FAQ — AI Agent Phone Integration
Can I use PBXMe for AI phone agents?
Yes. First whitelist the source IP of the server making the API calls in your account portal. Log in with your account username/password and the fixed initial x-auth-token from the API documentation; after Login, use the generated session x-auth-token for subsequent API requests. You can then provision a virtual number through the documented DID API and configure its forwarding destination. The supplied API reference shows forwarding to a trunk IP; the final connection to an AI agent depends on the telephony interface supported by your AI platform.
Does PBXMe support SIP trunking for AI agents?
The supplied API reference demonstrates DID forwarding with call_type=2 and a trunk IP in call_type_value. Use only destination types supported by your PBXMe account and by the receiving AI platform. If your deployment uses SIP or another telephony handoff, verify that configuration separately with the receiving platform.
Can I change the AI agent a number routes to without releasing it?
Yes. The DID Forward Setting endpoint is designed to update the forwarding configuration of a purchased DID without releasing it. Use the supported call_type, call_type_value, and forwarding-condition fields required by your destination.
Can I get a local number in a specific country for my AI agent?
Use the optional numeric country_id provided in the Country List reference/example, then DID Available List to check current inventory for that country. Number availability depends on country, number type, inventory, and any applicable provisioning requirements. The current API reference marks the Country List call as disabled and provides the country IDs in its example.
Give Your AI Agent a Phone Number Today
Create an account, authenticate through the Login call, provision a DID, and configure its forwarding destination for your AI voice workflow.
