Transfer Call & Disconnect

FreePBX/Asterisk 14

When I transfer a call off-PBX via Miscellaneous Destination I notice that the channels stay up in Asterisk until the call is truly complete (original caller or miscellaneous destination hang up). Is there another command I could use in the dialplan to send the call to the off-PBX phone number and then disconnect Asterisk?

Thank you!

No because both channels of the call are going through the PBX. That is what happens. The incoming call came into the PBX, that is channel A. If the call is transferred by the Misc Dest then that is creating Channel B to make the outbound call to the PSTN. Once the call is answered Asterisk is bridging the channels together. Just like any call. By disconnecting Asterisk you’re disconnecting the call.

This is how any PBX works, it just magically can’t pass the call to nowhere. It is both the destination (to incoming) and source (outgoing) of that call.

What are you trying to accomplish? If you just want to get Asterisk out of the audio path (to reduce latency or conserve CPU or network bandwidth), enable canreinvite for both trunks. For this to work, Asterisk must not be recording the call, transcoding, or listening for DTMF. Also, both providers must handle the reinvite correctly. If the outbound provider does not proxy media, uses multiple upstream carriers for the called number and does not allow you to choose carriers explicitly, there is a risk that calls will intermittently fail.

With some custom dialplan and if the incoming trunk supports call transfer, you could have the PBX command the incoming provider to transfer the call. On FreePBX this would normally be undesirable; the CDRs would not show the call duration, there would be no way to end a call that fails to disconnect, and you would still have to pay for both legs. However, it might make sense on a PBX that is licensed based on number of simultaneous calls.

For very large toll-free users of major carriers such as AT&T and Verizon, commanding them to transfer the call will eliminate charges for the outbound leg (you’ll still pay for the inbound). See

1 Like

We have an Avaya Communications Manager and a FreePBX box, both are trunked through an Avaya Session Manager. Most of the time the calls start (introduction & menuing) and end (queue/agents) on Avaya.

We use the FreePBX as a feature server. Between the introduction and the ending we may offer various services (like callbacks and automated information). Every time we do this (Avaya to Asterisk to Avaya), we consume additional trunks. It becomes a burden from a CPU and network standpoint, as we reach out peak volumes each day.

The customer call comes from Avaya Session Manager (like Kamilio) to Asterisk. Asterisk does its thing and figures where to send the call back into Avaya, also using Avaya Session Manager as it’s trunk. I was hoping there would be an easy way to disconnect Asterisk at this point, as it is no longer needed.

It sounds like if the Avaya Session Manager has reinvite on the trunks to and from Asterisk turned on, Asterisk could hang up after the transfer and the call would stay up then?


As long as you are sending calls through Asterisk it will be needed. It needs to be there for the channels. As I said before the call can’t be bridged together on Asterisk and then pushed off somewhere.

Based on what @Stewart1 is saying is correct though, since both parties (the far end on each channel) are on the same Avaya Session Manager via SIP trunks, if the session manager trunks are set to canreinvite, shouldn’t the call stay up with Asterisk out?

I was going to try a small test later today or Monday.

You’re confusing RTP with the actual channels. As I have explained, the ASM is going to send a call to the PBX, the PBX is going to accept that call. At this point that call never has to leave the PBX. That is a single channel. Now you can use redirects/diversions to send that call back to the ASM telling it to send the call somewhere else but if the PBX needs to answer the call and process things like an IVR or recordings or something else then that option is out the window.

When the PBX has processed this call and then hits a Dial() this opens a new channel to dial the destination(s). Now you just happen to be sending the call back to the ASM and once that call is answered Asterisk needs to tell Channel A that Channel B was answered and bridge the channels together. At this point you can use direct media and Asterisk will proxy th media through it looking for things like In-Call codes, transfers, MoH, etc and will inject itself back into the media stream as needed.

However, the actual channels still exist and how the signaling is done and processes still requires the call to be on Asterisk. In order to avoid this you have to avoid using Asterisk completely for the call or redirect it immediately without using any thing in the PBX that would require interaction or answering the call.

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