mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Add. attr_xfer analog based on conference. (#1629)
* Add. attr_xfer analog based on conference. Control DTMF sequence `*0` transfer `self` to `enter number` state and `peer` leg to conference room `##` transfer `self` to `enter number` state and hangup `peer` leg `*#` transfer `self` to conference room and hangup `peer` leg * Remove spaces. * Add. Commented action to ring group.
This commit is contained in:
committed by
FusionPBX
parent
c9d4ac8d4b
commit
4176144da4
@@ -0,0 +1,72 @@
|
||||
<!--
|
||||
@usage
|
||||
set `conf_xfer_number` and do transfer to `conf_xfer_from_dialplan`
|
||||
|
||||
<action application="export" data="conf_xfer_number=xfer-${create_uuid foo}-${domain_name}">
|
||||
<action application="bind_digit_action" data="local,*0,exec:execute_extension,conf_xfer_from_dialplan XML conf-xfer@${domain_name},${bind_target}"/>
|
||||
|
||||
Control DTMF sequence
|
||||
`*0` transfer `self` to enter number and `peer` leg to conference room
|
||||
`##` transfer `self` to enter number and hangup `peer` leg
|
||||
`*#` transfer `self` to conference room and hangup `peer` leg
|
||||
-->
|
||||
<context name="conf-xfer@{v_context}">
|
||||
<extension name="conf-xfer" number="" continue="false" app_uuid="04e6a380-a27e-4032-bedf-f5b2249ea54d" enabled="false">
|
||||
|
||||
<condition field="destination_number" expression="^conf_add_begin$" break="on-true">
|
||||
<action application="set" data="api_result=${conference(${conf_xfer_number} unmute ${conference_member_id} quiet)}"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,*0,api:lua,transfer2.lua ${uuid} conf_enter_number::XML::conf-xfer@${domain_name} conf_enter_to::XML::conf-xfer@${domain_name}"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,##,api:lua,transfer2.lua ${uuid} conf_enter_number::XML::conf-xfer@${domain_name} ::KILL::"/>
|
||||
<action application="bind_digit_action" data="conf-xfer,*#,api:lua,transfer2.lua ${uuid} conf_add_end::XML::conf-xfer@${domain_name} ::KILL::"/>
|
||||
<action application="bind_digit_action" data="conf,*#,exec:execute_extension,conf_add_begin XML conf-xfer@${domain_name}"/>
|
||||
<action application="bind_digit_action" data="none,NONE,api:sleep,1"/>
|
||||
<action application="set" data="continue_on_fail=true"/>
|
||||
<action application="transfer" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_add_end$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="conf"/>
|
||||
<action application="set" data="api_result=${conference(${conf_xfer_number} mute ${conference_member_id})}"/>
|
||||
<action application="conference" data="${conf_xfer_number}@page"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_enter_number$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="none"/>
|
||||
<action application="read" data="2 11 'tone_stream://%(10000,0,350,440)' target_num 30000 #"/>
|
||||
<action application="execute_extension" data="conf_bridge_${target_num} XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_$" break="on-true">
|
||||
<action application="execute_extension" data="conf_add_end XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_\*$" break="on-true">
|
||||
<action application="execute_extension" data="conf_add_end XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_(\d{2,7})$" break="on-true">
|
||||
<action application="digit_action_set_realm" data="conf-xfer"/>
|
||||
<action application="bridge" data="{conf_xfer_number=${conf_xfer_number},transfer_after_bridge=conf_enter_to:XML:conf-xfer@${domain_name}}user/$1@${domain_name}"/>
|
||||
<action application="execute_extension" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_bridge_" break="on-true">
|
||||
<action application="playback" data="voicemail/vm-that_was_an_invalid_ext.wav"/>
|
||||
<action application="execute_extension" data="conf_enter_number XML conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_enter_to$" break="on-true">
|
||||
<action application="unbind_meta_app" data=""/>
|
||||
<action application="bind_digit_action" data="conf,*#,exec:execute_extension,conf_add_begin XML conf-xfer@${domain_name}"/>
|
||||
<action application="digit_action_set_realm" data="conf"/>
|
||||
<action application="answer" data=""/>
|
||||
<action application="playback" data="tone_stream://L=1;%(500, 0, 640)"/>
|
||||
<action application="conference" data="${conf_xfer_number}@page"/>
|
||||
</condition>
|
||||
|
||||
<condition field="destination_number" expression="^conf_xfer_from_dialplan$">
|
||||
<action application="lua" data="transfer2.lua ${uuid} conf_add_begin::XML::conf-xfer@${domain_name} conf_enter_to::XML::conf-xfer@${domain_name}"/>
|
||||
</condition>
|
||||
|
||||
</extension>
|
||||
</context>
|
||||
@@ -13,10 +13,12 @@
|
||||
</condition>
|
||||
|
||||
<condition>
|
||||
<!-- <action application="export" data="conf_xfer_number=xfer-${create_uuid foo}-${domain_name}"/>-->
|
||||
<action application="bind_digit_action" data="local,*1,exec:execute_extension,dx XML ${context},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*2,exec:record_session,$${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.${record_ext},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*3,exec:execute_extension,cf XML ${context},${bind_target}"/>
|
||||
<action application="bind_digit_action" data="local,*4,exec:execute_extension,att_xfer XML ${context},${bind_target}"/>
|
||||
<!-- <action application="bind_digit_action" data="local,*0,exec:execute_extension,conf_xfer_from_dialplan XML conf-xfer@${domain_name},${bind_target}"/> -->
|
||||
<action application="digit_action_set_realm" data="local"/>
|
||||
</condition>
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ local log = require "resources.functions.log".ring_group
|
||||
extension_uuid = trim(api:executeString(cmd));
|
||||
--send to user
|
||||
local dial_string_to_user = "[sip_invite_domain="..domain_name..",call_direction="..call_direction..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid .. row.record_session .. "]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
dial_string = dial_string_to_user;
|
||||
dial_string = dial_string_to_user;
|
||||
elseif (tonumber(destination_number) == nil) then
|
||||
--sip uri
|
||||
dial_string = "[sip_invite_domain="..domain_name..",call_direction="..call_direction..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay.."]" .. row.destination_number;
|
||||
@@ -525,6 +525,11 @@ local log = require "resources.functions.log".ring_group
|
||||
session:execute("set", "hangup_after_bridge=true");
|
||||
session:execute("set", "continue_on_fail=true");
|
||||
|
||||
-- support conf-xfer feature
|
||||
-- do
|
||||
-- local uuid = api:executeString("create_uuid")
|
||||
-- session:execute("export", "conf_xfer_number=xfer-" .. uuid .. "-" .. domain_name)
|
||||
-- end
|
||||
--set bind digit action
|
||||
local bind_target = 'peer'
|
||||
if session:getVariable("sip_authorized") == "true" then
|
||||
@@ -535,6 +540,7 @@ local log = require "resources.functions.log".ring_group
|
||||
"local,*2,exec:record_session," .. record_file,
|
||||
"local,*3,exec:execute_extension,cf XML " .. context,
|
||||
"local,*4,exec:execute_extension,att_xfer XML " .. context,
|
||||
-- "local,*0,exec:execute_extension,conf_xfer_from_dialplan XML conf-xfer@" .. context
|
||||
}
|
||||
for _, str in ipairs(bindings) do
|
||||
session:execute("bind_digit_action", str .. "," .. bind_target)
|
||||
|
||||
@@ -23,6 +23,20 @@ function channel_evalute(uuid, cmd)
|
||||
return result
|
||||
end
|
||||
|
||||
function channel_transfer(uuid, ext, typ, ctx)
|
||||
local cmd = ("uuid_transfer %s %s %s %s"):format(uuid, ext, typ, ctx)
|
||||
local result = trim(api:executeString(cmd))
|
||||
if result:sub(1, 4) == '-ERR' then return nil, result end
|
||||
if result == '_undef_' then return false end
|
||||
return result
|
||||
end
|
||||
|
||||
function channel_kill(uuid, cause)
|
||||
cause = cause or 'CALL_REJECTED'
|
||||
local res = trim(api:executeString("uuid_kill " .. uuid .. " " .. cause))
|
||||
return res == '+OK'
|
||||
end
|
||||
|
||||
function channel_display(uuid, text)
|
||||
local cmd = ("uuid_display %s '%s'"):format(uuid, text)
|
||||
local result = trim(api:executeString(cmd))
|
||||
|
||||
Reference in New Issue
Block a user