diff --git a/sessions/apis.go b/sessions/apis.go index a13e06def..dcb8f8a7c 100644 --- a/sessions/apis.go +++ b/sessions/apis.go @@ -164,7 +164,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context, utils.IPsV1AuthorizeIP, args, &allocIP); err != nil { return utils.NewErrIPs(err) } - authReply.IPAllocation = &allocIP + authReply.AllocatedIP = &allocIP } if routeS { routesReply, err := sS.getRoutes(ctx, args.Clone()) @@ -386,7 +386,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context, utils.IPsV1AllocateIP, args, &allocIP); err != nil { return utils.NewErrIPs(err) } - rply.IPAllocation = &allocIP + rply.AllocatedIP = &allocIP defer func() { // we need to release the IPs back in case of errors if err != nil { var reply string diff --git a/sessions/libsessions.go b/sessions/libsessions.go index 22fff7098..07cccdf80 100644 --- a/sessions/libsessions.go +++ b/sessions/libsessions.go @@ -438,7 +438,7 @@ func (v1Rply *V1ProcessMessageReply) AsNavigableMap() map[string]*utils.DataNode type V1AuthorizeReply struct { Attributes *attributes.AttrSProcessEventReply `json:",omitempty"` ResourceAllocation *string `json:",omitempty"` - IPAllocation *utils.AllocatedIP `json:",omitempty"` + AllocatedIP *utils.AllocatedIP `json:",omitempty"` MaxUsage *utils.Decimal `json:",omitempty"` RouteProfiles routes.SortedRoutesList `json:",omitempty"` ThresholdIDs *[]string `json:",omitempty"` @@ -471,12 +471,11 @@ func (r *V1AuthorizeReply) AsNavigableMap() map[string]*utils.DataNode { } cgrReply[utils.CapAttributes] = attrs } - if r.IPAllocation != nil { - alloc := &utils.DataNode{ + if r.AllocatedIP != nil { + cgrReply[utils.AllocatedIPField] = &utils.DataNode{ Type: utils.NMMapType, - Map: r.IPAllocation.AsNavigableMap(), + Map: r.AllocatedIP.AsNavigableMap(), } - cgrReply[utils.CapIPAllocation] = alloc } if r.ResourceAllocation != nil { cgrReply[utils.CapResourceAllocation] = utils.NewLeafNode(*r.ResourceAllocation) @@ -522,7 +521,7 @@ type V1AuthorizeReplyWithDigest struct { type V1InitSessionReply struct { Attributes *attributes.AttrSProcessEventReply `json:",omitempty"` ResourceAllocation *string `json:",omitempty"` - IPAllocation *utils.AllocatedIP `json:",omitempty"` + AllocatedIP *utils.AllocatedIP `json:",omitempty"` MaxUsage *time.Duration `json:",omitempty"` ThresholdIDs *[]string `json:",omitempty"` StatQueueIDs *[]string `json:",omitempty"` @@ -554,12 +553,11 @@ func (r *V1InitSessionReply) AsNavigableMap() map[string]*utils.DataNode { } cgrReply[utils.CapAttributes] = attrs } - if r.IPAllocation != nil { - alloc := &utils.DataNode{ + if r.AllocatedIP != nil { + cgrReply[utils.AllocatedIPField] = &utils.DataNode{ Type: utils.NMMapType, - Map: r.IPAllocation.AsNavigableMap(), + Map: r.AllocatedIP.AsNavigableMap(), } - cgrReply[utils.CapIPAllocation] = alloc } if r.ResourceAllocation != nil { cgrReply[utils.CapResourceAllocation] = utils.NewLeafNode(*r.ResourceAllocation) diff --git a/utils/consts.go b/utils/consts.go index e72bec934..d3af6495d 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -1163,7 +1163,7 @@ const ( MetaDurationNanoseconds = "*duration_nanoseconds" CapAttributes = "Attributes" CapResourceAllocation = "ResourceAllocation" - CapIPAllocation = "IPAllocation" + AllocatedIPField = "AllocatedIP" CapMaxUsage = "MaxUsage" CapRoutes = "Routes" CapRouteProfiles = "RouteProfiles"