Skip to main content

mod_dptools: transfer

About

Immediately transfer the calling channel to a new context. If there happens to be an xml extension named <destination_number> then control is "warped" directly to that extension. Otherwise it goes through the entire context checking for a match.

TODO What is the difference between uuid_transfer in mod_commands and mod_dptools: transfer?

Click here to expand Table of Contents

Description

Immediately transfer the calling channel to a new context. If there happens to be an xml extension named <destination_number> then control is "warped" directly to that extension. Otherwise it goes through the entire context checking for a match.

Example: say caller dials 3015551212, causing conf/dialplan/public/3015551212.xml to "answer". If 3015551212.xml does an:

<action application="transfer" data="1047 XML cntxt_a"/>

that causes the conf/dialplan/cntxt_a/1047.xml to be parsed (assuming that file does a match on "^1047$". If dialplan or context are not defined, they default to XML and default.

The transfer app does not actually "transfer a call" (It might have been better named dialplan-jump). It changes the destination extension and/or context and restarts the parsing of the dialplan. Actual transfers are done after a call is answered by use of the bridge application. see bridge.

Each transfer app call will decrement max_forwards variable that is by default set to 70. After 70 transfers the call will go on-hook. If you have a large IVR dialplan application, to prevent call going on-hook, you can set max_session_transfers variable to a large value. Once max_session_transfers is defined for a channel, max_forwards is not touched by transfer application, and the value in max_session_transfers gets decremented.

Usage

transfer <destination_number> [<dialplan> [<context>]]

Examples

<action application="transfer" data="500"/>

This example is found in public.xml. It transfers the call to the given extension in the default context, which is located in default.xml. Please note the use of XML as a dialplan as it is defined in freeswitch.xml

<extension name="public_extensions">
<condition field="destination_number" expression="^(10[01][0-9])$">
<action application="transfer" data="$1 XML default"/>
</condition>
</extension>

If the call is currently in a bridge it will transfer the other side of the call instead of itself:

<action application="transfer" data="-bleg 2103"/>

This would transfer both legs of the call to the same ext. i.e a conference extension:

<action application="transfer" data="-both 2103"/>

When a call is transferred back through the dialplan, the RDNIS value is populated with the previous destination_number value.

Note: You can also specify an inline dialplan

Note: Transfer will begin parsing extensions from the beginning of the dialplan. Be careful to avoid loops.

Note: The transfer application also works with mod_xml_curl, it just does another request to mod_xml_curl and starts over again, just like in the static dialplan.

Comments:

In lua, try session:getVariable("max_session_transfers") got nil.How can I get the channel variable max_session_transfers ? Thanks. Posted by livem at Aug 29, 2017 22:16
Initially max_session_transfers is not set. You need to set it to a numeric value; only then this variable going to be decremented instead of max_forwards. Posted by tomasb at Apr 23, 2019 14:59
it transfers to extension with name="<destination_number>" or to file with name=<destination_number>.xml ? Posted by clx88 at Mar 09, 2021 00:22
Yeah, that example is just plain wrong, unless I'm misunderstanding it. It transfers the session to search for the desired extension in another <dialplan name>.xml which is NOT named after the number. So there is no 3015551212.xml Posted by boteman at Mar 11, 2021 14:28