Inbound Call to External Transfer with Twilio via SIP REFER

Hello All,

I’m outside of my realm of understanding and hoping someone here can shed some light.

In the “analog” world, I could initiate a “Flash” and transfer a caller to another phone number and free up my lines. If I remember right, this would also stop charging me for the call.

I would like to use this same kind of functionality to transfer inbound calls to external numbers. The trunks I’m trying to do this with are Twilio.

Twilio indicates that this can be done via SIP REFER, best I can tell.

The goal is to have the call carrier-level transferred to the external number. That way the call doesn’t stay routed through our PBX (what we currently do)

Here is the article I found from Twilio: Twilio - Call Transfer

Is this possible? If so, any guidance on “next steps” to setup the “SIP REFER” Transfer in FreePBX would be greatly appreciated.

Thank you

Though not directly supported in FreePBX, you could write some custom dialplan that invokes the Asterisk transfer command; see

However, for most applications, I’d expect that simply enabling Direct Media for the trunk(s) involved would get the PBX out of the RTP path and give you the desired benefits without the complexity (for example, avoiding it if the call is being recorded) and without losing accurate CDR records and other logging information.

With either option, Twilio will still bill you for both legs of the call.

Please describe your application and explain why you want to transfer.

Thanks @Stewart1 for this response. I have started exploring the transfer() command. I haven’t been able to achieve the desired result yet. I’m also not familiar with Direct Media.

My overall goal:

I have a location with an IVR that routes to a combination of internal and external numbers. If an option is chosen that routes to an external number, I would like the call to route directly from the carrier to that number. Mainly because I don’t want the call to suffer quality issues by being routed through our PBX to an External Number. It seems like getting our PBX out of the call path makes the most sense.

I hope that makes sense.

If it works correctly, Direct Media will cause the audio packets to flow directly between the two Twilio servers, while keeping Asterisk in the signaling path. This means that the CDRs will show correct call duration. Also, FreePBX can track when the agent is on a call, e.g. to send a second incoming call to a different agent, or to queue it until the first call has ended.

Hello @Stewart1

Thank you for this information. In our situation, we don’t need to track the calls outside of them hitting the PBX and then being redirected. If the call is transferred to an external number, we consider it “finished” on our side as another party is handling it after that.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.