Home API Hub API AI Agent Integration

 

API Use Case

Give Your AI Agent a Real Phone Number

Connect any AI voice agent or LLM to a real local phone number in 145 countries. Provision via API, route inbound calls to your AI system in real time.

Why AI Agents Need a Real Phone Number

AI voice agents — whether built on Bland.ai, Vapi, Retell, or your own LLM — need a real, dialable local phone number to make and receive calls. Without one, they can only work inside apps or browsers. With a PBXme virtual number, your agent gets a local presence in any country, callable from any phone, with calls delivered via SIP or webhook to your AI platform in real time.

How to Connect PBXme to Your AI Agent

Three steps from zero to a ringing AI agent:

1

Provision a Virtual Number via API

Use the Login API to get your account_token, then call the Available DIDs endpoint to find a number in your target country. Use DID Assign to add it to your account. This takes seconds and works programmatically — no dashboard needed.

2

Set the Forwarding Destination to Your AI System

Use the DID Forward Setting API to route incoming calls to your AI agent’s SIP URI (e.g. agent@yourplatform.com) or to a PSTN number that your platform provides. This can be updated at any time via API without releasing the number.

3

Receive Calls — Your AI Agent Answers

When someone dials the number, PBXme forwards the call to your configured destination. Your AI agent picks up, handles the conversation, and can optionally push webhook events back to your system for logging or follow-up actions.

Python: Provision a Number & Route to Your AI Agent

Full working example — provision a UK number and point it directly to your AI agent’s SIP address:

import requests

BASE = "https://newsip.pbxme.com/api"
# ── Step 1: Login ──────────────────────────────────────────
login = requests.post(f"{BASE}/login", data={
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD"
})
token = login.json()["account_token"]
print(f"Logged in. Token: {token[:10]}...")

# ── Step 2: Find available numbers in the UK ────────────────
available = requests.post(f"{BASE}/did/available", data={
    "token": token,
    "country": "GB"        # ISO country code
})
dids = available.json()["dids"]
chosen = dids[0]           # pick the first available
print(f"Found: {chosen['did_number']} — ${chosen['monthly_cost']}/mo")

# ── Step 3: Assign the number to your account ───────────────
assign = requests.post(f"{BASE}/did/assign", data={
    "token": token,
    "did_id": chosen["did_id"]
})
print("Assigned:", assign.json())

# ── Step 4: Route calls to your AI agent's SIP URI ──────────
AI_SIP_URI = "sip:agent@your-ai-platform.com"  # ← your platform URI

forward = requests.post(f"{BASE}/did/forward", data={
    "token": token,
    "did_id":      chosen["did_id"],
    "destination": AI_SIP_URI,
    "type":        "sip"
})
print("Forwarding set:", forward.json())
print(f"✅ {chosen['did_number']} now routes to your AI agent!")

Compatible AI Voice Agent Platforms

PBXme works with any platform that accepts SIP trunking or PSTN forwarding as inbound call delivery. Common integrations include:

🟣Bland.ai
🔵Vapi
🟢Retell AI
Twilio Flex
🟠Custom LLM
⚙️Any SIP platform

FAQ — AI Agent Phone Integration

Yes. You provision a virtual number via API, then set its forwarding destination to your AI platform’s SIP URI or PSTN number. Calls to your PBXme number are delivered directly to your AI agent.

Yes. PBXme includes a full IPBX SIP trunk with every account. You can forward incoming calls to any SIP URI, which is the standard way to deliver calls to AI voice agent platforms.

Yes. The DID Forward Setting API can update a number’s destination at any time without releasing or reprovisioning the number. This lets you switch between agents or environments instantly via a single API call.

Yes. PBXme offers virtual numbers in 145 countries. Your AI agent can have a local number in the US, UK, Germany, Israel, or any other supported country, making it appear local to callers in that region.

    Sales, click to chat