From 9d764b7d5c46e638ccd3fde1241156bacf2c66f7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 24 Nov 2016 10:41:43 +0300 Subject: [PATCH] Fix. Add missing file for #1629 (#2077) --- resources/install/scripts/transfer2.lua | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 resources/install/scripts/transfer2.lua diff --git a/resources/install/scripts/transfer2.lua b/resources/install/scripts/transfer2.lua new file mode 100644 index 0000000000..499ca76d69 --- /dev/null +++ b/resources/install/scripts/transfer2.lua @@ -0,0 +1,32 @@ +local api = freeswitch.API() +local uuid = assert(argv[1]) +local t1 = assert(argv[2]) +local t2 = assert(argv[3]) + +require "resources.functions.channel_utils" +require "resources.functions.split" +local log = require "resources.functions.log".transfer2 + +log.noticef("session %s\n", uuid); + +local other_leg_uuid = channel_variable(uuid, "signal_bond") + +log.noticef("other leg: %s\n", other_leg_uuid or '') + +if other_leg_uuid and #other_leg_uuid > 0 then + if t2 ~= '::NONE::' then + if t2 == '::KILL::' then + channel_kill(other_leg_uuid) + else + channel_transfer(other_leg_uuid, usplit(t2, '::')) + end + end +end + +if t1 ~= '::NONE::' then + if t1 == '::KILL::' then + channel_kill(uuid) + else + channel_transfer(uuid, usplit(t1, '::')) + end +end