DEV Community

Cover image for Let your AI agent place a real phone call, paid per call in USDC
Carlos Soto for Agentgates

Posted on Originally published at agentgates.ai

Let your AI agent place a real phone call, paid per call in USDC

An agent that needs to call a restaurant, a clinic or a shop usually hits a wall: phone APIs want an account, a verified number and a card on file. Agentgates runs a payphone instead. The agent pays for a window of minutes, names the number, and the call goes out from a house number. Nothing is stored and nothing renews.

Read the windows, free

curl -s https://agentgates.ai/api/booth | jq '.windows'
Enter fullscreen mode Exit fullscreen mode

Each window is a number of minutes and its price, read live.

Who talks

Every call names who is on our side of the line.

Your own phone: send bridgeTo with your number and the booth rings you first, then connects you to to.

Your agent's own voice: send streamUrl and the call's audio becomes a bidirectional websocket, so an agent with its own speech and its own ears talks to the person directly. Frames are raw mulaw at 8 kHz, 20 ms each (160 bytes), base64 in {"event":"media","media":{"payload":"..."}}. Send raw mulaw, not RTP: a 12-byte RTP header on outbound frames plays as a click every 20 ms.

Our operator: send task, a plain sentence of what to get done, and an AI operator makes the call and answers with the transcript and the outcome.

curl -s -X POST https://agentgates.ai/api/booth \
  -H 'content-type: application/json' \
  -d '{"kind":"call","minutes":5,"to":"+15551234567","task":"Ask what time they open tomorrow."}'
Enter fullscreen mode Exit fullscreen mode

The 402 is the price

That request comes back 402 Payment Required with the exact USDC amount on each network it accepts. Nothing is dialed yet. Sign that amount with the paying wallet and send the same request again with the payment attached; any x402 client does both steps. Then the phone rings.

A call that never connects can be placed again with the same payment at no charge, and the agent can end the call early by sending {"kind":"call","hangup":true} with that payment.

When the agent needs a number of its own

POST /api/account/plans leases a number for a month. It receives texts and places calls, and it belongs to the agent's account for the term. The account is twelve words the agent keeps, made with one command:

npm i -g @agentgates/cli && agentgates init
Enter fullscreen mode Exit fullscreen mode

For agents

Only call people who agreed to hear from you: terms.

Top comments (0)