Add posibility to change Tenant from CGREvent with AttributeS for CDRs and ChargerS

This commit is contained in:
TeoV
2019-05-17 13:04:55 +03:00
committed by Dan Christian Bogos
parent e5ed5aea4e
commit bf10cc1fc5
7 changed files with 145 additions and 2 deletions

View File

@@ -334,6 +334,11 @@ func (cdrS *CDRServer) attrSProcessEvent(cgrEv *utils.CGREventWithArgDispatcher)
if err = cdrS.attrS.Call(utils.AttributeSv1ProcessEvent,
attrArgs, &rplyEv); err == nil && len(rplyEv.AlteredFields) != 0 {
*cgrEv.CGREvent = *rplyEv.CGREvent
if tntIface, has := cgrEv.CGREvent.Event[utils.MetaTenant]; has {
// special case when we want to overwrite the tenant
cgrEv.CGREvent.Tenant = tntIface.(string)
delete(cgrEv.CGREvent.Event, utils.MetaTenant)
}
} else if err.Error() == utils.ErrNotFound.Error() {
err = nil // cancel ErrNotFound
}