ari

package module
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: 24 Imported by: 0

README

ari

Asterisk ari implementation over nats

You should be using https://github.com/CyCoreSystems/ari/vX instead of this library. This was only generated to help Program/Test the proxy inside asterisk, and won't be mantained or will have limited maintenance after release.

This library and the internal asterisk proxy are 100% compatible with CyCore ari library, and most of the code was taken from it only as a method to learn and be able to modify the code. We plan

I do plan to release a PR and submit the modifications to Cycore library to make their library work for my asterisk proxy.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = eris.New("Nil")

ErrNil indicates that the request returned an empty response

Functions

func NatsReconnect

func NatsReconnect(nc *nats.Conn) error

func Subject

func Subject(prefix, appName, class, asterisk string) (ret string)

Subject returns the communication subject for the given parameters

Types

type ARIClient

type ARIClient struct {
	Application    string
	ConnectionName string
	NATSUrl        string
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *ARIClient

func (*ARIClient) ApplicationName

func (a *ARIClient) ApplicationName() string

func (*ARIClient) Asterisk

func (a *ARIClient) Asterisk() asterisk.Asterisk

func (*ARIClient) Bridge

func (a *ARIClient) Bridge() bridge.Bridge

func (*ARIClient) Channel

func (a *ARIClient) Channel() channel.Channel

func (*ARIClient) Close

func (a *ARIClient) Close()

func (*ARIClient) Create

func (a *ARIClient) Create(ctx context.Context, opts *Options) error

func (*ARIClient) Dispatcher

func (a *ARIClient) Dispatcher() *dispatcher.EventDispatcher

func (*ARIClient) JetStream

func (a *ARIClient) JetStream() jetstream.JetStream

func (*ARIClient) KeyValue

func (a *ARIClient) KeyValue() jetstream.KeyValue

func (*ARIClient) Listen

func (a *ARIClient) Listen(ctx context.Context, opts *Options, exechandler StasisHandler) error

func (*ARIClient) LiveRecording

func (c *ARIClient) LiveRecording() recordings.LiveRecording

LiveRecording is the live recording accessor

func (*ARIClient) Messagebus

func (a *ARIClient) Messagebus() *nats.Conn

func (*ARIClient) Playback

func (c *ARIClient) Playback() play.Playback

Playback is the media playback accessor

func (*ARIClient) StoredRecording

func (c *ARIClient) StoredRecording() recordings.StoredRecording

StoredRecording is the stored recording accessor

type AsteriskLoggingChannel

type AsteriskLoggingChannel struct {
	// Levels is the set of logging levels for this logging channel (comma-separated string)
	Levels string `json:"config"`
}

AsteriskLoggingChannel describes a request relating to an asterisk logging channel

type AsteriskVariableSet

type AsteriskVariableSet struct {
	// Value is the value to set
	Value string `json:"value"`
}

AsteriskVariableSet is the request type for setting an asterisk variable

type BridgeAddChannel

type BridgeAddChannel struct {
	// Channel is the channel ID to add to the bridge
	Channel string `json:"channel"`

	// AbsorbDTMF indicates that DTMF coming from this channel will not be passed through to the bridge
	AbsorbDTMF bool `json:"absorbDTMF,omitempty"`

	// Mute indicates that the channel should be muted, preventing audio from it passing through to the bridge
	Mute bool `json:"mute,omitempty"`

	// Role indicates the channel's role in the bridge
	Role string `json:"role,omitempty"`
}

BridgeAddChannel is the request type for adding a channel to a bridge

type BridgeCreate

type BridgeCreate struct {
	// Type is the comma-separated list of bridge type attributes (mixing,
	// holding, dtmf_events, proxy_media).  If not set, the default (mixing)
	// will be used.
	Type string `json:"type"`

	// Name is the name to assign to the bridge (optional)
	Name string `json:"name,omitempty"`
}

BridgeCreate is the request type for creating a bridge

type BridgeMOH

type BridgeMOH struct {
	// Class is the Music On Hold class to be played
	Class string `json:"class"`
}

BridgeMOH is the request type for playing Music on Hold to a bridge

type BridgePlay

type BridgePlay struct {
	// PlaybackID is the unique identifier for this playback
	PlaybackID string `json:"playback_id"`

	// MediaURI is the URI from which to obtain the playback media
	MediaURI string `json:"media_uri"`
}

BridgePlay is the request type for playing audio on the bridge

type BridgeRemoveChannel

type BridgeRemoveChannel struct {
	// Channel is the name of the channel to remove
	Channel string `json:"channel"`
}

BridgeRemoveChannel is the request for removing a channel on the bridge

type BridgeVideoSource

type BridgeVideoSource struct {
	// Channel is the name of the channel to use as the explicit video source
	Channel string `json:"channel"`
}

BridgeVideoSource describes the details of a request to set the video source of a bridge explicitly

type ChannelContinue

type ChannelContinue struct {
	// Context is the context into which the channel should be continued
	Context string `json:"context"`

	// Extension is the extension into which the channel should be continued
	Extension string `json:"extension"`

	// Priority is the priority at which the channel should be continued
	Priority int `json:"priority"`
}

ChannelContinue describes a request to continue an ARI application

type ChannelCreate

type ChannelCreate struct {
	// ChannelCreateRequest is the request for creating the channel
	ChannelCreateRequest requests.ChannelCreateRequest `json:"channel_create_request"`
}

ChannelCreate describes a request to create a new channel

type ChannelDial

type ChannelDial struct {
	// Caller is the channel ID of the "caller" channel; if specified, the media parameters of the dialing channel will be matched to the "caller" channel.
	Caller string `json:"caller"`

	// Timeout is the maximum time which should be allowed for the dial to complete
	Timeout time.Duration `json:"timeout"`
}

ChannelDial describes a request to dial

type ChannelExternalMedia

type ChannelExternalMedia struct {
	Options arioptions.ExternalMediaOptions `json:"options"`
}

ChannelExternalMedia describes the request for an external media channel

type ChannelHangup

type ChannelHangup struct {
	// Reason is the reason the channel is being hung up
	Reason string `json:"reason"`
}

ChannelHangup is the request for hanging up a channel

type ChannelMOH

type ChannelMOH struct {
	// Music is the music to play
	Music string `json:"music"`
}

ChannelMOH is the request playing hold on music on a channel

type ChannelMute

type ChannelMute struct {
	// Direction is the direction to mute
	Direction arioptions.Direction `json:"direction,omitempty"`
}

ChannelMute is the request for muting or unmuting a channel

type ChannelOriginate

type ChannelOriginate struct {
	// OriginateRequest contains the information for originating a channel
	OriginateRequest arioptions.OriginateRequest `json:"originate_request"`
}

ChannelOriginate is the request for creating a channel

type ChannelPlay

type ChannelPlay struct {
	// PlaybackID is the unique identifier for this playback
	PlaybackID string `json:"playback_id"`

	// MediaURI is the URI from which to obtain the playback media
	MediaURI string `json:"media_uri"`
}

ChannelPlay is the request for playing audio on a channel

type ChannelSendDTMF

type ChannelSendDTMF struct {
	// DTMF is the series of DTMF inputs to send
	DTMF string `json:"dtmf"`

	// Options are the DTMF options
	Options *arioptions.DTMFOptions `json:"options,omitempty"`
}

ChannelSendDTMF is the request for sending a DTMF event to a channel

type ChannelSnoop

type ChannelSnoop struct {
	// SnoopID is the ID to use for the snoop channel which will be created.
	SnoopID string `json:"snoop_id"`

	// Options describe the parameters for the snoop session
	Options *arioptions.SnoopOptions `json:"options,omitempty"`
}

ChannelSnoop is the request for snooping on a channel

type ChannelVariable

type ChannelVariable struct {
	// Name is the name of the channel variable
	Name string `json:"name"`

	// Value is the value to set to the channel variable
	Value string `json:"value,omitempty"`
}

ChannelVariable is the request type to read or modify a channel variable

type DeviceStateUpdate

type DeviceStateUpdate struct {
	// State is the new state of the device to set
	State string `json:"state"`
}

DeviceStateUpdate describes the request for updating the device state

type EndpointListByTech

type EndpointListByTech struct {
	// Tech is the technology for the endpoint
	Tech string `json:"tech"`
}

EndpointListByTech describes the request for listing endpoints by technology

type EntityData

type EntityData struct {
}

EntityData is a response which returns the data for a specific entity.

type MailboxUpdate

type MailboxUpdate struct {
	// New is the number of New (unread) messages in the mailbox
	New int `json:"new"`

	// Old is the number of Old (read) messages in the mailbox
	Old int `json:"old"`
}

MailboxUpdate describes the request for updating a mailbox

type Options

type Options struct {
	// Application is the the name of this ARI application
	Application string

	ConnectionName string

	NatsUrl string
}

type PlaybackControl

type PlaybackControl struct {
	// Command is the playback control command to run
	Command string `json:"command"`
}

PlaybackControl describes the request for performing a playback command

type RecordingStoredCopy

type RecordingStoredCopy struct {
	// Destination is the destination location to copy to
	Destination string `json:"destination"`
}

RecordingStoredCopy describes the request for copying a stored recording

type Response

type Response struct {
	// Error is the error encountered
	Error string `json:"error"`

	// Data is the returned entity data, if applicable
	Data *EntityData `json:"data,omitempty"`

	// Key is the key of the returned entity, if applicable
	Key *key.Key `json:"key,omitempty"`

	// Keys is the list of keys of any matching entities, if applicable
	Keys []*key.Key `json:"keys,omitempty"`
}

type SoundList

type SoundList struct {
	// Filters are the filters to apply when listing the sounds
	Filters map[string]string `json:"filters"`
}

SoundList describes the request for listing the sounds

type StasisHandler

type StasisHandler func(*ARIClient, *channel.ChannelHandle, *arievent.StasisEvent)

Directories

Path Synopsis
Package rid provides unique resource IDs
Package rid provides unique resource IDs

Jump to

Keyboard shortcuts

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