From 84fdf89b34cd054ac0dfa03f7a5cd241e1cb3cfd Mon Sep 17 00:00:00 2001 From: yois615 <38441801+yois615@users.noreply.github.com> Date: Wed, 15 Dec 2021 16:45:04 -0500 Subject: [PATCH] bind_digit_action for B-leg during internal call (#6157) The existing code only binds properly when one leg is not internal. Here we use LUA to bind the bleg for internal calls. --- .../conf/dialplan/085_bind_digit_action.xml | 5 +++ .../resources/scripts/bind_digit_bleg.lua | 39 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 app/scripts/resources/scripts/bind_digit_bleg.lua diff --git a/app/dialplans/resources/switch/conf/dialplan/085_bind_digit_action.xml b/app/dialplans/resources/switch/conf/dialplan/085_bind_digit_action.xml index 1352817763..497fa6a745 100644 --- a/app/dialplans/resources/switch/conf/dialplan/085_bind_digit_action.xml +++ b/app/dialplans/resources/switch/conf/dialplan/085_bind_digit_action.xml @@ -16,5 +16,10 @@ + + + + + diff --git a/app/scripts/resources/scripts/bind_digit_bleg.lua b/app/scripts/resources/scripts/bind_digit_bleg.lua new file mode 100644 index 0000000000..173504c03b --- /dev/null +++ b/app/scripts/resources/scripts/bind_digit_bleg.lua @@ -0,0 +1,39 @@ +-- +-- FusionPBX +-- Version: MPL 1.1 +-- +-- The contents of this file are subject to the Mozilla Public License Version +-- 1.1 (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- http://www.mozilla.org/MPL/ +-- +-- Software distributed under the License is distributed on an "AS IS" basis, +-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +-- for the specific language governing rights and limitations under the +-- License. +-- +-- The Original Code is FusionPBX +-- +-- The Initial Developer of the Original Code is +-- Mark J Crane +-- Copyright (C) 2021 +-- the Initial Developer. All Rights Reserved. +-- +-- Contributor(s): +-- Joseph A Nadiv + +--include config.lua + require "resources.functions.config"; + +--create the api object + api = freeswitch.API(); + require "resources.functions.channel_utils"; + +--get context variable + local context = argv[1]; + +--bind to bleg + session:execute("bind_digit_action", "local,*1,exec:execute_extension,dx XML ".. context .. ",self,self"); + session:execute("bind_digit_action", "local,*3,exec:execute_extension,cf XML ".. context .. ",self,self"); + session:execute("bind_digit_action", "local,*4,exec:execute_extension,att_xfer XML ".. context .. ",self,self"); + session:execute("digit_action_set_realm", "local");