Class: Ari::Channel
- Defined in:
- lib/ari/resources/channel.rb
Instance Attribute Summary collapse
-
#accountcode ⇒ Object
readonly
Returns the value of attribute accountcode.
-
#caller ⇒ Object
Returns the value of attribute caller.
-
#connected ⇒ Object
Returns the value of attribute connected.
-
#creationtime ⇒ Object
Returns the value of attribute creationtime.
-
#dialplan ⇒ Object
Returns the value of attribute dialplan.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Class Method Summary collapse
-
.answer(options = {}) ⇒ Object
POST /channels/%channelId/answer.
-
.continue_in_dialplan(options = {}) ⇒ Object
POST /channels/%channelId/continue.
-
.continueInDialplan ⇒ Object
POST /channels/%channelId/continue.
-
.get(options = {}) ⇒ Object
GET /channels/%channelId.
-
.get_channel_var(options = {}) ⇒ Object
GET /channels/%channelId/variable.
-
.getChannelVar ⇒ Object
GET /channels/%channelId/variable.
-
.hangup(options = {}) ⇒ Object
DELETE /channels/%channelId.
-
.hold(options = {}) ⇒ Object
POST /channels/%channelId/hold.
-
.list(options = {}) ⇒ Object
GET /channels.
-
.mute(options = {}) ⇒ Object
POST /channels/%channelId/mute.
-
.originate(options = {}) ⇒ Object
POST /channels.
-
.originate_with_id(options = {}) ⇒ Object
POST /channels/%channelId.
-
.originateWithId ⇒ Object
POST /channels/%channelId.
-
.play(options = {}) ⇒ Object
POST /channels/%channelId/play.
-
.play_with_id(options = {}) ⇒ Object
POST /channels/%channelId/play/%playbackId.
-
.playWithId ⇒ Object
POST /channels/%channelId/play/%playbackId.
-
.record(options = {}) ⇒ Object
POST /channels/%channelId/record.
-
.redirect(options = {}) ⇒ Object
POST /channels/%channelId/redirect.
-
.ring(options = {}) ⇒ Object
POST /channels/%channelId/ring.
-
.ring_stop(options = {}) ⇒ Object
DELETE /channels/%channelId/ring.
-
.ringStop ⇒ Object
DELETE /channels/%channelId/ring.
-
.send_dtmf(options = {}) ⇒ Object
POST /channels/%channelId/dtmf.
-
.sendDTMF ⇒ Object
POST /channels/%channelId/dtmf.
-
.set_channel_var(options = {}) ⇒ Object
POST /channels/%channelId/variable.
-
.setChannelVar ⇒ Object
POST /channels/%channelId/variable.
-
.snoop_channel(options = {}) ⇒ Object
POST /channels/%channelId/snoop.
-
.snoop_channel_with_id(options = {}) ⇒ Object
POST /channels/%channelId/snoop/%snoopId.
-
.snoopChannel ⇒ Object
POST /channels/%channelId/snoop.
-
.snoopChannelWithId ⇒ Object
POST /channels/%channelId/snoop/%snoopId.
-
.start_moh(options = {}) ⇒ Object
POST /channels/%channelId/moh.
-
.start_silence(options = {}) ⇒ Object
POST /channels/%channelId/silence.
-
.startMoh ⇒ Object
POST /channels/%channelId/moh.
-
.startSilence ⇒ Object
POST /channels/%channelId/silence.
-
.stop_moh(options = {}) ⇒ Object
DELETE /channels/%channelId/moh.
-
.stop_silence(options = {}) ⇒ Object
DELETE /channels/%channelId/silence.
-
.stopMoh ⇒ Object
DELETE /channels/%channelId/moh.
-
.stopSilence ⇒ Object
DELETE /channels/%channelId/silence.
-
.unhold(options = {}) ⇒ Object
DELETE /channels/%channelId/hold.
-
.unmute(options = {}) ⇒ Object
DELETE /channels/%channelId/mute.
Instance Method Summary collapse
- #answer(options = {}) ⇒ Object
- #continue_in_dialplan(options = {}) ⇒ Object
- #get(options = {}) ⇒ Object
- #get_channel_var(options = {}) ⇒ Object
- #hangup(options = {}) ⇒ Object
- #hold(options = {}) ⇒ Object
- #mute(options = {}) ⇒ Object
- #originate_with_id(options = {}) ⇒ Object
- #play(options = {}) ⇒ Object
- #play_with_id(options = {}) ⇒ Object
- #record(options = {}) ⇒ Object
- #redirect(options = {}) ⇒ Object
- #ring(options = {}) ⇒ Object
- #ring_stop(options = {}) ⇒ Object
- #send_dtmf(options = {}) ⇒ Object
- #set_channel_var(options = {}) ⇒ Object
- #snoop_channel(options = {}) ⇒ Object
- #snoop_channel_with_id(options = {}) ⇒ Object
- #start_moh(options = {}) ⇒ Object
- #start_silence(options = {}) ⇒ Object
- #stop_moh(options = {}) ⇒ Object
- #stop_silence(options = {}) ⇒ Object
- #unhold(options = {}) ⇒ Object
- #unmute(options = {}) ⇒ Object
Methods inherited from Resource
#add_listener, client, #client, #remove_all_listeners!, #remove_listener
Methods inherited from Model
Constructor Details
This class inherits a constructor from Ari::Model
Instance Attribute Details
#accountcode ⇒ Object (readonly)
Returns the value of attribute accountcode.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def accountcode @accountcode end |
#caller ⇒ Object
Returns the value of attribute caller.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def caller @caller end |
#connected ⇒ Object
Returns the value of attribute connected.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def connected @connected end |
#creationtime ⇒ Object
Returns the value of attribute creationtime.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def creationtime @creationtime end |
#dialplan ⇒ Object
Returns the value of attribute dialplan.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def dialplan @dialplan end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def id @id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
15 16 17 |
# File 'lib/ari/resources/channel.rb', line 15 def state @state end |
Class Method Details
.answer(options = {}) ⇒ Object
POST /channels/%channelId/answer
Answer a channel
Parameters:
channelId (required) - Channel’s id
203 204 205 206 207 |
# File 'lib/ari/resources/channel.rb', line 203 def self.answer( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/answer' % response = client().post(path, ) end |
.continue_in_dialplan(options = {}) ⇒ Object
POST /channels/%channelId/continue
Exit application; continue execution in the dialplan
Parameters:
channelId (required) - Channel’s id 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.
162 163 164 165 166 |
# File 'lib/ari/resources/channel.rb', line 162 def self.continue_in_dialplan( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/continue' % response = client().post(path, ) end |
.continueInDialplan ⇒ Object
POST /channels/%channelId/continue
Exit application; continue execution in the dialplan
Parameters:
channelId (required) - Channel’s id 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.
167 168 169 170 171 |
# File 'lib/ari/resources/channel.rb', line 167 def self.continue_in_dialplan( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/continue' % response = client().post(path, ) end |
.get(options = {}) ⇒ Object
GET /channels/%channelId
Active channel
Parameters:
channelId (required) - Channel’s id
82 83 84 85 86 87 |
# File 'lib/ari/resources/channel.rb', line 82 def self.get( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}' % response = client().get(path, ) Channel.new(response.merge(client: [:client])) end |
.get_channel_var(options = {}) ⇒ Object
GET /channels/%channelId/variable
Variables on a channel
Parameters:
channelId (required) - Channel’s id variable (required) - The channel variable or function to get
539 540 541 542 543 544 545 |
# File 'lib/ari/resources/channel.rb', line 539 def self.get_channel_var( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter variable must be passed in options hash.") unless [:variable] path = '/channels/%{channelId}/variable' % response = client().get(path, ) Variable.new(response.merge(client: [:client])) end |
.getChannelVar ⇒ Object
GET /channels/%channelId/variable
Variables on a channel
Parameters:
channelId (required) - Channel’s id variable (required) - The channel variable or function to get
546 547 548 549 550 551 552 |
# File 'lib/ari/resources/channel.rb', line 546 def self.get_channel_var( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter variable must be passed in options hash.") unless [:variable] path = '/channels/%{channelId}/variable' % response = client().get(path, ) Variable.new(response.merge(client: [:client])) end |
.hangup(options = {}) ⇒ Object
DELETE /channels/%channelId
Active channel
Parameters:
channelId (required) - Channel’s id reason - Reason for hanging up the channel
137 138 139 140 141 142 143 |
# File 'lib/ari/resources/channel.rb', line 137 def self.hangup( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.hold(options = {}) ⇒ Object
POST /channels/%channelId/hold
Put a channel on hold
Parameters:
channelId (required) - Channel’s id
330 331 332 333 334 |
# File 'lib/ari/resources/channel.rb', line 330 def self.hold( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/hold' % response = client().post(path, ) end |
.list(options = {}) ⇒ Object
GET /channels
Active channels
39 40 41 42 43 |
# File 'lib/ari/resources/channel.rb', line 39 def self.list( = {}) path = '/channels' response = client().get(path, ) response.map { |hash| Channel.new(hash.merge(client: [:client])) } end |
.mute(options = {}) ⇒ Object
POST /channels/%channelId/mute
Mute a channel
Parameters:
channelId (required) - Channel’s id direction - Direction in which to mute audio
289 290 291 292 293 |
# File 'lib/ari/resources/channel.rb', line 289 def self.mute( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/mute' % response = client().post(path, ) end |
.originate(options = {}) ⇒ Object
POST /channels
Active channels
Parameters:
endpoint (required) - Endpoint to call. 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’. appArgs - The application arguments to pass to the Stasis application provided by ‘app’. Mutually exclusive with ‘context’, ‘extension’, ‘priority’, and ‘label’. callerId - 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” } } channelId - The unique id to assign the channel on creation. otherChannelId - The unique id to assign the second channel when using local channels. originator - The unique id of the channel which is originating this one.
66 67 68 69 70 71 |
# File 'lib/ari/resources/channel.rb', line 66 def self.originate( = {}) raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless [:endpoint] path = '/channels' response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.originate_with_id(options = {}) ⇒ Object
POST /channels/%channelId
Active channel
Parameters:
channelId (required) - The unique id to assign the channel on creation. endpoint (required) - Endpoint to call. 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’. appArgs - The application arguments to pass to the Stasis application provided by ‘app’. Mutually exclusive with ‘context’, ‘extension’, ‘priority’, and ‘label’. callerId - 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” } } otherChannelId - The unique id to assign the second channel when using local channels. originator - The unique id of the channel which is originating this one.
114 115 116 117 118 119 120 |
# File 'lib/ari/resources/channel.rb', line 114 def self.originate_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless [:endpoint] path = '/channels/%{channelId}' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.originateWithId ⇒ Object
POST /channels/%channelId
Active channel
Parameters:
channelId (required) - The unique id to assign the channel on creation. endpoint (required) - Endpoint to call. 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’. appArgs - The application arguments to pass to the Stasis application provided by ‘app’. Mutually exclusive with ‘context’, ‘extension’, ‘priority’, and ‘label’. callerId - 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” } } otherChannelId - The unique id to assign the second channel when using local channels. originator - The unique id of the channel which is originating this one.
121 122 123 124 125 126 127 |
# File 'lib/ari/resources/channel.rb', line 121 def self.originate_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless [:endpoint] path = '/channels/%{channelId}' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.play(options = {}) ⇒ Object
POST /channels/%channelId/play
Play media to a channel
Parameters:
channelId (required) - Channel’s id media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations. playbackId - Playback ID.
460 461 462 463 464 465 466 |
# File 'lib/ari/resources/channel.rb', line 460 def self.play( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/channels/%{channelId}/play' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.play_with_id(options = {}) ⇒ Object
POST /channels/%channelId/play/%playbackId
Play media to a channel
Parameters:
channelId (required) - Channel’s id playbackId (required) - Playback ID. media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations.
486 487 488 489 490 491 492 493 |
# File 'lib/ari/resources/channel.rb', line 486 def self.play_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless [:playbackId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/channels/%{channelId}/play/%{playbackId}' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.playWithId ⇒ Object
POST /channels/%channelId/play/%playbackId
Play media to a channel
Parameters:
channelId (required) - Channel’s id playbackId (required) - Playback ID. media (required) - Media’s URI to play. lang - For sounds, selects language for sound. offsetms - Number of media to skip before playing. skipms - Number of milliseconds to skip for forward/reverse operations.
494 495 496 497 498 499 500 501 |
# File 'lib/ari/resources/channel.rb', line 494 def self.play_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless [:playbackId] raise ArgumentError.new("Parameter media must be passed in options hash.") unless [:media] path = '/channels/%{channelId}/play/%{playbackId}' % response = client().post(path, ) Playback.new(response.merge(client: [:client])) end |
.record(options = {}) ⇒ Object
POST /channels/%channelId/record
Record audio from a channel
Parameters:
channelId (required) - Channel’s id name (required) - Recording’s filename format (required) - Format to encode audio in maxDurationSeconds - Maximum duration of the recording, in seconds. 0 for no limit maxSilenceSeconds - Maximum duration of silence, in seconds. 0 for no limit ifExists - Action to take if a recording with the same name already exists. beep - Play beep when recording begins terminateOn - DTMF input to terminate recording
516 517 518 519 520 521 522 523 |
# File 'lib/ari/resources/channel.rb', line 516 def self.record( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter name must be passed in options hash.") unless [:name] raise ArgumentError.new("Parameter format must be passed in options hash.") unless [:format] path = '/channels/%{channelId}/record' % response = client().post(path, ) LiveRecording.new(response.merge(client: [:client])) end |
.redirect(options = {}) ⇒ Object
POST /channels/%channelId/redirect
Inform the channel that it should redirect itself to a different location. Note that this will almost certainly cause the channel to exit the application.
Parameters:
channelId (required) - Channel’s id endpoint (required) - The endpoint to redirect the channel to
183 184 185 186 187 188 |
# File 'lib/ari/resources/channel.rb', line 183 def self.redirect( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless [:endpoint] path = '/channels/%{channelId}/redirect' % response = client().post(path, ) end |
.ring(options = {}) ⇒ Object
POST /channels/%channelId/ring
Send a ringing indication to a channel
Parameters:
channelId (required) - Channel’s id
222 223 224 225 226 |
# File 'lib/ari/resources/channel.rb', line 222 def self.ring( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/ring' % response = client().post(path, ) end |
.ring_stop(options = {}) ⇒ Object
DELETE /channels/%channelId/ring
Send a ringing indication to a channel
Parameters:
channelId (required) - Channel’s id
241 242 243 244 245 246 247 |
# File 'lib/ari/resources/channel.rb', line 241 def self.ring_stop( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/ring' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.ringStop ⇒ Object
DELETE /channels/%channelId/ring
Send a ringing indication to a channel
Parameters:
channelId (required) - Channel’s id
248 249 250 251 252 253 254 |
# File 'lib/ari/resources/channel.rb', line 248 def self.ring_stop( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/ring' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.send_dtmf(options = {}) ⇒ Object
POST /channels/%channelId/dtmf
Send DTMF to a channel
Parameters:
channelId (required) - Channel’s id 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.
268 269 270 271 272 |
# File 'lib/ari/resources/channel.rb', line 268 def self.send_dtmf( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/dtmf' % response = client().post(path, ) end |
.sendDTMF ⇒ Object
POST /channels/%channelId/dtmf
Send DTMF to a channel
Parameters:
channelId (required) - Channel’s id 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.
273 274 275 276 277 |
# File 'lib/ari/resources/channel.rb', line 273 def self.send_dtmf( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/dtmf' % response = client().post(path, ) end |
.set_channel_var(options = {}) ⇒ Object
POST /channels/%channelId/variable
Variables on a channel
Parameters:
channelId (required) - Channel’s id variable (required) - The channel variable or function to set value - The value to set the variable to
563 564 565 566 567 568 |
# File 'lib/ari/resources/channel.rb', line 563 def self.set_channel_var( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter variable must be passed in options hash.") unless [:variable] path = '/channels/%{channelId}/variable' % response = client().post(path, ) end |
.setChannelVar ⇒ Object
POST /channels/%channelId/variable
Variables on a channel
Parameters:
channelId (required) - Channel’s id variable (required) - The channel variable or function to set value - The value to set the variable to
569 570 571 572 573 574 |
# File 'lib/ari/resources/channel.rb', line 569 def self.set_channel_var( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter variable must be passed in options hash.") unless [:variable] path = '/channels/%{channelId}/variable' % response = client().post(path, ) end |
.snoop_channel(options = {}) ⇒ Object
POST /channels/%channelId/snoop
Snoop (spy/whisper) on a channel
Parameters:
channelId (required) - Channel’s id spy - Direction of audio to spy on whisper - Direction of audio to whisper into app (required) - Application the snooping channel is placed into appArgs - The application arguments to pass to the Stasis application snoopId - Unique ID to assign to snooping channel
589 590 591 592 593 594 595 |
# File 'lib/ari/resources/channel.rb', line 589 def self.snoop_channel( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter app must be passed in options hash.") unless [:app] path = '/channels/%{channelId}/snoop' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.snoop_channel_with_id(options = {}) ⇒ Object
POST /channels/%channelId/snoop/%snoopId
Snoop (spy/whisper) on a channel
Parameters:
channelId (required) - Channel’s id snoopId (required) - Unique ID to assign to snooping channel spy - Direction of audio to spy on whisper - Direction of audio to whisper into app (required) - Application the snooping channel is placed into appArgs - The application arguments to pass to the Stasis application
616 617 618 619 620 621 622 623 |
# File 'lib/ari/resources/channel.rb', line 616 def self.snoop_channel_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter snoopId must be passed in options hash.") unless [:snoopId] raise ArgumentError.new("Parameter app must be passed in options hash.") unless [:app] path = '/channels/%{channelId}/snoop/%{snoopId}' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.snoopChannel ⇒ Object
POST /channels/%channelId/snoop
Snoop (spy/whisper) on a channel
Parameters:
channelId (required) - Channel’s id spy - Direction of audio to spy on whisper - Direction of audio to whisper into app (required) - Application the snooping channel is placed into appArgs - The application arguments to pass to the Stasis application snoopId - Unique ID to assign to snooping channel
596 597 598 599 600 601 602 |
# File 'lib/ari/resources/channel.rb', line 596 def self.snoop_channel( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter app must be passed in options hash.") unless [:app] path = '/channels/%{channelId}/snoop' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.snoopChannelWithId ⇒ Object
POST /channels/%channelId/snoop/%snoopId
Snoop (spy/whisper) on a channel
Parameters:
channelId (required) - Channel’s id snoopId (required) - Unique ID to assign to snooping channel spy - Direction of audio to spy on whisper - Direction of audio to whisper into app (required) - Application the snooping channel is placed into appArgs - The application arguments to pass to the Stasis application
624 625 626 627 628 629 630 631 |
# File 'lib/ari/resources/channel.rb', line 624 def self.snoop_channel_with_id( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] raise ArgumentError.new("Parameter snoopId must be passed in options hash.") unless [:snoopId] raise ArgumentError.new("Parameter app must be passed in options hash.") unless [:app] path = '/channels/%{channelId}/snoop/%{snoopId}' % response = client().post(path, ) Channel.new(response.merge(client: [:client])) end |
.start_moh(options = {}) ⇒ Object
POST /channels/%channelId/moh
Play music on hold to a channel
Parameters:
channelId (required) - Channel’s id mohClass - Music on hold class to use
371 372 373 374 375 |
# File 'lib/ari/resources/channel.rb', line 371 def self.start_moh( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/moh' % response = client().post(path, ) end |
.start_silence(options = {}) ⇒ Object
POST /channels/%channelId/silence
Play silence to a channel
Parameters:
channelId (required) - Channel’s id
413 414 415 416 417 |
# File 'lib/ari/resources/channel.rb', line 413 def self.start_silence( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/silence' % response = client().post(path, ) end |
.startMoh ⇒ Object
POST /channels/%channelId/moh
Play music on hold to a channel
Parameters:
channelId (required) - Channel’s id mohClass - Music on hold class to use
376 377 378 379 380 |
# File 'lib/ari/resources/channel.rb', line 376 def self.start_moh( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/moh' % response = client().post(path, ) end |
.startSilence ⇒ Object
POST /channels/%channelId/silence
Play silence to a channel
Parameters:
channelId (required) - Channel’s id
418 419 420 421 422 |
# File 'lib/ari/resources/channel.rb', line 418 def self.start_silence( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/silence' % response = client().post(path, ) end |
.stop_moh(options = {}) ⇒ Object
DELETE /channels/%channelId/moh
Play music on hold to a channel
Parameters:
channelId (required) - Channel’s id
391 392 393 394 395 396 397 |
# File 'lib/ari/resources/channel.rb', line 391 def self.stop_moh( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/moh' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.stop_silence(options = {}) ⇒ Object
DELETE /channels/%channelId/silence
Play silence to a channel
Parameters:
channelId (required) - Channel’s id
433 434 435 436 437 438 439 |
# File 'lib/ari/resources/channel.rb', line 433 def self.stop_silence( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/silence' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.stopMoh ⇒ Object
DELETE /channels/%channelId/moh
Play music on hold to a channel
Parameters:
channelId (required) - Channel’s id
398 399 400 401 402 403 404 |
# File 'lib/ari/resources/channel.rb', line 398 def self.stop_moh( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/moh' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.stopSilence ⇒ Object
DELETE /channels/%channelId/silence
Play silence to a channel
Parameters:
channelId (required) - Channel’s id
440 441 442 443 444 445 446 |
# File 'lib/ari/resources/channel.rb', line 440 def self.stop_silence( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/silence' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.unhold(options = {}) ⇒ Object
DELETE /channels/%channelId/hold
Put a channel on hold
Parameters:
channelId (required) - Channel’s id
349 350 351 352 353 354 355 |
# File 'lib/ari/resources/channel.rb', line 349 def self.unhold( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/hold' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
.unmute(options = {}) ⇒ Object
DELETE /channels/%channelId/mute
Mute a channel
Parameters:
channelId (required) - Channel’s id direction - Direction in which to unmute audio
309 310 311 312 313 314 315 |
# File 'lib/ari/resources/channel.rb', line 309 def self.unmute( = {}) raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless [:channelId] path = '/channels/%{channelId}/mute' % response = client().delete(path, ) rescue Ari::RequestError => e raise unless e.code == '404' end |
Instance Method Details
#answer(options = {}) ⇒ Object
209 210 211 |
# File 'lib/ari/resources/channel.rb', line 209 def answer( = {}) self.class.answer(.merge(channelId: self.id, client: @client)) end |
#continue_in_dialplan(options = {}) ⇒ Object
169 170 171 |
# File 'lib/ari/resources/channel.rb', line 169 def continue_in_dialplan( = {}) self.class.continue_in_dialplan(.merge(channelId: self.id, client: @client)) end |
#get(options = {}) ⇒ Object
89 90 91 |
# File 'lib/ari/resources/channel.rb', line 89 def get( = {}) self.class.get(.merge(channelId: self.id, client: @client)) end |
#get_channel_var(options = {}) ⇒ Object
548 549 550 |
# File 'lib/ari/resources/channel.rb', line 548 def get_channel_var( = {}) self.class.get_channel_var(.merge(channelId: self.id, client: @client)) end |
#hangup(options = {}) ⇒ Object
145 146 147 |
# File 'lib/ari/resources/channel.rb', line 145 def hangup( = {}) self.class.hangup(.merge(channelId: self.id, client: @client)) end |
#hold(options = {}) ⇒ Object
336 337 338 |
# File 'lib/ari/resources/channel.rb', line 336 def hold( = {}) self.class.hold(.merge(channelId: self.id, client: @client)) end |
#mute(options = {}) ⇒ Object
295 296 297 |
# File 'lib/ari/resources/channel.rb', line 295 def mute( = {}) self.class.mute(.merge(channelId: self.id, client: @client)) end |
#originate_with_id(options = {}) ⇒ Object
123 124 125 |
# File 'lib/ari/resources/channel.rb', line 123 def originate_with_id( = {}) self.class.originate_with_id(.merge(channelId: self.id, client: @client)) end |
#play(options = {}) ⇒ Object
468 469 470 |
# File 'lib/ari/resources/channel.rb', line 468 def play( = {}) self.class.play(.merge(channelId: self.id, client: @client)) end |
#play_with_id(options = {}) ⇒ Object
496 497 498 |
# File 'lib/ari/resources/channel.rb', line 496 def play_with_id( = {}) self.class.play_with_id(.merge(channelId: self.id, client: @client)) end |
#record(options = {}) ⇒ Object
525 526 527 |
# File 'lib/ari/resources/channel.rb', line 525 def record( = {}) self.class.record(.merge(channelId: self.id, client: @client)) end |
#redirect(options = {}) ⇒ Object
190 191 192 |
# File 'lib/ari/resources/channel.rb', line 190 def redirect( = {}) self.class.redirect(.merge(channelId: self.id, client: @client)) end |
#ring(options = {}) ⇒ Object
228 229 230 |
# File 'lib/ari/resources/channel.rb', line 228 def ring( = {}) self.class.ring(.merge(channelId: self.id, client: @client)) end |
#ring_stop(options = {}) ⇒ Object
250 251 252 |
# File 'lib/ari/resources/channel.rb', line 250 def ring_stop( = {}) self.class.ring_stop(.merge(channelId: self.id, client: @client)) end |
#send_dtmf(options = {}) ⇒ Object
275 276 277 |
# File 'lib/ari/resources/channel.rb', line 275 def send_dtmf( = {}) self.class.send_dtmf(.merge(channelId: self.id, client: @client)) end |
#set_channel_var(options = {}) ⇒ Object
571 572 573 |
# File 'lib/ari/resources/channel.rb', line 571 def set_channel_var( = {}) self.class.set_channel_var(.merge(channelId: self.id, client: @client)) end |
#snoop_channel(options = {}) ⇒ Object
598 599 600 |
# File 'lib/ari/resources/channel.rb', line 598 def snoop_channel( = {}) self.class.snoop_channel(.merge(channelId: self.id, client: @client)) end |
#snoop_channel_with_id(options = {}) ⇒ Object
626 627 628 |
# File 'lib/ari/resources/channel.rb', line 626 def snoop_channel_with_id( = {}) self.class.snoop_channel_with_id(.merge(channelId: self.id, client: @client)) end |
#start_moh(options = {}) ⇒ Object
378 379 380 |
# File 'lib/ari/resources/channel.rb', line 378 def start_moh( = {}) self.class.start_moh(.merge(channelId: self.id, client: @client)) end |
#start_silence(options = {}) ⇒ Object
420 421 422 |
# File 'lib/ari/resources/channel.rb', line 420 def start_silence( = {}) self.class.start_silence(.merge(channelId: self.id, client: @client)) end |
#stop_moh(options = {}) ⇒ Object
400 401 402 |
# File 'lib/ari/resources/channel.rb', line 400 def stop_moh( = {}) self.class.stop_moh(.merge(channelId: self.id, client: @client)) end |
#stop_silence(options = {}) ⇒ Object
442 443 444 |
# File 'lib/ari/resources/channel.rb', line 442 def stop_silence( = {}) self.class.stop_silence(.merge(channelId: self.id, client: @client)) end |
#unhold(options = {}) ⇒ Object
357 358 359 |
# File 'lib/ari/resources/channel.rb', line 357 def unhold( = {}) self.class.unhold(.merge(channelId: self.id, client: @client)) end |
#unmute(options = {}) ⇒ Object
317 318 319 |
# File 'lib/ari/resources/channel.rb', line 317 def unmute( = {}) self.class.unmute(.merge(channelId: self.id, client: @client)) end |