novac

package module
v0.0.0-...-d7819f8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

README

novac

novac: a non-sucking fax service.

Documentation

Index

Constants

View Source
const (
	MethodPOST = "POST" // Default
	MethodGET  = "GET"

	MediaTypePdf  = "application/pdf" // Default
	MediaTypeTiff = "image/tiff"

	PageSizeLetter = "letter" // Default
	PageSizeLegal  = "Legal"
	PageSizeA4     = "a4"
)
View Source
const (
	StatusQueued     = "queued"     // The fax is queued and waiting for processing.
	StatusProcessing = "processing" // The fax is being uploaded, downloaded, or converted to a different format.
	StatusSending    = "sending"    // The fax is being sent.
	StatusDelivered  = "delivered"  // The fax has been successfully sent.
	StatusReceiving  = "receiving"  // The fax is being received.
	StatusReceived   = "received"   // The fax has been successfully received.
	StatusNoAnswer   = "no-answer"  // The fax failed because the recipient didn't pick up.
	StatusBusy       = "busy"       // The fax failed because the receiving machine sent back a busy signal.
	StatusFailed     = "failed"     // The fax failed to send or receive.
	StatusCancelled  = "cancelled"  // The fax was cancelled.
)

Variables

This section is empty.

Functions

func InboundHook

func InboundHook(w http.ResponseWriter, req *http.Request)

func IsTerminal

func IsTerminal(status string) bool

func StatusCallback

func StatusCallback(w http.ResponseWriter, req *http.Request)

func UpdateFax

func UpdateFax(ctx context.Context, m pubsub.Message) error

Types

type Fax

type Fax struct {
	AccountSid  string    `json:"account_sid" firestore:"accountSid"`   // The unique identifier for the account this fax is associated with.
	FaxSid      string    `json:"sid" firestore:"faxSid"`               // The unique identifier of the fax.
	Url         string    `json:"url" firestore:"url"`                  // The URL of this resource.
	DateCreated time.Time `json:"date_created" firestore:"dateCreated"` // The date and time, in ISO 8601 format, the fax was created.
	DateUpdated time.Time `json:"date_updated" firestore:"dateUpdated"` // The date and time, in ISO 8601 format, the fax was updated.
	Direction   string    `json:"direction" firestore:"direction"`      // The direction of the fax. Possible values are inbound or outbound.
	From        string    `json:"from" firestore:"from"`                // The phone number, in E.164 format, the fax was sent from.
	To          string    `json:"to" firestore:"to"`                    // The phone number, in E.164 format, the fax was sent to.
	Quality     string    `json:"quality" firestore:"quality"`          // The quality of the fax. See below for possible values.
	Status      string    `json:"status" firestore:"status"`            // The status of the fax. See below for possible values.
	NumPages    int       `json:"num_pages" firestore:"numPages"`       // The number of pages in the fax document.
	Duration    int       `json:"duration" firestore:"duration"`        // The time, in seconds, it took to deliver a fax.
	Price       float64   `json:"price" firestore:"price"`              // The cost of the fax.
	PriceUnit   string    `json:"price_unit" firestore:"priceUnit"`     // The currency, in ISO 4217 format, of the price.
	Links       Links     `json:"links" firestore:"links"`              // The URL links for resources associated with the fax.
	MediaSid    string    `json:"media_sid" firestore:"mediaSid"`       // The unique identifier for the media instance associated with the fax instance.
	MediaUrl    string    `json:"media_url" firestore:"mediaUrl"`       // The URL hosting the received media. Can use this URL to download incoming media.
	ApiVersion  string    `json:"api_version" firestore:"apiVersion"`

	ServerTimestamp time.Time `firestore:"serverTimestamp,serverTimestamp"`
}

type FaxInboundRequest

type FaxInboundRequest struct {
	FaxSid     string `firestore:"fax_sid"`     // A unique identifier for the fax.
	AccountSid string `firestore:"account_sid"` // The account that the fax was sent from.
	To         string `firestore:"to"`          // The number or SIP URI the fax will be sent to.
	From       string `firestore:"from"`        // The number or SIP From the fax was sent from.
	ApiVersion string `firestore:"api_version"` // The version of the SignalWire API.
}

type FaxStatus

type FaxStatus struct {
	AccountSid       string `firestore:"accountSid"`
	FaxSid           string `firestore:"faxSid"`
	ApiVersion       string `firestore:"apiVersion"`
	From             string `firestore:"from"`
	To               string `firestore:"to"`
	Direction        string `firestore:"direction,omitempty"`
	RemoteStationId  string `firestore:"remoteStationId,omitempty"` // The transmitting subscriber identification (TSID) reported by the fax machine that sent in the fax.
	FaxStatus        string `firestore:"faxStatus,omitempty"`       // The status of the fax.
	NumPages         int    `firestore:"numPages,omitempty"`        // The number of pages received from a successful fax.
	MediaUrl         string `firestore:"mediaUrl,omitempty"`        // The media URL to request to retrieve incoming media.
	Timestamp        string `firestore:"statusDate,omitempty"`
	OriginalMediaUrl string `firestore:"mediaUrlOriginal,omitempty"` // The original URL passed when a fax is sent.
	ErrorCode        string `firestore:"errorCode,omitempty"`        // The error code provides more information on a failed fax.
	ErrorMessage     string `firestore:"errorMessage,omitempty"`     // The message explaining the reason for fax failure.

	Unused          map[string]string `firestore:"form,omitempty"`
	ServerTimestamp time.Time         `firestore:"serverTimestamp,serverTimestamp"`
}

func NewFaxStatus

func NewFaxStatus(form url.Values) (s *FaxStatus, err error)

type LaMLResponse

type LaMLResponse struct {
	XMLName xml.Name    `xml:"Response"`
	Verb    interface{} `xml:",any"`
}

type LaMLVerbReceive

type LaMLVerbReceive struct {
	XMLName xml.Name `xml:"Receive"`

	Action     string `xml:"action,attr,omitempty"`    // The URL to request when a fax has failed or has been received.
	Method     string `xml:"method,attr,omitempty"`    // The method attribute specifies whether the request to action is a GET or a POST. Valid values are GET or POST, default value is POST.
	MediaType  string `xml:"mediaType,attr,omitempty"` // The type of media used to store fax media. Valid values are application/pdf or image/tiff. Default is application/pdf.
	PageSize   string `xml:"pageSize,attr,omitempty"`  // The size to interpret incoming pages as. Valid values are letter, legal, or a4. Default is letter.
	StoreMedia bool   `xml:"storeMedia,attr"`          // Whether or not to store incoming media in the fax media store. Values are true or false. Default is true. See below for more information.
}

type LaMLVerbReject

type LaMLVerbReject struct {
	XMLName xml.Name `xml:"Reject"`
}
type Links map[string]string

type SignalWireTransport

type SignalWireTransport struct {
	http.RoundTripper
}

func (SignalWireTransport) RoundTrip

func (t SignalWireTransport) RoundTrip(req *http.Request) (res *http.Response, err error)

Jump to

Keyboard shortcuts

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