New GetCdrID method

This commit is contained in:
porosnicuadrian
2022-01-07 15:46:13 +02:00
committed by Dan Christian Bogos
parent ee727e26fb
commit 0235c90f2d
3 changed files with 12 additions and 1 deletions

View File

@@ -110,6 +110,15 @@ func (cgrEv *CGREvent) AsDataProvider() (ev MapStorage) {
}
}
func (cgrEv *CGREvent) GetCDRUniqueID() string {
if chargeId, ok := cgrEv.APIOpts[MetaChargeID]; ok {
return IfaceAsString(chargeId)
} else if cgrId, ok := cgrEv.Event[CGRID]; ok {
return IfaceAsString(cgrId)
}
return UUIDSha1Prefix()
}
// EventWithFlags is used where flags are needed to mark processing
type EventWithFlags struct {
Flags []string

View File

@@ -791,6 +791,7 @@ const (
MetaCDR = "*cdr"
MetaExporterIDs = "*exporterIDs"
MetaExporterID = "*exporterID"
MetaChargeID = "*chargeID"
MetaAsync = "*async"
MetaUsage = "*usage"
MetaStartTime = "*startTime"