Documentation ¶
Overview ¶
Provides mocked NATS encoded connection for pbxclient tests
pbxclient package connects to one of the the nats servers and makes out calls
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConn = errors.New("Not connected")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client stores NATS encoded conn and allows to make out call
func NewClient ¶
func NewClient(conf *ClientConfig) (*Client, error)
NewClient returns PBX Client with an opened NATS encoded connection
func NewMockClient ¶
NewMockClient returns pbxclient with a mocked NATS encoded connection
func (*Client) IsConnected ¶
IsConnected func checks if NATS server is connected, note that client can be set without NATS connection
func (*Client) MakeOutCall ¶
func (c *Client) MakeOutCall(oc *OutCall) (*OutCallResponse, error)
MakeOutCall sends a message via nats to the PBX server and wait for response
type ClientConfig ¶
ClientConfig is config for PBX Client Servers are divided by comma, example: "nats://localhost:1222,nats://localhost:1223,nats://localhost:1224" provide self-signed certs if you use secure connection, example: Servers: "tls://nats.demo.io:4443" RootCAs: "conf/certs/ca.pem,conf/certs/ca2.pem"
type OutCall ¶
type OutCall struct { CallTimeout int `json:"callTimeout"` CarrierID int `json:"carrierId"` Cmd string `json:"cmd"` DestPhoneNumber string `json:"destPhoneNumber"` Endpoint string `json:"endpoint"` IGRP int `json:"igrp"` PBXClientTimeout int `json:"pbxClientTimeout"` PBXHost string `json:"pbxHost"` SrcPhoneNumber string `json:"srcPhoneNumber"` }
OutCall has necessary data to make a request
type OutCallResponse ¶
OutCallResponse has out call response data