From d7254ff73cf805cfa1202e37a4db22d7724c2e47 Mon Sep 17 00:00:00 2001 From: arberkatellari Date: Thu, 26 Jun 2025 08:32:10 +0200 Subject: [PATCH] Add constant '@' and fix typo --- config/config_defaults.go | 2 +- engine/action.go | 2 +- engine/libroutes.go | 4 ++-- utils/consts.go | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config_defaults.go b/config/config_defaults.go index 3acf6ae83..689ea2f61 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -706,7 +706,7 @@ const CGRATES_CFG_JSON = ` "enabled": false, // starts the Asterisk agent: "sessions_conns": ["*birpc_internal"], "create_cdr": false, // create CDR out of events and sends it to CDRS component - "route_profile": false, // attaches RouteProfileID to RouteIDs which are sent as reply to asteristk agent authorization requests + "route_profile": false, // attaches RouteProfileID to RouteIDs which are sent as reply to asterisk agent authorization requests "asterisk_conns":[ // instantiate connections to multiple Asterisk servers { "address": "127.0.0.1:8088", diff --git a/engine/action.go b/engine/action.go index c39337a19..e22a88bcb 100644 --- a/engine/action.go +++ b/engine/action.go @@ -2333,7 +2333,7 @@ func dynamicRoute(_ *Account, act *Action, _ Actions, _ *FilterS, ev any, } } // Take only the string after @, for cases when the RouteProfileID is gotten from a switch agents event - routeFieldParts := strings.Split(params[1], "@") + routeFieldParts := strings.Split(params[1], utils.AtChar) routeProfileFound := new(RouteProfile) if len(routeFieldParts) > 2 { return fmt.Errorf("more than 1 \"@\" character for RouteProfileID: <%s>", params[1]) diff --git a/engine/libroutes.go b/engine/libroutes.go index 4f6134a43..d835392d2 100644 --- a/engine/libroutes.go +++ b/engine/libroutes.go @@ -258,7 +258,7 @@ func (sRs SortedRoutesList) RouteIDs() (rIDs []string) { for _, r := range sR.Routes { route := r.RouteID if config.CgrConfig().AsteriskAgentCfg().RouteProfile { - route += "@" + sR.ProfileID + route += utils.AtChar + sR.ProfileID } rIDs = append(rIDs, route) } @@ -275,7 +275,7 @@ func (sRs SortedRoutesList) RoutesWithParams(setRouteProfile bool) (sPs []string route += utils.InInFieldSep + spl.RouteParameters } if setRouteProfile { - route += "@" + sR.ProfileID + route += utils.AtChar + sR.ProfileID } sPs = append(sPs, route) } diff --git a/utils/consts.go b/utils/consts.go index 0de1c442a..14cb0878e 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -229,6 +229,7 @@ const ( FilterValEnd = ")" PlusChar = "+" MinusChar = "-" + AtChar = "@" JSON = "json" JSONCaps = "JSON" GOBCaps = "GOB"