You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
1.8 KiB
95 lines
1.8 KiB
package cdr
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type (
|
|
// LineKind defines several types of records
|
|
LineKind int
|
|
// ReasonKind is metadata about a certain Line
|
|
ReasonKind int
|
|
)
|
|
|
|
const (
|
|
// UnknownLine aka "never seen this LineKind before"
|
|
UnknownLine LineKind = iota
|
|
// VoiceLine aka "this line belongs to (a part of) a voice call"
|
|
VoiceLine
|
|
// TextLine aka "this line belongs to a text message"
|
|
TextLine
|
|
// DataLine aka "this line belongs to a data session"
|
|
DataLine
|
|
)
|
|
|
|
const (
|
|
// UnknownReason aka "never seen this reason before"
|
|
UnknownReason ReasonKind = iota
|
|
// ORIG aka "originated"
|
|
ORIG
|
|
// CFIM aka "call forward immediately"
|
|
CFIM
|
|
// CFNA aka "call forward not available"
|
|
CFNA
|
|
// CFBS aka "call forward busy"
|
|
CFBS
|
|
// CFOR aka "call forward out of reach"
|
|
CFOR
|
|
// ROAM aka "roaming"
|
|
ROAM
|
|
// PBXOR aka "PBX out of reach"
|
|
PBXOR
|
|
)
|
|
|
|
// Line contains the original metadata of a (call) detail record
|
|
type Line struct {
|
|
Id string
|
|
Time time.Time
|
|
CLI string
|
|
From string
|
|
To string
|
|
Account string
|
|
Source string
|
|
Destination string
|
|
RawCount int
|
|
RawCosts int
|
|
Leg int
|
|
Reason ReasonKind
|
|
Kind LineKind
|
|
|
|
// non-public properties
|
|
pkg string
|
|
package_cost int
|
|
network_cost int
|
|
service_cost int
|
|
}
|
|
|
|
// PricedLine connects a cost (buy) and price (sell) to a particular Line
|
|
type PricedLine struct {
|
|
Line
|
|
|
|
Cost int
|
|
Price int
|
|
}
|
|
|
|
// Call is a record of one or more PricedLines that ultimately form "a call".
|
|
type Call struct {
|
|
From string
|
|
To string
|
|
Duration time.Duration
|
|
Cost int
|
|
Price int
|
|
Legs []PricedLine
|
|
}
|
|
|
|
// Text is a specific PricedLine for a text message.
|
|
type Text struct {
|
|
PricedLine
|
|
}
|
|
|
|
// Data is a specific PricedLine that annotates the number of bytes consumed in that session.
|
|
type Data struct {
|
|
PricedLine
|
|
|
|
Bytes int
|
|
}
|
|
|