cdrcsv

package
v0.0.0-...-221c776 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func Pseudonymify

func Pseudonymify(cdrs *[]File, pseudo PseudoData, settings Settings) error

Types

type AmaFlag

type AmaFlag string
const (
	OMIT          AmaFlag = "OMIT"
	BILLING       AmaFlag = "BILLING"
	DOCUMENTATION AmaFlag = "DOCUMENTATION"
	UNKOWN        AmaFlag = "Unkown"
)

type CallState

type CallState string
const (
	ANSWERED  CallState = "ANSWERED"
	NO_ANSWER CallState = "NO_ANSWER"
	BUSY      CallState = "BUSY"
	FAILED    CallState = "FAILED"
	UNKNOWN   CallState = "UNKNOWN"
)

type File

type File struct {
	Records []*Record
}

func ReadWithoutHeader

func ReadWithoutHeader(reader io.Reader) (File, error)

ReadWithoutHeader reads a CDR csv-file from the specified reader and returns the record file.

func ReadWithoutHeaderFromFile

func ReadWithoutHeaderFromFile(filename string) (File, error)

func (*File) CloneWithParallelCallsRemoved

func (f *File) CloneWithParallelCallsRemoved() File

RemoveParallelCalls removes all parallel calls from the cdr file. Parallel calls are created in an CDR if the Dial-App contains an '&'-sign. Example DIAL(SIP/phone1&SIP/phone2) will create two CDR lines with nearly identical content, even the unique id is identical. Be careful to distinguish parallel calls from transferred calls, which also are nearly identical but their Start time differs. See also: https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+CDR+Specification#Asterisk12CDRSpecification

func (*File) WriteAsCsvWithoutHeader

func (f *File) WriteAsCsvWithoutHeader(writer io.Writer) error

WriteAsCsvWithoutHeader writes a CDR file in CSV format to the specified writer.

type NaturalTimeShifter

type NaturalTimeShifter struct {
	Years   int
	Days    int
	Hours   int
	Minutes int
}

type Participant

type Participant struct {
	Name      string
	Extension string
}

func ParsePseudoContacts

func ParsePseudoContacts(reader io.Reader) ([]Participant, error)

type PseudoData

type PseudoData struct {
	Participants []Participant
	Contexts     []string
}

type Record

type Record struct {
	Accountcode string
	Src         string
	Dst         string
	Dcontext    string
	CallerId    string
	Channel     string
	DstChannel  string
	LastApp     string
	LastData    string
	Start       string
	Answer      string
	End         string
	Duration    string
	Billsec     string
	Disposition CallState
	AmaFlag     AmaFlag
	Userfield   string
	UniqueId    string
}

func (*Record) ToCsvString

func (c *Record) ToCsvString() string

type Settings

type Settings struct {
	TimeShifter  TimeShifter
	HideAppData  bool
	HideChannels bool
}

type TimeShifter

type TimeShifter interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL