Add constant '@' and fix typo

This commit is contained in:
arberkatellari
2025-06-26 08:32:10 +02:00
committed by Dan Christian Bogos
parent 2385597155
commit d7254ff73c
4 changed files with 5 additions and 4 deletions

View File

@@ -706,7 +706,7 @@ const CGRATES_CFG_JSON = `
"enabled": false, // starts the Asterisk agent: <true|false>
"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",

View File

@@ -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])

View File

@@ -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)
}

View File

@@ -229,6 +229,7 @@ const (
FilterValEnd = ")"
PlusChar = "+"
MinusChar = "-"
AtChar = "@"
JSON = "json"
JSONCaps = "JSON"
GOBCaps = "GOB"