arioptions

package
v0.0.0-...-2ec00d9 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DateFormat = "2006-01-02T15:04:05.000-0700"

DateFormat is the date format that ARI returns in the JSON bodies

Variables

This section is empty.

Functions

func ParseConfigID

func ParseConfigID(input string) (class, kind, id string, err error)

ParseConfigID parses the provided Config ID into its Class, Type, and ID components

Types

type ChannelCreateRequest

type ChannelCreateRequest struct {
	// Endpoint is the target endpoint for the dial
	Endpoint string `json:"endpoint"`

	// App is the name of the Stasis application to execute on connection
	App string `json:"app"`

	// AppArgs is the set of (comma-separated) arguments for the Stasis App
	AppArgs string `json:"appArgs,omitempty"`

	// ChannelID is the ID to give to the newly-created channel
	ChannelID string `json:"channelId,omitempty"`

	// OtherChannelID is the ID of the second created channel (when creating Local channels)
	OtherChannelID string `json:"otherChannelId,omitempty"`

	// Originator is the unique ID of the calling channel, for which this new channel-dial is being created
	Originator string `json:"originator,omitempty"`

	// Formats is the comma-separated list of valid codecs to allow for the new channel, in the case that
	// the Originator is not specified
	Formats string `json:"formats,omitempty"`
}

ChannelCreateRequest describes how a channel should be created, when using the separate Create and Dial calls.

type Config

type Config interface {

	// Get gets the reference to a config object
	Get(key *key.Key) *ConfigHandle

	// Data gets the data for the config object
	Data(key *key.Key) (*ConfigData, error)

	// Update creates or updates the given tuples
	Update(key *key.Key, tuples []ConfigTuple) error

	// Delete deletes the dynamic configuration object.
	Delete(key *key.Key) error
}

Config represents a transport to the asterisk config ARI resource.

type ConfigData

type ConfigData struct {
	// Key is the cluster-unique identifier for this configuration
	Key *key.Key `json:"key"`

	Class string
	Type  string
	Name  string

	Fields []ConfigTuple
}

ConfigData contains the data for a given configuration object

func (*ConfigData) ID

func (cd *ConfigData) ID() string

ID returns the ID of the ConfigData structure

type ConfigHandle

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

A ConfigHandle is a reference to a Config object on the asterisk service

func NewConfigHandle

func NewConfigHandle(key *key.Key, c Config) *ConfigHandle

NewConfigHandle builds a new config handle

func (*ConfigHandle) Data

func (h *ConfigHandle) Data() (*ConfigData, error)

Data gets the current data for the config handle

func (*ConfigHandle) Delete

func (h *ConfigHandle) Delete() error

Delete deletes the dynamic configuration object

func (*ConfigHandle) ID

func (h *ConfigHandle) ID() string

ID returns the unique identifier for the config object

func (*ConfigHandle) Update

func (h *ConfigHandle) Update(tuples []ConfigTuple) error

Update creates or updates the given config tuples

type ConfigTuple

type ConfigTuple struct {
	Attribute string `json:"attribute"`
	Value     string `json:"value"`
}

ConfigTuple is the key-value pair that defines a configuration entry

type ConfigTupleList

type ConfigTupleList struct {
	Fields []ConfigTuple `json:"fields"`
}

ConfigTupleList wrap a list for asterisk ari require.

type DTMFOptions

type DTMFOptions struct {
	Before   time.Duration
	Between  time.Duration
	Duration time.Duration
	After    time.Duration
}

DTMFOptions is the list of pptions for DTMF sending

type DTMFSender

type DTMFSender interface {
	SendDTMF(dtmf string, opts *DTMFOptions)
}

DTMFSender is an object which can be send DTMF signals

type DateTime

type DateTime time.Time

DateTime is an alias type for attaching a custom asterisk unmarshaller and marshaller for JSON

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

MarshalJSON converts the given date object to ARIs date format

func (DateTime) String

func (dt DateTime) String() string

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the given date per ARIs date format

type Direction

type Direction string

Direction describes an audio direction, as used by Mute, Snoop, and possibly others. Valid values are "in", "out", and "both".

const (
	// DirectionNone indicates audio should not flow in any direction
	DirectionNone Direction = "none"

	// DirectionIn indicates the direction flowing from the channel into Asterisk
	DirectionIn Direction = "in"

	// DirectionOut indicates the direction flowing from Asterisk to the channel
	DirectionOut Direction = "out"

	// DirectionBoth indicates both the directions flowing both inward to Asterisk and outward from Asterisk.
	DirectionBoth Direction = "both"
)

func (Direction) String

func (d Direction) String() string

type DurationSec

type DurationSec time.Duration

DurationSec is a JSON type for duration in seconds

func (DurationSec) MarshalJSON

func (ds DurationSec) MarshalJSON() ([]byte, error)

MarshalJSON converts the duration into a JSON friendly format

func (*DurationSec) UnmarshalJSON

func (ds *DurationSec) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the data into the duration seconds object

type ExternalMediaOptions

type ExternalMediaOptions struct {
	// ChannelID specifies the channel ID to be used for the external media channel.  This parameter is optional and if not specified, a randomly-generated channel ID will be used.
	ChannelID string `json:"channelId"`

	// App is the ARI Application to which the newly-created external media channel should be placed.  This parameter is optional and if not specified, the current application will be used.
	App string `json:"app"`

	// ExternalHost specifies the <host>:<port> of the external host to which the external media channel will be connected.  This parameter is MANDATORY and has no default.
	ExternalHost string `json:"external_host"`

	// Encapsulation specifies the payload encapsulation which should be used.  Options include:  'rtp'.  This parameter is optional and if not specified, 'rtp' will be used.
	Encapsulation string `json:"encapsulation"`

	// Transport specifies the connection type to be used to communicate to the external server.  Options include 'udp'.  This parameter is optional and if not specified, 'udp' will be used.
	Transport string `json:"transport"`

	// ConnectionType defined the directionality of the network connection.  Options include 'client' and 'server'.  This parameter is optional and if not specified, 'client' will be used.
	ConnectionType string `json:"connection_type"`

	// Format specifies the codec to be used for the audio.  Options include 'slin16', 'ulaw' (and likely other codecs supported by Asterisk).  This parameter is MANDATORY and has not default.
	Format string `json:"format"`

	// Direction specifies the directionality of the audio stream.  Options include 'both'.  This parameter is optional and if not specified, 'both' will be used.
	Direction Direction `json:"direction"`

	// Variables defines the set of channel variables which should be bound to this channel upon creation.  This parameter is optional.
	Variables map[string]string `json:"variables"`
}

ExternalMediaOptions describes the parameters to the externalMedia channel creation operation

type OriginateRequest

type OriginateRequest struct {

	// Endpoint is the name of the Asterisk resource to be used to create the
	// channel.  The format is tech/resource.
	//
	// Examples:
	//
	//   - PJSIP/george
	//
	//   - Local/party@mycontext
	//
	//   - DAHDI/8005558282
	Endpoint string `json:"endpoint"`

	// Timeout specifies the number of seconds to wait for the channel to be
	// answered before giving up.  Note that this is REQUIRED and the default is
	// to timeout immediately.  Use a negative value to specify no timeout, but
	// be aware that this could result in an unlimited call, which could result
	// in a very unfriendly bill.
	Timeout int `json:"timeout,omitempty"`

	// CallerID specifies the Caller ID (name and number) to be set on the
	// newly-created channel.  This is optional but recommended.  The format is
	// `"Name" <number>`, but most every component is optional.
	//
	// Examples:
	//
	//   - "Jane" <100>
	//
	//   - <102>
	//
	//   - 8005558282
	//
	CallerID string `json:"callerId,omitempty"`

	// CEP (Context/Extension/Priority) is the location in the Asterisk dialplan
	// into which the newly created channel should be dropped.  All of these are
	// required if the CEP is used.  Exactly one of CEP or App/AppArgs must be
	// specified.
	Context   string `json:"context,omitempty"`
	Extension string `json:"extension,omitempty"`
	Priority  int64  `json:"priority,omitempty"`

	// The Label is the string form of Priority, if there is such a label in the
	// dialplan.  Like CEP, Label may not be used if an ARI App is specified.
	// If both Label and Priority are specified, Label will take priority.
	Label string `json:"label,omitempty"`

	// App specifies the ARI application and its arguments into which
	// the newly-created channel should be placed.  Exactly one of CEP or
	// App/AppArgs is required.
	App string `json:"app,omitempty"`

	// AppArgs defines the arguments to supply to the ARI application, if one is
	// defined.  It is optional but only applicable for Originations which
	// specify an ARI App.
	AppArgs string `json:"appArgs,omitempty"`

	// Formats describes the (comma-delimited) set of codecs which should be
	// allowed for the created channel.  This is an optional parameter, and if
	// an Originator is specified, this should be left blank so that Asterisk
	// derives the codecs from that Originator channel instead.
	//
	// Ex. "ulaw,slin16".
	//
	// The list of valid codecs can be found with Asterisk command "core show codecs".
	Formats string `json:"formats,omitempty"`

	// ChannelID specifies the unique ID to be used for the channel to be
	// created.  It is optional, and if not specified, a time-based UUID will be
	// generated.
	ChannelID string `json:"channelId,omitempty"` // Optionally assign channel id

	// OtherChannelID specifies the unique ID of the second channel to be
	// created.  This is only valid for the creation of Local channels, which
	// are always generated in pairs.  It is optional, and if not specified, a
	// time-based UUID will be generated (again, only if the Origination is of a
	// Local channel).
	OtherChannelID string `json:"otherChannelId,omitempty"`

	// Originator is the channel for whom this Originate request is being made, if there is one.
	// It is used by Asterisk to set the right codecs (and possibly other parameters) such that
	// when the new channel is bridged to the Originator channel, there should be no transcoding.
	// This is a purely optional (but helpful, where applicable) field.
	Originator string `json:"originator,omitempty"`

	// Variables describes the set of channel variables to apply to the new channel.  It is optional.
	Variables map[string]string `json:"variables,omitempty"`
}

OriginateRequest defines the parameters for the creation of a new Asterisk channel

type RecordingOptions

type RecordingOptions struct {
	// Format is the file format/encoding to which the recording should be stored.
	// This will usually be one of: slin, ulaw, alaw, wav, gsm.
	// If not specified, this will default to slin.
	Format string

	// MaxDuration is the maximum duration of the recording, after which the recording will
	// automatically stop.  If not set, there is no maximum.
	MaxDuration time.Duration

	// MaxSilence is the maximum duration of detected to be found before terminating the recording.
	MaxSilence time.Duration

	// Exists determines what should happen if the given recording already exists.
	// Valid values are: "fail", "overwrite", or "append".
	// If not specified, it will default to "fail"
	Exists string

	// Beep indicates whether a beep should be played to the recorded
	// party at the beginning of the recording.
	Beep bool

	// Terminate indicates whether the recording should be terminated on
	// receipt of a DTMF digit.
	// valid options are: "none", "any", "*", and "#"
	// If not specified, it will default to "none" (never terminate on DTMF).
	Terminate string
}

RecordingOptions describes the set of options available when making a recording.

type SnoopOptions

type SnoopOptions struct {
	// App is the ARI application into which the newly-created Snoop channel should be dropped.
	App string `json:"app"`

	// AppArgs is the set of arguments to pass with the newly-created Snoop channel's entry into ARI.
	AppArgs string `json:"app_args,omitempty"`

	// Spy describes the direction of audio on which to spy (none, in, out, both).
	// The default is 'none'.
	Spy Direction `json:"spy,omitempty"`

	// Whisper describes the direction of audio on which to send (none, in, out, both).
	// The default is 'none'.
	Whisper Direction `json:"whisper,omitempty"`
}

SnoopOptions enumerates the non-required arguments for the snoop operation

Jump to

Keyboard shortcuts

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