Hi everyone,
I’m running a voice agent on LiveKit Cloud connected to a FreePBX (Asterisk, PJSIP) server, and I need help adding “transfer to a human” behavior.
Setup
- LiveKit Cloud project, region EU (Frankfurt)
- Agent built and deployed with Agent Builder
- Model in Agent Builder: OpenAI GPT-Live 1 (realtime)
- Language: Egyptian Arabic (law-office receptionist prompt)
- Inbound SIP trunk in LiveKit: allow-lists my FreePBX server IP
- Dispatch rule: type “Individual”, room prefix “call-”
- FreePBX: a PJSIP trunk pointing to my LiveKit SIP endpoint
Current call flow (works end to end)
Caller → FreePBX Inbound Route (test DID) → FreePBX Queue 925
→ Queue static agent (a dummy number) → FreePBX Outbound Route
→ PJSIP trunk to LiveKit → LiveKit room → my agent
Audio is good, the agent answers and talks normally. I route through a
Queue so I can listen in and count calls.
What I want
When the caller says something like “transfer me to a human”, the agent
should hand the call to a FreePBX queue (extension 555) so a human agent
picks up. A cold transfer is fine.
What I found so far
The docs describe the TransferSIPParticipant API (SIP REFER) with a
function tool in code agents, like:
transfer_to = "sip:555@<my-freepbx-host>"
await job_ctx.api.sip.transfer_sip_participant(
api.TransferSIPParticipantRequest(
room_name=..., participant_identity=..., transfer_to=transfer_to
)
)
But I couldn’t find anything about doing this inside Agent Builder.
Questions
- Does Agent Builder have a built-in tool for call transfer / SIP REFER?
If yes, where do I enable it and what format should the destination
use (sip:555@host or tel:555)? - If not, can I add a custom tool in Agent Builder, or must I move to a
code-based agent deployed to LiveKit Cloud? - In my flow FreePBX is the one that originated the call to LiveKit
(outbound trunk). Is SIP REFER from LiveKit back to FreePBX supported
in this direction? Is there any known requirement on the Asterisk/PJSIP
side (allow_transfer, transfer context, etc.)? - I read that TLS is incompatible with REFER. My trunk uses
[UDP / TCP - please check which one you use] transport. Is that fine? - Is there a way to test the transfer manually during a live call
(for example withlk sip participant transfer) to confirm FreePBX
accepts the REFER before wiring it into the agent?
I can share SIP logs (pjsip set logger on) and agent logs if needed.
Thanks a lot!