/asterisk-ari-go

This is a new and improved Asterisk ARI client written in Go Lang.

Primary LanguageGoApache License 2.0Apache-2.0

Go Reference

Go API client Asterisk 18.13.0 LTS

This is a production tested client for the Asterisk 18.13.0 LTS API from Quintex Software. This client is partly generated by swagger-codegen but also has gone through hand optimization and some manual changes to fit real world scenarios.

Installation

Note: Please try to use the latest version of Go.

go get -u github.com/quintex/go-asterisk-api-client

Usage

After installation, simply import this package and start using it:

import "https://github.com/quintex-dev/asterisk-ari-go"

Documentation for API Endpoints

All URIs are relative to http://xx.xx.xx.xx/ari of your Asterisk server.

Class Method HTTP request Description
ApplicationsApi Filter Put /applications/{applicationName}/eventFilter Filter application events types.
ApplicationsApi Get Get /applications/{applicationName} Get details of an application.
ApplicationsApi List Get /applications List all applications.
ApplicationsApi Subscribe Post /applications/{applicationName}/subscription Subscribe an application to a event source.
ApplicationsApi Unsubscribe Delete /applications/{applicationName}/subscription Unsubscribe an application from an event source.
AsteriskApi AddLog Post /asterisk/logging/{logChannelName} Adds a log channel.
AsteriskApi DeleteLog Delete /asterisk/logging/{logChannelName} Deletes a log channel.
AsteriskApi DeleteObject Delete /asterisk/config/dynamic/{configClass}/{objectType}/{id} Delete a dynamic configuration object.
AsteriskApi GetGlobalVar Get /asterisk/variable Get the value of a global variable.
AsteriskApi GetInfo Get /asterisk/info Gets Asterisk system information.
AsteriskApi GetModule Get /asterisk/modules/{moduleName} Get Asterisk module information.
AsteriskApi GetObject Get /asterisk/config/dynamic/{configClass}/{objectType}/{id} Retrieve a dynamic configuration object.
AsteriskApi ListLogChannels Get /asterisk/logging Gets Asterisk log channel information.
AsteriskApi ListModules Get /asterisk/modules List Asterisk modules.
AsteriskApi LoadModule Post /asterisk/modules/{moduleName} Load an Asterisk module.
AsteriskApi Ping Get /asterisk/ping Response pong message.
AsteriskApi ReloadModule Put /asterisk/modules/{moduleName} Reload an Asterisk module.
AsteriskApi RotateLog Put /asterisk/logging/{logChannelName}/rotate Rotates a log channel.
AsteriskApi SetGlobalVar Post /asterisk/variable Set the value of a global variable.
AsteriskApi UnloadModule Delete /asterisk/modules/{moduleName} Unload an Asterisk module.
AsteriskApi UpdateObject Put /asterisk/config/dynamic/{configClass}/{objectType}/{id} Create or update a dynamic configuration object.
BridgesApi AddChannel Post /bridges/{bridgeId}/addChannel Add a channel to a bridge.
BridgesApi ClearVideoSource Delete /bridges/{bridgeId}/videoSource Removes any explicit video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants. When no explicit video source is set, talk detection will be used to determine the active video stream.
BridgesApi Create Post /bridges Create a new bridge.
BridgesApi CreateWithId Post /bridges/{bridgeId} Create a new bridge or updates an existing one.
BridgesApi Destroy Delete /bridges/{bridgeId} Shut down a bridge.
BridgesApi Getbridge Get /bridges/{bridgeId} Get bridge details.
BridgesApi Listbridges Get /bridges List all active bridges in Asterisk.
BridgesApi Play Post /bridges/{bridgeId}/play Start playback of media on a bridge.
BridgesApi PlayWithId Post /bridges/{bridgeId}/play/{playbackId} Start playback of media on a bridge.
BridgesApi Record Post /bridges/{bridgeId}/record Start a recording.
BridgesApi RemoveChannel Post /bridges/{bridgeId}/removeChannel Remove a channel from a bridge.
BridgesApi SetVideoSource Post /bridges/{bridgeId}/videoSource/{channelId} Set a channel as the video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants.
BridgesApi StartMoh Post /bridges/{bridgeId}/moh Play music on hold to a bridge or change the MOH class that is playing.
BridgesApi StopMoh Delete /bridges/{bridgeId}/moh Stop playing music on hold to a bridge.
ChannelsApi AddMoh Post /channels/{channelId}/moh Play music on hold to a channel.
ChannelsApi Answer Post /channels/{channelId}/answer Answer a channel.
ChannelsApi ContinueInDialplan Post /channels/{channelId}/continue Exit application; continue execution in the dialplan.
ChannelsApi Createchannel Post /channels/create Create channel.
ChannelsApi Deletemoh Delete /channels/{channelId}/moh Stop playing music on hold to a channel.
ChannelsApi Dial Post /channels/{channelId}/dial Dial a created channel.
ChannelsApi ExternalMedia Post /channels/externalMedia Start an External Media session.
ChannelsApi GetChannelVar Get /channels/{channelId}/variable Get the value of a channel variable or function.
ChannelsApi Getchannel Get /channels/{channelId} Channel details.
ChannelsApi Hangup Delete /channels/{channelId} Delete (i.e. hangup) a channel.
ChannelsApi Hold Post /channels/{channelId}/hold Hold a channel.
ChannelsApi Listchannels Get /channels List all active channels in Asterisk.
ChannelsApi Move Post /channels/{channelId}/move Move the channel from one Stasis application to another.
ChannelsApi Mute Post /channels/{channelId}/mute Mute a channel.
ChannelsApi Originate Post /channels Create a new channel (originate).
ChannelsApi OriginateWithId Post /channels/{channelId} Create a new channel (originate with id).
ChannelsApi PlaySoundWithId Post /channels/{channelId}/play/{playbackId} Start playback of media and specify the playbackId.
ChannelsApi Playsound Post /channels/{channelId}/play Start playback of media.
ChannelsApi Recordchannel Post /channels/{channelId}/record Start a recording.
ChannelsApi Redirect Post /channels/{channelId}/redirect Redirect the channel to a different location.
ChannelsApi Ring Post /channels/{channelId}/ring Indicate ringing to a channel.
ChannelsApi RingStop Delete /channels/{channelId}/ring Stop ringing indication on a channel if locally generated.
ChannelsApi Rtpstatistics Get /channels/{channelId}/rtp_statistics RTP stats on a channel.
ChannelsApi SendDTMF Post /channels/{channelId}/dtmf Send provided DTMF to a given channel.
ChannelsApi SetChannelVar Post /channels/{channelId}/variable Set the value of a channel variable or function.
ChannelsApi SnoopChannel Post /channels/{channelId}/snoop Start snooping.
ChannelsApi SnoopChannelWithId Post /channels/{channelId}/snoop/{snoopId} Start snooping.
ChannelsApi StartSilence Post /channels/{channelId}/silence Play silence to a channel.
ChannelsApi StopSilence Delete /channels/{channelId}/silence Stop playing silence to a channel.
ChannelsApi Unhold Delete /channels/{channelId}/hold Remove a channel from hold.
ChannelsApi Unmute Delete /channels/{channelId}/mute Unmute a channel.
DeviceStatesApi Delete Delete /deviceStates/{deviceName} Destroy a device-state controlled by ARI.
DeviceStatesApi Getdevicestate Get /deviceStates/{deviceName} Retrieve the current state of a device.
DeviceStatesApi ListDeviceStates Get /deviceStates List all ARI controlled device states.
DeviceStatesApi Update Put /deviceStates/{deviceName} Change the state of a device controlled by ARI. (Note - implicitly creates the device state).
EndpointsApi Getendpoint Get /endpoints/{tech}/{resource} Details for an endpoint.
EndpointsApi ListByTech Get /endpoints/{tech} List available endoints for a given endpoint technology.
EndpointsApi Listendpoints Get /endpoints List all endpoints.
EndpointsApi SendMessage Put /endpoints/sendMessage Send a message to some technology URI or endpoint.
EndpointsApi SendMessageToEndpoint Put /endpoints/{tech}/{resource}/sendMessage Send a message to some endpoint in a technology.
EventsApi EventWebsocket Get /events WebSocket connection for events.
EventsApi UserEvent Post /events/user/{eventName} Generate a user event.
MailboxesApi Deletemailbox Delete /mailboxes/{mailboxName} Destroy a mailbox.
MailboxesApi Getmailbox Get /mailboxes/{mailboxName} Retrieve the current state of a mailbox.
MailboxesApi Listmailboxes Get /mailboxes List all mailboxes.
MailboxesApi Updatemailbox Put /mailboxes/{mailboxName} Change the state of a mailbox. (Note - implicitly creates the mailbox).
PlaybacksApi Control Post /playbacks/{playbackId}/control Control a playback.
PlaybacksApi Getplayback Get /playbacks/{playbackId} Get a playback's details.
PlaybacksApi Stop Delete /playbacks/{playbackId} Stop a playback.
RecordingsApi Cancel Delete /recordings/live/{recordingName} Stop a live recording and discard it.
RecordingsApi CopyStored Post /recordings/stored/{recordingName}/copy Copy a stored recording.
RecordingsApi DeleteStored Delete /recordings/stored/{recordingName} Delete a stored recording.
RecordingsApi GetLive Get /recordings/live/{recordingName} List live recordings.
RecordingsApi GetStored Get /recordings/stored/{recordingName} Get a stored recording's details.
RecordingsApi GetStoredFile Get /recordings/stored/{recordingName}/file Get the file associated with the stored recording.
RecordingsApi ListStored Get /recordings/stored List recordings that are complete.
RecordingsApi Muterecording Post /recordings/live/{recordingName}/mute Mute a live recording.
RecordingsApi Pause Post /recordings/live/{recordingName}/pause Pause a live recording.
RecordingsApi Stoprecording Post /recordings/live/{recordingName}/stop Stop a live recording and store it.
RecordingsApi Unmuterecording Delete /recordings/live/{recordingName}/mute Unmute a live recording.
RecordingsApi Unpause Delete /recordings/live/{recordingName}/pause Unpause a live recording.
SoundsApi Getsound Get /sounds/{soundId} Get a sound's details.
SoundsApi Listsounds Get /sounds List all sounds.

Documentation For Models

Documentation For Authorization

Asterisk ARI uses HTTP Basic Authorization. Go context.Context is used to pass in the HTTP Basic Authorization credentials.

Author

Chris Roy @chris
With love from - Quintex Software Solutions Pvt. Ltd.