Skip to main content
Your AI agent or PBX places an outbound call through Plivo, then sends REFER mid-call to hand off to a human agent. Plivo bridges the caller to the transfer target and disconnects your endpoint. No re-dial, no dropped call.
Use this guide when your endpoint placed the outbound call and wants to transfer it to another destination. For inbound call transfers, see SIP REFER — Inbound Calls.

Prerequisites

RequirementDescription
Outbound SIP trunkAn outbound Plivo SIP trunk with your endpoint registered via IP ACL or credentials.
REFER-capable endpointYour SIP endpoint (PBX, softphone, AI agent) must support sending SIP REFER requests.
Phone numbersAt least two Plivo numbers — one for the customer leg, one as the transfer destination.

How it works

StepWhat happens
(1) Call establishedYour endpoint dials the customer via your Plivo SIP trunk. The customer answers.
(2) REFERYour endpoint sends REFER with the transfer target’s number in the Refer-To header.
(3) AcceptedPlivo responds 202 Accepted and sends NOTIFY 100 Trying.
(4) New legPlivo places a new call to the transfer target.
(5) ConnectedTransfer target answers. Plivo sends NOTIFY 200 OK.
(6) BYEPlivo disconnects your endpoint. Customer and transfer target continue the call.

Step-by-step guide

Step 1: Set up your outbound trunk

  1. Go to cx.plivo.com/sip-trunkingOutbound Trunks
  2. Click Create New Outbound Trunk, create a credentials list, and save
  3. Copy the Termination SIP Domain — for example, XXXXXXXXXXXX.zt.plivo.com

Step 2: Place the outbound call

Your endpoint dials the customer via your SIP trunk domain:
sip:<customer-number>@XXXXXXXXXXXX.zt.plivo.com

Step 3: Send the REFER

When ready to hand off, send a REFER with the transfer target in the Refer-To header. Refer-To header format:
Refer-To: <sip:+14155551234@XXXXXXXXXXXX.zt.plivo.com>
Use your SIP trunk domain in the Refer-To header. Transfers to other domains or arbitrary SIP URIs are blocked.
Example REFER message:
REFER sip:trunk@XXXXXXXXXXXX.zt.plivo.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.100:5060;branch=z9hG4bK-524287-1
From: <sip:endpoint@pbx.example.com>;tag=12345
To: <sip:trunk@XXXXXXXXXXXX.zt.plivo.com>;tag=67890
Call-ID: 1-12345@192.168.1.100
CSeq: 1 REFER
Contact: <sip:endpoint@192.168.1.100:5060>
Refer-To: <sip:+14155551234@XXXXXXXXXXXX.zt.plivo.com>
Max-Forwards: 70
Content-Length: 0

Step 4: Handle NOTIFY messages

After 202 Accepted, Plivo sends NOTIFY messages to report transfer progress. Your endpoint must respond to each NOTIFY with 200 OK.
NOTIFY statusMeaningWhat to do
SIP/2.0 100 TryingPlivo is calling the transfer targetShow “Transferring…” in your UI. Keep the call active.
SIP/2.0 180 RingingTransfer target is ringingOptionally relay ring-back tone to the caller.
SIP/2.0 200 OKCaller and target are connectedYou may hang up your leg (or wait for Plivo’s BYE).
SIP/2.0 4xx / 5xxTransfer failedCaller is still on your line — retry or continue the call.
Do not send BYE before receiving NOTIFY 200 OK. Sending BYE early drops the caller before the transfer completes.

Step 5: Call continues between customer and transfer target

Plivo bridges the caller to the transfer target and sends your endpoint a BYE.

What callers experience

  • During the transfer: The caller hears ring-back from the transfer target (180 Ringing) until the target answers.
  • If the transfer fails: The caller remains on your leg. You can retry with a different number or continue the conversation.
  • Music on hold: To play hold music while the transfer leg is establishing, play audio from your endpoint before sending REFER.

Response codes

CodeMeaning
202 AcceptedREFER accepted — transfer is in progress
400 Bad RequestMissing or malformed Refer-To header
403 ForbiddenRefer-To domain is not a valid Plivo SIP trunk domain, or transfer target is a private IP

Troubleshooting

SymptomCheck
403 ForbiddenVerify the Refer-To domain ends in .zt.plivo.com. Ensure the target is not a private IP.
400 Bad RequestVerify the Refer-To header uses E.164 format: sip:+14155551234@trunk.zt.plivo.com.
202 Accepted but caller is droppedYour endpoint sent BYE before receiving NOTIFY 200 OK. Wait for NOTIFY 200 OK first.
202 Accepted but no NOTIFY receivedEnsure your endpoint listens on the same IP/port it advertised in the Contact header.
Transfer fails (NOTIFY 4xx/5xx)Check that the destination is valid, reachable, and not busy. Verify account balance.
Transfer to international number returns 403Enable that destination under Geo Permissions.
No audio after transferCodec mismatch between legs. Contact Plivo Support with the Call-ID.