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 common metadata for a record type Line struct { Id string Time time.Time CLI string From string To string Account string Source string Destination string Reason ReasonKind Leg int Kind LineKind } // 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 int 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 }