gofaxlib

package
v0.0.0-...-398a11a Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: GPL-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config is the global configuration struct
	Config config
)
View Source
var (
	// Faxq provides functionalty to send notification messages to faxq's FIFO
	Faxq *faxqfifo
)

Functions

func AppendLog

func AppendLog(filename string, v ...interface{}) (err error)

AppendLog appends a log message to file, adding line break and timestamp

func AppendTo

func AppendTo(filename string, line string) (err error)

AppendTo appends a line to file, adding line break

func DynamicConfigBool

func DynamicConfigBool(value string) (result bool)

DynamicConfigBool interprets a DynamicConfig string value as truth value

func EncodeParams

func EncodeParams(baudrate uint, ecm bool) uint

EncodeParams encodes given baud rate and ecm status to the status byte used in HylaFAX's xferfaxlog. This only encodes bitrate and ECM use right now.

func FreeSwitchDBDelete

func FreeSwitchDBDelete(c *eventsocket.Connection, realm string, key string) error

FreeSwitchDBDelete deletes a value from FreeSWITCH's mod_db key/value database

func FreeSwitchDBExists

func FreeSwitchDBExists(c *eventsocket.Connection, realm string, key string) (bool, error)

FreeSwitchDBExists checks if a value exists in FreeSWITCH's mod_db key/value database

func FreeSwitchDBInsert

func FreeSwitchDBInsert(c *eventsocket.Connection, realm string, key string, value string) error

FreeSwitchDBInsert inserts a value into FreeSWITCH's mod_db key/value database

func FreeSwitchDBSelect

func FreeSwitchDBSelect(c *eventsocket.Connection, realm string, key string) (string, error)

FreeSwitchDBSelect retreives a value from FreeSWITCH's mod_db key/value database

func GetSeqFor

func GetSeqFor(subdir string) (seq uint64, err error)

GetSeqFor increments and returns the sequence number for given HylaFAX spool area

func GetSoftmodemFallback

func GetSoftmodemFallback(c *eventsocket.Connection, cidnum string) (bool, error)

GetSoftmodemFallback checks if fallback to SpanDSP's softmodem (no T.38) should be enabled for the given callerid number

func LoadConfig

func LoadConfig(filename string)

LoadConfig loads the configuration from given file path

func SendFIFO

func SendFIFO(filename string, msg string) error

SendFIFO sends a FIFO message to given FIFO file name

func SetSoftmodemFallback

func SetSoftmodemFallback(c *eventsocket.Connection, cidnum string, enabled bool) error

SetSoftmodemFallback saves the given softmodem fallback setting for a caller id to FreeSWITCH's mod_db

Types

type EventStream

type EventStream interface {
	Events() <-chan *eventsocket.Event
	Errors() <-chan error
	Close()
}

EventStream is a stream of FreeSWITCH Event Socket events provided through channels.

func NewEventStream

func NewEventStream(conn *eventsocket.Connection) EventStream

NewEventStream creates a EventStream that continuously reads events from a FreeSWITCH Event Socket connection into channes.

type FaxResult

type FaxResult struct {
	StartTs time.Time
	EndTs   time.Time

	Hangupcause string

	TotalPages       uint
	TransferredPages uint
	Ecm              bool
	RemoteID         string
	ResultCode       int // SpanDSP, not HylaFAX!
	ResultText       string
	Success          bool
	TransferRate     uint
	NegotiateCount   uint

	PageResults []PageResult
	// contains filtered or unexported fields
}

FaxResult is the result of a completed or aborted Fax transmission

func NewFaxResult

func NewFaxResult(uuid uuid.UUID, sessionlog SessionLogger) *FaxResult

NewFaxResult creates a new FaxResult structure

func (*FaxResult) AddEvent

func (f *FaxResult) AddEvent(ev *eventsocket.Event)

AddEvent parses a FreeSWITCH EventSocket event and merges contained information into the FaxResult

type FifoStream

type FifoStream interface {
	Messages() <-chan string
	Errors() <-chan error
}

FifoStream provides a channel of messages received on a FIFO

func NewFifoStream

func NewFifoStream(name string) FifoStream

NewFifoStream creates a FifoStream reading from a FIFO with given filename

type HylaConfig

type HylaConfig struct {
	// contains filtered or unexported fields
}

HylaConfig holds a set of HylaFAX configuration parameters

func DynamicConfig

func DynamicConfig(command string, args ...string) (*HylaConfig, error)

DynamicConfig executes the given command and parses the output compatible to HylaFAX' DynamicConfig

func (*HylaConfig) GetFirst

func (h *HylaConfig) GetFirst(tag string) string

GetFirst returns the first Value found matching given Tag

type PageResult

type PageResult struct {
	Ts               time.Time
	Page             uint
	BadRows          uint
	LongestBadRowRun uint
	EncodingName     string
	ImagePixelSize   Resolution
	FilePixelSize    Resolution
	ImageResolution  Resolution
	FileResolution   Resolution
	ImageSize        uint
}

PageResult is the result of a transmitted Fax page as reported by SpanDSP

func (PageResult) String

func (p PageResult) String() string

type Resolution

type Resolution struct {
	X uint
	Y uint
}

Resolution is the image resolution of a fax

func (Resolution) String

func (r Resolution) String() string

type SessionLogger

type SessionLogger interface {
	CommSeq() uint64
	CommID() string
	Logfile() string

	Log(v ...interface{})
}

SessionLogger is a logger that logs messages both to the processes log facility and a HylaFax session log file

func NewSessionLogger

func NewSessionLogger() (SessionLogger, error)

NewSessionLogger assigns a CommID and opens a session log file

type XFRecord

type XFRecord struct {
	Ts       time.Time
	Commid   string
	Modem    string
	Jobid    uint
	Jobtag   string
	Filename string
	Sender   string
	Destnum  string
	RemoteID string
	Params   uint
	Pages    uint
	Jobtime  time.Duration
	Conntime time.Duration
	Reason   string
	Cidname  string
	Cidnum   string
	Owner    string
	Dcs      string
}

XFRecord holds all data for a HylaFAX xferfaxlog record

func NewXFRecord

func NewXFRecord(result *FaxResult) *XFRecord

NewXFRecord creates a new xferfaxlog record for a FaxResult

func (*XFRecord) SaveReceptionReport

func (r *XFRecord) SaveReceptionReport() error

SaveReceptionReport appends a reception record to the configured xferfaxlog file

func (*XFRecord) SaveTransmissionReport

func (r *XFRecord) SaveTransmissionReport() error

SaveTransmissionReport appends a transmisison record to the configured xferfaxlog file

Notes

Bugs

  • split at null or \n until EOF

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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