Direct Call

Direct Call vs AI calls

Two ways to make a phone call on EurekaConnect. Same numbers, same billing, same webhooks — the only difference is who talks.

AI call Direct Call
Who speaks to the customer An agent you configured You — your audio, whatever it is
How you start it POST /v1/calls Open a WebSocket, then send dial
Who holds the audio We do You do, over the socket
What you send us An agent ID PCM audio chunks
Your process during the call Nothing — it's over HTTP Connected the whole time
Cost Carrier + model Carrier only

"Your audio" means exactly that. A human on a headset, your own AI, a pre-recorded file, a text-to-speech engine we've never heard of. We don't inspect it and we don't care — it's a pipe.


The AI call

You ask for a call, we make it, an agent runs it, you get a webhook when it ends. Your code is not involved in between.

curl -X POST https://platform.eurekatechlabs.com/v1/v1/calls \
  -H "Authorization: Bearer ek_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "from_number": "+60123456789",
    "to_number":   "+60198765432",
    "agent_id":    "your-agent-id"
  }'

That's the whole integration. Done in one request.


The Direct Call

You connect first, then dial from the connection. That ordering is the whole design — it is what makes your client the audio endpoint from the first ring.

const ws = new WebSocket(`wss://core.eurekatechlabs.com/v1/direct-call/${productId}?token=${token}`);
ws.binaryType = 'arraybuffer';

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: 'dial',
    from: '+60123456789',
    to:   '+60198765432',
  }));
};

ws.onmessage = (e) => {
  // Binary = their voice. Play it.
  if (typeof e.data !== 'string') return playPcm(e.data);

  const frame = JSON.parse(e.data);
  if (frame.type === 'answered') startSendingMyAudio();  // they picked up
  if (frame.type === 'call.ended') cleanUp();
};

// Your voice, whenever you have it: raw PCM, straight down the socket.
function sendChunk(pcmBuffer) { ws.send(pcmBuffer); }

Audio is pcm_s16le@24000 — signed 16-bit PCM, 24 kHz, mono — both directions. Send it in binary frames, receive it in binary frames. Everything else is JSON.

Full frame-by-frame detail is in the protocol reference; a complete working page is in the quickstart.


Side by side

AI CALL
  you ──POST /v1/calls──► us ──► phone network ──► customer
                          │
                          └─ agent talks, you wait
  ◄──────────── call.ended webhook ─────────────────

DIRECT CALL
  you ══WebSocket═══════► us ──► phone network ──► customer
      ── {"type":"dial"} ─►
      ◄── ringing, answered ──
      ══ your audio ═════════════════════════════►
      ◄═════════════════════════ their audio ═════
  ◄──────────── call.ended webhook ─────────────────

Both on the same number

A product has two capabilities — AI Agent and Direct Call — and you can turn on both. They are not modes you switch between. With both enabled, the same number does either, and you pick per call by choosing which API to call:

10:00   POST /v1/calls          → an agent qualifies the lead
10:15   WebSocket + dial        → a human calls the same person back,
                                  from the same number

Nothing to reconfigure in between. No waiting period. Enable both under Call Settings on the product page.

Two things to know about the mixed setup:

  • Inbound always goes to the agent. A call to your number is answered by your AI routing (or your call.answer webhook). Inbound Direct Call isn't available yet, so there's no ambiguity about who picks up.
  • Each call bills for what it was. A Direct Call has no model cost. They appear separately in call history and usage.

What's identical

Worth stating plainly, because it's most of the system:

  • Numbers — same registry, same assignment. from_number must belong to the product either way.
  • call.ended — same webhook, same payload, same recording_url.
  • Call history — both appear in the dashboard call list with their recording.
  • Balance — both refuse to start when the wallet is empty.
  • Recording — a two-channel WAV to S3, if the product has it on.

Permissions

You want Scope needed
Place an AI call calls:write
Open a Direct Call socket direct_call:connect
Dial from that socket direct_call:connect and calls:write

Connecting is not dialing. A key with only direct_call:connect can open the socket, but every dial is refused. That's how you hand a browser console live audio without also handing it the ability to originate calls on your numbers.

Edit a key's scopes any time under Product → API Keys → the key → Scopes. The key string doesn't change and there is nothing to rotate — the new permissions apply on its next request.

Test-mode (ek_test_) keys cannot place calls of either kind.


Which should I use?

Use an AI call when an agent should run the conversation. It's one HTTP request and we handle everything.

Use a Direct Call when the voice is yours: a human agent, your own speech stack, a softphone in the browser, a device in the field. You accept holding a connection for the length of the call; in exchange nothing sits between you and the customer.


Next