Documentation ¶
Index ¶
- Variables
- func EnableVerboseLogging()
- type CallInformation
- type Config
- type GroupListEntryObject
- type GroupListResponseEntry
- type ZammadApiRequest
- type ZammadBridge
- func (z *ZammadBridge) Authenticate3CX() error
- func (z *ZammadBridge) Authenticate3CXRetries(maxOffline time.Duration) error
- func (z *ZammadBridge) Fetch3CXCalls() ([]CallInformation, error)
- func (z *ZammadBridge) Fetch3CXGroupId(groupName string) (Id string, Count int, err error)
- func (z *ZammadBridge) Fetch3CXGroupMembers() error
- func (z *ZammadBridge) Fetch3CXGroupMembersPage(objectId string, start int) ([]string, error)
- func (z *ZammadBridge) Fetch3CXGroupMembersPageFirst(groupId string) ([]string, string, error)
- func (z *ZammadBridge) Listen() error
- func (z *ZammadBridge) LogIfErr(err error, context string)
- func (z *ZammadBridge) ParsePhoneNumber(number string) string
- func (z *ZammadBridge) ProcessCall(call *CallInformation) error
- func (z *ZammadBridge) RequestAndProcess() error
- func (z *ZammadBridge) ZammadAnswer(call *CallInformation) error
- func (z *ZammadBridge) ZammadHangup(call *CallInformation, cause string) error
- func (z *ZammadBridge) ZammadNewCall(call *CallInformation) error
- func (z *ZammadBridge) ZammadPost(payload ZammadApiRequest) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func EnableVerboseLogging ¶
func EnableVerboseLogging()
EnableVerboseLogging enables verbose debug statements to Stdout
Types ¶
type CallInformation ¶
type CallInformation struct { Id json.Number `json:"Id"` Caller string `json:"Caller"` Callee string `json:"Callee"` // Status has possible values: "Talking", "Transferring", "Routing" Status string `json:"Status"` ZammadInitialized bool ZammadAnswered bool // Various processed fields CallerName string CallerNumber string CalleeName string CalleeNumber string CallUID string Direction string AgentName string AgentNumber string CallFrom string CallTo string ExternalNumber string }
type Config ¶
type Config struct { Bridge struct { PollInterval float64 `yaml:"poll_interval"` } `yaml:"Bridge"` Phone3CX struct { User string `yaml:"user"` Pass string `yaml:"pass"` Host string `yaml:"host"` Group string `yaml:"group"` ExtensionDigits int `yaml:"extension_digits"` TrunkDigits int `yaml:"trunk_digits"` QueueExtension int `yaml:"queue_extension"` CountryPrefix string `yaml:"country_prefix"` } `yaml:"3CX"` Zammad struct { Endpoint string `yaml:"endpoint"` LogMissedQueueCalls bool `yaml:"log_missed_queue_calls"` } `yaml:"Zammad"` }
func LoadConfigFromYaml ¶
LoadConfigFromYaml tries the provided files for a valid YAML configuration file. It uses the first file it can parse, and only that file.
type GroupListEntryObject ¶
type GroupListEntryObject struct { Members struct { Selected []struct { Number struct { Value string `json:"_value"` } `json:"Number"` } `json:"selected"` } `json:"Members"` }
type GroupListResponseEntry ¶
type GroupListResponseEntry struct {
Item GroupListEntryObject `json:"Item"`
}
type ZammadApiRequest ¶
type ZammadApiRequest struct { Event string `json:"event"` From string `json:"from"` To string `json:"to"` Direction string `json:"direction"` CallId string `json:"call_id"` CallIdDuplicate string `json:"callid"` Cause string `json:"cause,omitempty"` AnsweringNumber string `json:"answeringNumber,omitempty"` User string `json:"user,omitempty"` }
type ZammadBridge ¶
type ZammadBridge struct { Config *Config Client3CX http.Client ClientZammad http.Client // contains filtered or unexported fields }
func NewZammadBridge ¶
func NewZammadBridge(config *Config) (*ZammadBridge, error)
NewZammadBridge initializes a new client that listens for 3CX calls and forwards to Zammad.
func (*ZammadBridge) Authenticate3CX ¶
func (z *ZammadBridge) Authenticate3CX() error
Authenticate3CX attempts to login to 3CX and retrieve a valid cookie session.
func (*ZammadBridge) Authenticate3CXRetries ¶
func (z *ZammadBridge) Authenticate3CXRetries(maxOffline time.Duration) error
Authenticate3CXRetries retries logging in a while (defined in maxOffline). It waits five seconds for every failed attempt.
func (*ZammadBridge) Fetch3CXCalls ¶
func (z *ZammadBridge) Fetch3CXCalls() ([]CallInformation, error)
func (*ZammadBridge) Fetch3CXGroupId ¶
func (z *ZammadBridge) Fetch3CXGroupId(groupName string) (Id string, Count int, err error)
Fetch3CXGroupId looks for the internal 3CX id for the given group
func (*ZammadBridge) Fetch3CXGroupMembers ¶
func (z *ZammadBridge) Fetch3CXGroupMembers() error
Fetch3CXGroupMembers fetches the details on group members of the 3CX group that we are monitoring.
func (*ZammadBridge) Fetch3CXGroupMembersPage ¶
func (z *ZammadBridge) Fetch3CXGroupMembersPage(objectId string, start int) ([]string, error)
Fetch3CXGroupMembersPage fetches a single page of members of the given group
func (*ZammadBridge) Fetch3CXGroupMembersPageFirst ¶
func (z *ZammadBridge) Fetch3CXGroupMembersPageFirst(groupId string) ([]string, string, error)
Fetch3CXGroupMembersPageFirst fetches the first page of members of the given group
func (*ZammadBridge) Listen ¶
func (z *ZammadBridge) Listen() error
Listen listens for calls and does not return unless something really bad happened.
func (*ZammadBridge) LogIfErr ¶
func (z *ZammadBridge) LogIfErr(err error, context string)
LogIfErr logs to stderr when an error occurs, doing nothing when err is nil.
func (*ZammadBridge) ParsePhoneNumber ¶
func (z *ZammadBridge) ParsePhoneNumber(number string) string
ParsePhoneNumber parses the phone number into a format acceptable to Zammad
func (*ZammadBridge) ProcessCall ¶
func (z *ZammadBridge) ProcessCall(call *CallInformation) error
ProcessCall processes a single ongoing call from 3CX
func (*ZammadBridge) RequestAndProcess ¶
func (z *ZammadBridge) RequestAndProcess() error
RequestAndProcess requests the current calls from 3CX and processes them to Zammad
func (*ZammadBridge) ZammadAnswer ¶
func (z *ZammadBridge) ZammadAnswer(call *CallInformation) error
ZammadAnswer notifies Zammad that the existing call was now answered by an agent.
func (*ZammadBridge) ZammadHangup ¶
func (z *ZammadBridge) ZammadHangup(call *CallInformation, cause string) error
ZammadHangup notifies Zammad that the call was finished with a given cause. Possible values for `cause` are: "cancel", "normalClearing"
func (*ZammadBridge) ZammadNewCall ¶
func (z *ZammadBridge) ZammadNewCall(call *CallInformation) error
ZammadNewCall notifies Zammad that a new call came in. This is the first call required to process calls using Zammad.
func (*ZammadBridge) ZammadPost ¶
func (z *ZammadBridge) ZammadPost(payload ZammadApiRequest) error
ZammadPost makes a POST Request to Zammad with the given payload