Transfer dialed party to active incoming call from dialplan

Hello Everybody!

I’ve installed asterisk 1.6 in two server.

I have a remote asterisk box that register itself as an extension to a local box.
The remote box can place calls throgh the local box’s extensions with the Dial command, and
it can call-screening to the caller using the “M” option (Macro).

The remote box accepts incoming calls from the local box,
put them on hold, and then dial an extension to the local box.

When the called local party press the dtmf ‘1’, it answers the call from the remote party.

Remote asterisk create two sip channels, one for the remote caller and one for the local extension called,
then bridge them for the entire duration of the conversation.

I wonder if it’s possible to avoid the call bridging and arbitrary transfer or merge
the two channels, without hangup the called, when the called press the ‘1’ dtmf.

I’ve already tried the command “Transfer” that sends a SIP REFER and it works ok as a blind remote transfer,
but it seems it can’t be used to replace the active bridged channels.


Here is an example of the extensions.conf that i have in the remote asterisk box:

  • “sip.conf”:

; incomings

; section of the register command
register =>

; definition of the second asterisk box

  • “extensions.conf”:

; incoming calls

exten => user,1,Answer()
exten => user,n,Dial(SIP/200@asterisklocal,10,M(callscreen))
exten => user,n,Hangup

; macro call-screening
exten => s,1,Answer()
exten => s,n,Background(transferer-number)

exten => 1,1,Set(MACRO_RESULT=) ; continue with the calls when the macro ends
exten => 2,1,Set(MACRO_RESULT=BUSY) ; signal BUSY and hangup the called

Transfer in the standard code is somewhat fragile, and as you say, only supports blind transfers.

In recent versions, it is possible to specify whether further transfers are permitted after a transfer. If deny them, I believe the call will be eligible for native bridging, which would take the RTP stream out of Asterisk. However, I suspect you want to retain the ability to do further transfers on the call.

Thanks for the reply!

What i need is the ability to enable the transfer after the called input some dtmf, and then closing the
connection on asterisk and create a native bridging within the two endpoints (caller/called).
I imagine it’s like put on hold the called, create a native transfer, replace the called channel on hold and hangup the active channels on asterisk , so basically the sip/rtp stream does not work within asterisk.
I’va also tried using the SIP Header “Replaces”, but it works only on INVITEs (when using the Dial command) and it’s not
parsed in the REFERs (Transfer command)…

I’m run out of ideas… :smile:

I’ll further investigate the transfer methodology in the newest version of asterisk…

Thanks a lot.

You will not be able to remove the SIP path with any standard version of the code, but, if canreinvite (directmedia? in later versions) is set to yes, and the call ends up configured such that Asterisk does not need to monitor it for DTMF, the RTP should be native bridged, although I’ve only personally done this with third party control.