class Asterisk::ARI::Channels
- Asterisk::ARI::Channels
- Asterisk::ARI::Resources
- Reference
- Object
Defined in:
asterisk/ari/resources/channels.crasterisk/ari/models/channels_caller_id.cr
asterisk/ari/models/channels_channel.cr
asterisk/ari/models/channels_dialed.cr
asterisk/ari/models/channels_dialplan_cep.cr
asterisk/ari/models/channels_external_media.cr
asterisk/ari/models/channels_rt_pstat.cr
Instance Method Summary
-
#answer(channel_id : String)
Answer a channel.
-
#continue_in_dialplan(channel_id : String, context : String? = nil, extension : String? = nil, priority : Int32? = nil, label : String? = nil)
Exit application; continue execution in the dialplan.
-
#create(endpoint : String, app : String, app_args : String? = nil, channel_id : String? = nil, other_channel_id : String? = nil, originator : String? = nil, formats : String? = nil) : HTTP::Client::Response | Channels::Channel
Create channel.
-
#dial(channel_id : String, caller : String? = nil, timeout : Int32? = 0)
Dial a created channel.
-
#external_media(app : String, external_host : String, format : String, channel_id : String? = nil, variables : Hash(String, String | Bool | Int32 | Float32)? = nil, encapsulation : String? = "rtp", transport : String? = "udp", connection_type : String? = "client", direction : String? = "both") : HTTP::Client::Response | ExternalMedia
Start an External Media session.
-
#get(channel_id : String) : HTTP::Client::Response | Channels::Channel
Channel details.
-
#get_channel_var(channel_id : String, variable : String) : HTTP::Client::Response | Asterisk::Variable
Get the value of a channel variable or function.
-
#hangup(channel_id : String, reason : String? = nil)
Delete (i.e.
-
#hold(channel_id : String)
Hold a channel.
-
#list : HTTP::Client::Response | Array(Channels::Channel)
List all active channels in Asterisk.
-
#move(channel_id : String, app : String, app_args : String? = nil)
Move the channel from one Stasis application to another.
-
#mute(channel_id : String, direction : String? = "both")
Mute a channel.
-
#originate(endpoint : String, extension : String? = nil, context : String? = nil, priority : Int64? = nil, label : String? = nil, app : String? = nil, app_args : String? = nil, caller_id : String? = nil, timeout : Int32? = 30, variables : Hash(String, String | Bool | Int32 | Float32)? = nil, channel_id : String? = nil, other_channel_id : String? = nil, originator : String? = nil, formats : String? = nil) : HTTP::Client::Response | Channels::Channel
Create a new channel (originate).
-
#originate_with_id(channel_id : String, endpoint : String, extension : String? = nil, context : String? = nil, priority : Int64? = nil, label : String? = nil, app : String? = nil, app_args : String? = nil, caller_id : String? = nil, timeout : Int32? = 30, variables : Hash(String, String | Bool | Int32 | Float32)? = nil, other_channel_id : String? = nil, originator : String? = nil, formats : String? = nil) : HTTP::Client::Response | Channels::Channel
Create a new channel (originate with id).
-
#play(channel_id : String, media : String, lang : String? = nil, offsetms : Int32? = nil, skipms : Int32? = 3000, playback_id : String? = nil) : HTTP::Client::Response | Playbacks::Playback
Start playback of media.
-
#play_with_id(channel_id : String, playback_id : String, media : String, lang : String? = nil, offsetms : Int32? = nil, skipms : Int32? = 3000) : HTTP::Client::Response | Playbacks::Playback
Start playback of media and specify the playbackId.
-
#record(channel_id : String, name : String, format : String, max_duration_seconds : Int32? = 0, max_silence_seconds : Int32? = 0, if_exists : String? = "fail", beep : Bool? = false, terminate_on : String? = "none") : HTTP::Client::Response | Recordings::LiveRecording
Start a recording.
-
#redirect(channel_id : String, endpoint : String)
Redirect the channel to a different location.
-
#ring(channel_id : String)
Indicate ringing to a channel.
-
#ring_stop(channel_id : String)
Stop ringing indication on a channel if locally generated.
-
#rtpstatistics(channel_id : String) : HTTP::Client::Response | RTPstat
RTP stats on a channel.
-
#send_dtmf(channel_id : String, dtmf : String? = nil, before : Int32? = 0, between : Int32? = 100, duration : Int32? = 100, after : Int32? = 0)
Send provided DTMF to a given channel.
-
#set_channel_var(channel_id : String, variable : String, value : String? = nil)
Set the value of a channel variable or function.
-
#snoop_channel(channel_id : String, app : String, spy : String? = "none", whisper : String? = "none", app_args : String? = nil, snoop_id : String? = nil) : HTTP::Client::Response | Channels::Channel
Start snooping.
-
#snoop_channel_with_id(channel_id : String, snoop_id : String, app : String, spy : String? = "none", whisper : String? = "none", app_args : String? = nil) : HTTP::Client::Response | Channels::Channel
Start snooping.
-
#start_moh(channel_id : String, moh_class : String? = nil)
Play music on hold to a channel.
-
#start_silence(channel_id : String)
Play silence to a channel.
-
#stop_moh(channel_id : String)
Stop playing music on hold to a channel.
-
#stop_silence(channel_id : String)
Stop playing silence to a channel.
-
#unhold(channel_id : String)
Remove a channel from hold.
-
#unmute(channel_id : String, direction : String? = "both")
Unmute a channel.
Instance methods inherited from class Asterisk::ARI::Resources
ari : ARI
ari
Constructor methods inherited from class Asterisk::ARI::Resources
new(ari)
new
Instance Method Detail
Answer a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Exit application; continue execution in the dialplan.
Arguments:
channel_id
- channel's id. (required);context
- the context to continue to;extension
- the extension to continue to;priority
- the priority to continue to;label
- the label to continue to - will supersede 'priority' if both are provided;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Create channel.
Arguments:
endpoint
- endpoint for channel communication. (required);app
- stasis Application to place channel into. (required);app_args
- the application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label';channel_id
- the unique id to assign the channel on creation;other_channel_id
- the unique id to assign the second channel when using local channels;originator
- unique ID of the calling channel;formats
- the format name capability list to use if originator is not specified. Ex. "ulaw,slin16". Format names can be found with "core show codecs";
Error responses:
- 409 - Channel with given unique ID already exists.
Dial a created channel.
Arguments:
channel_id
- channel's id. (required);caller
- channel ID of caller;timeout
- dial timeout;
Error responses:
- 404 - Channel cannot be found.
- 409 - Channel cannot be dialed.
Start an External Media session.
Arguments:
app
- stasis Application to place channel into. (required);external_host
- hostname/ip:port of external host. (required);format
- format to encode audio in. (required);channel_id
- the unique id to assign the channel on creation;variables
- the "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } };encapsulation
- payload encapsulation protocol;transport
- transport protocol;connection_type
- connection type (client/server);direction
- external media direction;
Error responses:
- 400 - Invalid parameters
- 409 - Channel is not in a Stasis application; Channel is already bridged
Channel details.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
Get the value of a channel variable or function.
Arguments:
channel_id
- channel's id. (required);variable
- the channel variable or function to get. (required);
Error responses:
- 400 - Missing variable parameter.
- 404 - Channel or variable not found
- 409 - Channel not in a Stasis application
Delete (i.e. hangup) a channel.
Arguments:
channel_id
- channel's id. (required);reason
- reason for hanging up the channel;
Error responses:
- 400 - Invalid reason for hangup provided
- 404 - Channel not found
Hold a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
List all active channels in Asterisk.
Move the channel from one Stasis application to another.
Arguments:
channel_id
- channel's id. (required);app
- the channel will be passed to this Stasis application. (required);app_args
- the application arguments to pass to the Stasis application provided by 'app';
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
Mute a channel.
Arguments:
channel_id
- channel's id. (required);direction
- direction in which to mute audio;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Create a new channel (originate).
Arguments:
endpoint
- endpoint to call. (required);extension
- the extension to dial after the endpoint answers. Mutually exclusive with 'app';context
- the context to dial after the endpoint answers. If omitted, uses 'default'. Mutually exclusive with 'app';priority
- the priority to dial after the endpoint answers. If omitted, uses 1. Mutually exclusive with 'app';label
- the label to dial after the endpoint answers. Will supersede 'priority' if provided. Mutually exclusive with 'app';app
- the application that is subscribed to the originated channel. When the channel is answered, it will be passed to this Stasis application. Mutually exclusive with 'context', 'extension', 'priority', and 'label';app_args
- the application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label';caller_id
- callerID to use when dialing the endpoint or extension;timeout
- timeout (in seconds) before giving up dialing, or -1 for no timeout;variables
- the "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } };channel_id
- the unique id to assign the channel on creation;other_channel_id
- the unique id to assign the second channel when using local channels;originator
- the unique id of the channel which is originating this one;formats
- the format name capability list to use if originator is not specified. Ex. "ulaw,slin16". Format names can be found with "core show codecs";
Error responses:
- 400 - Invalid parameters for originating a channel.
- 409 - Channel with given unique ID already exists.
Create a new channel (originate with id).
Arguments:
channel_id
- the unique id to assign the channel on creation. (required);endpoint
- endpoint to call. (required);extension
- the extension to dial after the endpoint answers. Mutually exclusive with 'app';context
- the context to dial after the endpoint answers. If omitted, uses 'default'. Mutually exclusive with 'app';priority
- the priority to dial after the endpoint answers. If omitted, uses 1. Mutually exclusive with 'app';label
- the label to dial after the endpoint answers. Will supersede 'priority' if provided. Mutually exclusive with 'app';app
- the application that is subscribed to the originated channel. When the channel is answered, it will be passed to this Stasis application. Mutually exclusive with 'context', 'extension', 'priority', and 'label';app_args
- the application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label';caller_id
- callerID to use when dialing the endpoint or extension;timeout
- timeout (in seconds) before giving up dialing, or -1 for no timeout;variables
- the "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } };other_channel_id
- the unique id to assign the second channel when using local channels;originator
- the unique id of the channel which is originating this one;formats
- the format name capability list to use if originator is not specified. Ex. "ulaw,slin16". Format names can be found with "core show codecs";
Error responses:
- 400 - Invalid parameters for originating a channel.
- 409 - Channel with given unique ID already exists.
Start playback of media.
Arguments:
channel_id
- channel's id. (required);media
- media URIs to play. (required). Allow multiple instances (comma-separated list);lang
- for sounds, selects language for sound;offsetms
- number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified;skipms
- number of milliseconds to skip for forward/reverse operations;playback_id
- playback ID;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Start playback of media and specify the playbackId.
Arguments:
channel_id
- channel's id. (required);playback_id
- playback ID. (required);media
- media URIs to play. (required). Allow multiple instances (comma-separated list);lang
- for sounds, selects language for sound;offsetms
- number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified;skipms
- number of milliseconds to skip for forward/reverse operations;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Start a recording.
Arguments:
channel_id
- channel's id. (required);name
- recording's filename. (required);format
- format to encode audio in. (required);max_duration_seconds
- maximum duration of the recording, in seconds. 0 for no limit;max_silence_seconds
- maximum duration of silence, in seconds. 0 for no limit;if_exists
- action to take if a recording with the same name already exists;beep
- play beep when recording begins;terminate_on
- dTMF input to terminate recording;
Error responses:
- 400 - Invalid parameters
- 404 - Channel not found
- 409 - Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail
- 422 - The format specified is unknown on this system
Redirect the channel to a different location.
Arguments:
channel_id
- channel's id. (required);endpoint
- the endpoint to redirect the channel to. (required);
Error responses:
- 400 - Endpoint parameter not provided
- 404 - Channel or endpoint not found
- 409 - Channel not in a Stasis application
- 422 - Endpoint is not the same type as the channel
- 412 - Channel in invalid state
Indicate ringing to a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Stop ringing indication on a channel if locally generated.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
RTP stats on a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel cannot be found.
Send provided DTMF to a given channel.
Arguments:
channel_id
- channel's id. (required);dtmf
- dTMF To send;before
- amount of time to wait before DTMF digits (specified in milliseconds) start;between
- amount of time in between DTMF digits (specified in milliseconds);duration
- length of each DTMF digit (specified in milliseconds);after
- amount of time to wait after DTMF digits (specified in milliseconds) end;
Error responses:
- 400 - DTMF is required
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Set the value of a channel variable or function.
Arguments:
channel_id
- channel's id. (required);variable
- the channel variable or function to set. (required);value
- the value to set the variable to;
Error responses:
- 400 - Missing variable parameter.
- 404 - Channel not found
- 409 - Channel not in a Stasis application
Start snooping.
Arguments:
channel_id
- channel's id. (required);app
- application the snooping channel is placed into. (required);spy
- direction of audio to spy on;whisper
- direction of audio to whisper into;app_args
- the application arguments to pass to the Stasis application;snoop_id
- unique ID to assign to snooping channel;
Error responses:
- 400 - Invalid parameters
- 404 - Channel not found
Start snooping.
Arguments:
channel_id
- channel's id. (required);snoop_id
- unique ID to assign to snooping channel. (required);app
- application the snooping channel is placed into. (required);spy
- direction of audio to spy on;whisper
- direction of audio to whisper into;app_args
- the application arguments to pass to the Stasis application;
Error responses:
- 400 - Invalid parameters
- 404 - Channel not found
Play music on hold to a channel.
Arguments:
channel_id
- channel's id. (required);moh_class
- music on hold class to use;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Play silence to a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Stop playing music on hold to a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Stop playing silence to a channel.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Remove a channel from hold.
Arguments:
channel_id
- channel's id. (required);
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state
Unmute a channel.
Arguments:
channel_id
- channel's id. (required);direction
- direction in which to unmute audio;
Error responses:
- 404 - Channel not found
- 409 - Channel not in a Stasis application
- 412 - Channel in invalid state