An AI-to-human handoff into your own software

An AI-to-human handoff into your own contact-center software: a signed offer with the case, an API-key accept, and the live call audio over a websocket.

BİBekir İşgörCo-founder · · 13 min read
A loose line drawing on graphite of an open office with pendant lamps. In the foreground a woman in profile, wearing a headset, types at a monitor; small coral marks beside her mouth show she is speaking. Colleagues with headsets work at desks behind her.

An AI-to-human handoff on Talkif does not have to end at a phone number. With a Your app destination, your agent hands the live call to software you run: your own agent desktop, a CRM softphone, a BPO platform, or another voice system. Talkif sends your server a signed transfer.offer webhook carrying the caller and a structured handoff case. Your server replies within three seconds to say it is ringing, accepts the offer with an API key, and joins the call audio over a websocket. The caller never hangs up and dials again, and your agent sees the claim number before saying hello.

This post is the developer half of call transfer. It covers why the handoff should land in your own software, the whole loop in code, which call-center use cases it fits and which case fields each one needs, and what must never travel in a case. The reference is Receive transfers in your app.

The handoff should land where your agents already work

The usual way to hand a call from an AI agent to a person is to transfer the phone call to another number. The context then has to travel separately, and the common ways to send it each lose something. SIP headers can be stripped by a carrier on the way. A whisper before the caller is connected has to be remembered. A CRM entry written after the call arrives too late for the first sentence.

Contact-center platforms solved this long ago with a different shape: key and value fields plus a summary, attached to the call as it is queued, and shown on the agent's screen when it rings. Amazon Connect calls them contact attributes and shows them in the agent's softphone panel (AWS docs). Genesys Cloud calls them participant data and uses them for screen pops (Genesys docs). In Twilio's agent handoff, custom attributes passed by the AI surface as task attributes in Flex (Twilio docs).

When Telecom New Zealand put caller details on agents' screens as calls arrived, IBM's case study reported it saved "more than 17 seconds on inbound calls and 15 seconds on transferred calls", partly because callers no longer had to repeat their name and account details (IBM case study, 2001).

A Your app offer is that shape, delivered to your server instead of to someone else's queue. Here is the body of a real offer:

{
  "type": "transfer.offer",
  "offerId": "7d05b92a-1f7e-4a54-9d2e-3f0a1c5e8b10",
  "callId": "03e49616-49ae-41e8-8009-f34a3994bf9c",
  "deliveryId": "f1c2d3e4-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
  "expiresAt": "2026-09-29T12:16:49Z",
  "acceptUntil": "2026-09-29T12:16:36Z",
  "mode": "cold",
  "caller": { "number": "+905321234567", "name": "Ayşe Yılmaz" },
  "case": {
    "reason": "Wants to change the delivery address",
    "summary": "Order placed yesterday; caller moved.",
    "fields": { "order_no": "A-10442" }
  },
  "flowName": "Support line",
  "test": false
}

mode says whether the transfer is cold, where the caller is connected as soon as you join, or warm, where the AI agent first briefs whoever joined while the caller waits on hold. case.fields holds the fields you defined on the Transfer node. Mark one required, and the agent asks the caller for it before the transfer starts, so order_no is there when your agent's screen opens rather than being the first question they have to ask.

The whole loop, step by step

A handoff into your software is four exchanges. Talkif offers, your server says it is ringing, your server accepts, and your server joins the audio.

A sequence diagram with two lanes, talkif and your server. Arrows from top to bottom: offer from talkif to your server, 2xx back, accept from your server, join from talkif, and a coral double-headed arrow labelled audio between the lanes. A block labelled agent desktop hangs off the your server lane.
The offer and the accept decide who gets the call; the websocket opened after the accept carries its audio.

1. Verify the offer

Every offer is signed. The Talkif-Signature header reads t=<unix seconds>,v1=<hex HMAC-SHA256>, and v1 is the HMAC of "<t>.<raw request body>" with your destination's signing secret. Verify against the raw bytes you received, before parsing the JSON, reject a timestamp more than five minutes old, and compare in constant time:

import { createHmac, timingSafeEqual } from "node:crypto";
 
export function verifyTalkif(rawBody, header, secret, toleranceSecs = 300) {
  const parts = header.split(",");
  const t = parts.find((p) => p.startsWith("t="))?.slice(2);
  const sigs = parts.filter((p) => p.startsWith("v1=")).map((p) => p.slice(3));
  if (!t || Math.abs(Date.now() / 1000 - Number(t)) > toleranceSecs) return false;
  const want = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return sigs.some(
    (s) => s.length === want.length && timingSafeEqual(Buffer.from(s), Buffer.from(want)),
  );
}

The header can carry two v1 values. That happens during a secret rotation: the old secret keeps signing for 24 hours next to the new one, so you can deploy the new secret without dropping a call. Use Talkif-Delivery-Id to drop duplicates.

2. Say it is ringing, then decide

Reply 2xx within three seconds. That reply means "ringing here". Any other status, a timeout or a connection error counts as a decline for this call, and the transfer moves on to the other members of the group. So reply first and decide afterwards: put the offer in front of an agent, check your own queue, and only then accept. Webhooks are not retried. A call rings for seconds, and a retry would arrive after the caller had gone.

3. Accept with an API key

Accept with an API key scoped to transfer_offers:* (or transfer_offers:read plus transfer_offers:write). It can view, accept and decline offers and nothing else. Scopes are required: a key created without any is refused. And keep keys with the transfers scope, which can change destinations, off the server that receives webhooks.

curl -X POST https://api.talkif.ai/api/v1/transfers/offers/$OFFER_ID/accept \
  -H "Authorization: Bearer $TALKIF_API_KEY"

The reply carries a joinUrl, a single-use joinToken, the callId and an expiry. Accept before the offer's acceptUntil. If your agent decides not to take the call, decline it with POST /transfers/offers/{offerId}/decline (it returns 204), and the transfer moves on without waiting for the ring to time out. GET /transfers/offers/{offerId} returns the offer as it was delivered.

4. Join the call audio

Within 10 seconds of accepting (20 seconds over WebRTC), open a websocket from your server to joinUrl, with the token as the token query parameter if joinUrl does not already carry it. An accept that never joins counts as unanswered, and the AI agent carries on with the caller.

Audio16 kHz, 16-bit signed little-endian PCM, mono
FramesBinary messages of 640 bytes (20 ms), both directions
You sendYour audio as binary frames, and silence frames when you have nothing to say
Control{"type":"mute","muted":true} and {"type":"hangup"} as text messages

The call ends when either side hangs up: you close the socket or send hangup, or the caller leaves and Talkif closes it. If your side hangs up within 15 seconds of being connected, the agent comes back to the caller instead. The websocket is a server-to-server connection, and your server relays the audio to wherever your agent is.

To take the audio over WebRTC rather than a websocket, send your SDP offer in the accept body, {"sdpOffer": "<your SDP offer>"}. The reply then carries sdpAnswer to apply to your peer connection and iceServers to connect through. Join within 20 seconds.

What can go wrong, and what you get back

The caller is waiting through all of this, so every failure has a defined answer and none of them leaves the caller in silence.

What happenedWhat you seeWhat the caller hears
Your server replied late or not 2xxNothing more for this call; the delivery log shows No response within 3 s, HTTP <code> or similarThe other group members keep ringing, or the agent carries on
Someone else in the group answered first409 offer_taken on accept, and a transfer.offer.withdrawn webhook with reason: "answered_elsewhere"Your colleague who answered
You accepted after acceptUntil409 offer_expiredThe agent carries on
The offer ran out before anyone took ittransfer.offer.withdrawn with reason: "expired"The agent carries on
The caller hung up while it rangtransfer.offer.withdrawn with reason: "cancelled"Nothing; they are gone
You accepted but never joinedThe offer counts as unansweredThe agent carries on with the caller
The signature does not matchYour verification rejects itTreat it as not from Talkif; do not reply 2xx

The withdrawn webhook is best effort, sent once, so use it to stop ringing in your own interface but do not depend on it. Retrying an accept with the same key returns a fresh join for the same claim, which covers a dropped connection between accept and join.

Under the destination's Send test button, Talkif sends your URL a sample offer with "test": true, and the last 20 deliveries are listed under Recent deliveries with the error, if there was one.

AI voice agent call center use cases, and the fields each one needs

The mechanism is the same for every team. What differs is when the AI should hand over and which fields your agent needs on screen. These are the use cases where a handoff into your own software pays off most, with the published results where a named organisation has reported them. Every number below is reported by the vendor or the customer, not measured by us.

Insurance claims intake

The AI takes the first notice of loss at any hour, in the caller's language: what happened, when, where, who was involved. It hands over when the claim needs an adjuster's judgement or the caller asks for a person. Aspire General Insurance runs claims intake this way with a warm transfer to its claims staff "when needed" (FinTech Global, March 2026).

Case fields: policy number, claim number if one was created, date of loss, type of loss.

Collections

The AI confirms it is speaking to the right person before it says anything about a debt, then either sets up a payment plan or hands over. In the US, Regulation F bars a debt collector from communicating about a debt with anyone other than the consumer and a short list of others such as their attorney (12 CFR 1006.6(d)), which is why identity is checked first and why the handoff should record that it was.

Case fields: account ID, whether identity was verified, the amount discussed, a promise-to-pay date if one was given.

Healthcare scheduling

The AI books, moves and cancels appointments and answers routine questions, and hands over anything clinical or complex, and any patient who is upset. Tampa General Hospital reported that after putting a voice agent on its lines, appointments booked rose 21% within two weeks and daily call abandonment fell 56% (American Hospital Association).

Case fields: the patient's identity as your system keys it, the department, the kind of request.

Utility outage peaks

During an outage most callers ask one question: when is the power back at my address. The AI answers that from the outage data and hands over the calls that are about something else. PG&E's agent gives outage status and restoration times on its outage line and answers billing questions in English and Spanish; PolyAI reports an overall containment of 67% (PolyAI customer page).

Case fields: service address, outage reference if known, language.

BPOs running several clients

An outsourcer that answers lines for many clients usually runs them on one platform of its own. Give each client its own flow and point every flow's Transfer node at the same Your app destination: the offer's flowName tells your platform which client and line a call belongs to, so one receiver routes them all into the right client queue.

Case fields: whatever each client's playbook needs; flowName does the client routing.

E-commerce order issues

The AI answers where an order is and starts simple returns, and hands over the changes it should not make alone, such as a new delivery address after the parcel has left. This is the example in the offer above.

Case fields: order number, the item, what the caller wants changed.

Groups: your app, your phones and your people together

A Your app destination does not have to be the only target. Put it in a destination group with phone numbers and people in the dashboard, and they all ring at once. The first to accept gets the call, and everyone else stops ringing; your server learns about it from the answered_elsewhere withdrawal. That makes it possible to roll out gradually: your own desktop takes the calls it can, and a desk phone or the dashboard catches the rest.

Your app joins over the internet, so its leg of the call has no carrier minutes; the AI agent is billed until it leaves, as on any transfer. To see how handoffs are going, compare the offers your server received with the ones it accepted: the delivery log shows every attempt, and an accept that was refused tells you why.

If you run a contact-center platform that cannot take an audio stream from your own server, the simpler route today is a phone-number destination that dials your queue's number, combined with a warm transfer so the agent hears the case before the caller is connected. Direct SIP-address and websocket-protocol destinations are not available yet.

What never goes in a case

A handoff case is copied to your server, stored on the call, shown on screens and read out in a warm briefing.

Card numbers and security codes never go in a case field, a summary or a transcript. The PCI Security Standards Council's guidance on telephone payments is blunt about it: card security data "must not be stored after authorization, even if encrypted", and any system that receives card data is in scope for PCI DSS (PCI SSC, Protecting Telephone-Based Payment Card Data, 2018). Take payments in a separate, compliant step, not through the AI's case.

If cases will carry health information, talk to us about a data-processing agreement first. Where calls are recorded, the caller's consent may be required, from everyone on the call in some places, California among them, and in the EU the AI Act requires telling people they are talking to an AI. A fixed line at the start of the call is the usual way to handle both; check what your jurisdiction requires.

What we built in on our side

The accept endpoint takes API keys only; a dashboard sign-in is refused there. The key it needs can do nothing but view, accept and decline offers. Every accepted offer is recorded together with the API key that accepted it, before the join is handed out, and if that record cannot be written the accept fails and the offer goes back to ringing. The signing secret is generated with 32 random bytes, shown once, and stored encrypted. Each delivery attempt is logged with a fixed error vocabulary, and nothing your server said in reply is stored. Webhook URLs must be HTTPS on a public host; private, internal and loopback addresses are refused.

LimitValue
Webhook reply3 seconds
Join after accepting10 seconds (20 seconds over WebRTC)
Your app destinations10 per account
Send test5 per destination per minute, 30 per account per hour
Delivery logLast 20 per destination, kept 30 days
Old secret after rotationValid for 24 hours

Set it up

  1. Under Settings → People & numbers → Add destination → Your app, enter a name and your HTTPS webhook URL. Copy the signing secret; it is shown once.
  2. Create an API key with the transfer_offers scope and nothing else, for the server that will accept.
  3. On the Transfer node, under Who should get the call?, choose Your app, or add the destination to a group.
  4. Add the case fields your agents need under What should the AI collect first?, and mark the ones they cannot work without as required.
  5. Click Send test, check your server verified the signature and replied in time, then publish the flow.
Read next
  1. Marketing

    You bought tappers, not buyers

    Meta lead ads look cheap and sell nothing. We phoned every lead with a partner and found eight reasons the ads fail, and what fixes each one.

  2. Developers

    Turn detection that doesn't talk over you

    How our voice agent's turn detection decides a caller has finished, when an interruption is real and when to stay quiet, and the incidents behind it.

Questions about this piece? Write to us.