Deflect sends a SIP REFER to the originator of an answered call.
The deflect application allows to be removed from the list of connection hops and tell the originator to reroute the call. When using the deflect application, FreeSWITCH first hangs up (*) the channel and then sends a REFER message and a new INVITE message to the originator. The originator, which could be a gateway or SIP proxy, should read the INVITE and reroute the call accordingly.
(*) Starting with FreeSWITCH 1.10.7, a variable named sip_refer_continue_after_reply is introduced, if
True, will let the current call continues as is, after sending the REFER message. This is useful when testing rfc4579 REFER method to request a Focus to Add a New Resource to a Conference
The only parameter should be the SIP URI to contact (with or without "sip:")
<action application="deflect" data="sip:email@example.com" />
Refer can only be used on established calls. That means if the channel has been answered (using the answer app), you can use deflect to send a REFER message back to the originating URI. If If the channel has not been answered, then you should use the redirect application to route the call.
REFER is a SIP method as defined by RFC 3515. The REFER method indicates that the recipient (identified by the Request-URI) should contact a third party using the contact information provided in the request.
Although this is not "deflect" related, but REFER related, it can be useful to know you can retrieve variables with Variable_export_vars in the a-leg from your initial INVITE when the REFER method hits the dialplan.