From c49ae14aa49af7aa99c17fd5c5c5bf8721793075 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 26 Feb 2026 04:52:27 -0700 Subject: [PATCH] Fix the dialplan_xml filter --- app/dialplans/dialplan_xml.php | 13 +++++++++++++ app/dialplans/dialplans.php | 19 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/dialplans/dialplan_xml.php b/app/dialplans/dialplan_xml.php index 8c1abed198..c5a3e257f8 100644 --- a/app/dialplans/dialplan_xml.php +++ b/app/dialplans/dialplan_xml.php @@ -46,6 +46,9 @@ if (!empty($_REQUEST['app_uuid']) && is_uuid($_REQUEST['app_uuid'])) { $app_uuid = $_REQUEST['app_uuid']; } + if (!empty($_REQUEST['context']) && $_REQUEST['context'] == 'public') { + $context = $_REQUEST['context']; + } $dialplan_xml = $_REQUEST['dialplan_xml'] ?? ''; //process the HTTP POST @@ -180,6 +183,16 @@ $sql = "select dialplan_xml from v_dialplans "; $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; $sql .= "and dialplan_enabled = true "; + if (!empty($app_uuid)) { + $sql .= "and app_uuid = :app_uuid "; + $parameters['app_uuid'] = $app_uuid; + } + elseif (!empty($context)) { + $sql .= "and dialplan_context = :context "; + $parameters['context'] = $context; + } else { + $sql .= "and dialplan_context <> 'public' "; + } $sql .= "order by dialplan_order asc, lower(dialplan_name) asc "; $parameters['domain_uuid'] = $domain_uuid; $dialplans = $database->select($sql, $parameters, 'all'); diff --git a/app/dialplans/dialplans.php b/app/dialplans/dialplans.php index 02b8427ece..8e219c40cf 100644 --- a/app/dialplans/dialplans.php +++ b/app/dialplans/dialplans.php @@ -409,7 +409,24 @@ echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$button_icon_delete,'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none;','onclick'=>"modal_open('modal-delete','btn_delete');"]); } if (permission_exists('dialplan_xml')) { - echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 3px;','link'=>'dialplan_xml.php']); + $query_params = []; + if (!empty($app_uuid) && is_uuid($app_uuid)) { + $query_params[] = 'app_uuid='.$app_uuid; + } + if (!empty($context) && $context == 'global') { + $query_params[] = 'context='.$context; + } + $query_string = ''; + if (count($query_params) > 0) { + $i = 0; + foreach($query_params as $query_param) { + $delimiter = ($i == 0) ? '?' : '&'; + $query_string .= $delimiter. $query_param; + $i++; + } + } + echo button::create(['type'=>'button','label'=>$text['button-xml'],'icon'=>'code','style'=>'margin-left: 3px;','link'=>'dialplan_xml.php'.$query_string]); + unset($query_string); } } echo "