Class: Ari::Channel

Inherits:
Resource show all
Defined in:
lib/ari/resources/channel.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#add_listener, client, #client, #remove_all_listeners!, #remove_listener

Methods inherited from Model

#attributes=, #initialize

Constructor Details

This class inherits a constructor from Ari::Model

Instance Attribute Details

#accountcodeObject (readonly)

Returns the value of attribute accountcode.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def accountcode
  @accountcode
end

#callerObject

Returns the value of attribute caller.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def caller
  @caller
end

#connectedObject

Returns the value of attribute connected.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def connected
  @connected
end

#creationtimeObject

Returns the value of attribute creationtime.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def creationtime
  @creationtime
end

#dialplanObject

Returns the value of attribute dialplan.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def dialplan
  @dialplan
end

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/ari/resources/channel.rb', line 15

def name
  @name
end

#stateObject (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

Raises:

  • (ArgumentError)


203
204
205
206
207
# File 'lib/ari/resources/channel.rb', line 203

def self.answer(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/answer' % options
  response = client(options).post(path, options)
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.

Raises:

  • (ArgumentError)


162
163
164
165
166
# File 'lib/ari/resources/channel.rb', line 162

def self.continue_in_dialplan(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/continue' % options
  response = client(options).post(path, options)
end

.continueInDialplanObject

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.

Raises:

  • (ArgumentError)


167
168
169
170
171
# File 'lib/ari/resources/channel.rb', line 167

def self.continue_in_dialplan(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/continue' % options
  response = client(options).post(path, options)
end

.get(options = {}) ⇒ Object

GET /channels/%channelId

Active channel

Parameters:

channelId (required) - Channel’s id

Raises:

  • (ArgumentError)


82
83
84
85
86
87
# File 'lib/ari/resources/channel.rb', line 82

def self.get(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}' % options
  response = client(options).get(path, options)
  Channel.new(response.merge(client: options[: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

Raises:

  • (ArgumentError)


539
540
541
542
543
544
545
# File 'lib/ari/resources/channel.rb', line 539

def self.get_channel_var(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter variable must be passed in options hash.") unless options[:variable]
  path = '/channels/%{channelId}/variable' % options
  response = client(options).get(path, options)
  Variable.new(response.merge(client: options[:client]))
end

.getChannelVarObject

GET /channels/%channelId/variable

Variables on a channel

Parameters:

channelId (required) - Channel’s id variable (required) - The channel variable or function to get

Raises:

  • (ArgumentError)


546
547
548
549
550
551
552
# File 'lib/ari/resources/channel.rb', line 546

def self.get_channel_var(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter variable must be passed in options hash.") unless options[:variable]
  path = '/channels/%{channelId}/variable' % options
  response = client(options).get(path, options)
  Variable.new(response.merge(client: options[: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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}' % options
  response = client(options).delete(path, options)
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

Raises:

  • (ArgumentError)


330
331
332
333
334
# File 'lib/ari/resources/channel.rb', line 330

def self.hold(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/hold' % options
  response = client(options).post(path, options)
end

.list(options = {}) ⇒ Object

GET /channels

Active channels



39
40
41
42
43
# File 'lib/ari/resources/channel.rb', line 39

def self.list(options = {})
  path = '/channels'
  response = client(options).get(path, options)
  response.map { |hash| Channel.new(hash.merge(client: options[: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

Raises:

  • (ArgumentError)


289
290
291
292
293
# File 'lib/ari/resources/channel.rb', line 289

def self.mute(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/mute' % options
  response = client(options).post(path, options)
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.

Raises:

  • (ArgumentError)


66
67
68
69
70
71
# File 'lib/ari/resources/channel.rb', line 66

def self.originate(options = {})
  raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless options[:endpoint]
  path = '/channels'
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[: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.

Raises:

  • (ArgumentError)


114
115
116
117
118
119
120
# File 'lib/ari/resources/channel.rb', line 114

def self.originate_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless options[:endpoint]
  path = '/channels/%{channelId}' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[:client]))
end

.originateWithIdObject

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.

Raises:

  • (ArgumentError)


121
122
123
124
125
126
127
# File 'lib/ari/resources/channel.rb', line 121

def self.originate_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless options[:endpoint]
  path = '/channels/%{channelId}' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[: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.

Raises:

  • (ArgumentError)


460
461
462
463
464
465
466
# File 'lib/ari/resources/channel.rb', line 460

def self.play(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter media must be passed in options hash.") unless options[:media]
  path = '/channels/%{channelId}/play' % options
  response = client(options).post(path, options)
  Playback.new(response.merge(client: options[: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.

Raises:

  • (ArgumentError)


486
487
488
489
490
491
492
493
# File 'lib/ari/resources/channel.rb', line 486

def self.play_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
  raise ArgumentError.new("Parameter media must be passed in options hash.") unless options[:media]
  path = '/channels/%{channelId}/play/%{playbackId}' % options
  response = client(options).post(path, options)
  Playback.new(response.merge(client: options[:client]))
end

.playWithIdObject

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.

Raises:

  • (ArgumentError)


494
495
496
497
498
499
500
501
# File 'lib/ari/resources/channel.rb', line 494

def self.play_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter playbackId must be passed in options hash.") unless options[:playbackId]
  raise ArgumentError.new("Parameter media must be passed in options hash.") unless options[:media]
  path = '/channels/%{channelId}/play/%{playbackId}' % options
  response = client(options).post(path, options)
  Playback.new(response.merge(client: options[: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

Raises:

  • (ArgumentError)


516
517
518
519
520
521
522
523
# File 'lib/ari/resources/channel.rb', line 516

def self.record(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter name must be passed in options hash.") unless options[:name]
  raise ArgumentError.new("Parameter format must be passed in options hash.") unless options[:format]
  path = '/channels/%{channelId}/record' % options
  response = client(options).post(path, options)
  LiveRecording.new(response.merge(client: options[: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

Raises:

  • (ArgumentError)


183
184
185
186
187
188
# File 'lib/ari/resources/channel.rb', line 183

def self.redirect(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter endpoint must be passed in options hash.") unless options[:endpoint]
  path = '/channels/%{channelId}/redirect' % options
  response = client(options).post(path, options)
end

.ring(options = {}) ⇒ Object

POST /channels/%channelId/ring

Send a ringing indication to a channel

Parameters:

channelId (required) - Channel’s id

Raises:

  • (ArgumentError)


222
223
224
225
226
# File 'lib/ari/resources/channel.rb', line 222

def self.ring(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/ring' % options
  response = client(options).post(path, options)
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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/ring' % options
  response = client(options).delete(path, options)
rescue Ari::RequestError => e
  raise unless e.code == '404'
end

.ringStopObject

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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/ring' % options
  response = client(options).delete(path, options)
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.

Raises:

  • (ArgumentError)


268
269
270
271
272
# File 'lib/ari/resources/channel.rb', line 268

def self.send_dtmf(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/dtmf' % options
  response = client(options).post(path, options)
end

.sendDTMFObject

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.

Raises:

  • (ArgumentError)


273
274
275
276
277
# File 'lib/ari/resources/channel.rb', line 273

def self.send_dtmf(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/dtmf' % options
  response = client(options).post(path, options)
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

Raises:

  • (ArgumentError)


563
564
565
566
567
568
# File 'lib/ari/resources/channel.rb', line 563

def self.set_channel_var(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter variable must be passed in options hash.") unless options[:variable]
  path = '/channels/%{channelId}/variable' % options
  response = client(options).post(path, options)
end

.setChannelVarObject

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

Raises:

  • (ArgumentError)


569
570
571
572
573
574
# File 'lib/ari/resources/channel.rb', line 569

def self.set_channel_var(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter variable must be passed in options hash.") unless options[:variable]
  path = '/channels/%{channelId}/variable' % options
  response = client(options).post(path, options)
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

Raises:

  • (ArgumentError)


589
590
591
592
593
594
595
# File 'lib/ari/resources/channel.rb', line 589

def self.snoop_channel(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter app must be passed in options hash.") unless options[:app]
  path = '/channels/%{channelId}/snoop' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[: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

Raises:

  • (ArgumentError)


616
617
618
619
620
621
622
623
# File 'lib/ari/resources/channel.rb', line 616

def self.snoop_channel_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter snoopId must be passed in options hash.") unless options[:snoopId]
  raise ArgumentError.new("Parameter app must be passed in options hash.") unless options[:app]
  path = '/channels/%{channelId}/snoop/%{snoopId}' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[:client]))
end

.snoopChannelObject

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

Raises:

  • (ArgumentError)


596
597
598
599
600
601
602
# File 'lib/ari/resources/channel.rb', line 596

def self.snoop_channel(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter app must be passed in options hash.") unless options[:app]
  path = '/channels/%{channelId}/snoop' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[:client]))
end

.snoopChannelWithIdObject

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

Raises:

  • (ArgumentError)


624
625
626
627
628
629
630
631
# File 'lib/ari/resources/channel.rb', line 624

def self.snoop_channel_with_id(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  raise ArgumentError.new("Parameter snoopId must be passed in options hash.") unless options[:snoopId]
  raise ArgumentError.new("Parameter app must be passed in options hash.") unless options[:app]
  path = '/channels/%{channelId}/snoop/%{snoopId}' % options
  response = client(options).post(path, options)
  Channel.new(response.merge(client: options[: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

Raises:

  • (ArgumentError)


371
372
373
374
375
# File 'lib/ari/resources/channel.rb', line 371

def self.start_moh(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/moh' % options
  response = client(options).post(path, options)
end

.start_silence(options = {}) ⇒ Object

POST /channels/%channelId/silence

Play silence to a channel

Parameters:

channelId (required) - Channel’s id

Raises:

  • (ArgumentError)


413
414
415
416
417
# File 'lib/ari/resources/channel.rb', line 413

def self.start_silence(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/silence' % options
  response = client(options).post(path, options)
end

.startMohObject

POST /channels/%channelId/moh

Play music on hold to a channel

Parameters:

channelId (required) - Channel’s id mohClass - Music on hold class to use

Raises:

  • (ArgumentError)


376
377
378
379
380
# File 'lib/ari/resources/channel.rb', line 376

def self.start_moh(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/moh' % options
  response = client(options).post(path, options)
end

.startSilenceObject

POST /channels/%channelId/silence

Play silence to a channel

Parameters:

channelId (required) - Channel’s id

Raises:

  • (ArgumentError)


418
419
420
421
422
# File 'lib/ari/resources/channel.rb', line 418

def self.start_silence(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/silence' % options
  response = client(options).post(path, options)
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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/moh' % options
  response = client(options).delete(path, options)
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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/silence' % options
  response = client(options).delete(path, options)
rescue Ari::RequestError => e
  raise unless e.code == '404'
end

.stopMohObject

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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/moh' % options
  response = client(options).delete(path, options)
rescue Ari::RequestError => e
  raise unless e.code == '404'
end

.stopSilenceObject

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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/silence' % options
  response = client(options).delete(path, options)
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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/hold' % options
  response = client(options).delete(path, options)
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(options = {})
  raise ArgumentError.new("Parameter channelId must be passed in options hash.") unless options[:channelId]
  path = '/channels/%{channelId}/mute' % options
  response = client(options).delete(path, options)
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(options = {})
  self.class.answer(options.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(options = {})
  self.class.continue_in_dialplan(options.merge(channelId: self.id, client: @client))
end

#get(options = {}) ⇒ Object



89
90
91
# File 'lib/ari/resources/channel.rb', line 89

def get(options = {})
  self.class.get(options.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(options = {})
  self.class.get_channel_var(options.merge(channelId: self.id, client: @client))
end

#hangup(options = {}) ⇒ Object



145
146
147
# File 'lib/ari/resources/channel.rb', line 145

def hangup(options = {})
  self.class.hangup(options.merge(channelId: self.id, client: @client))
end

#hold(options = {}) ⇒ Object



336
337
338
# File 'lib/ari/resources/channel.rb', line 336

def hold(options = {})
  self.class.hold(options.merge(channelId: self.id, client: @client))
end

#mute(options = {}) ⇒ Object



295
296
297
# File 'lib/ari/resources/channel.rb', line 295

def mute(options = {})
  self.class.mute(options.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(options = {})
  self.class.originate_with_id(options.merge(channelId: self.id, client: @client))
end

#play(options = {}) ⇒ Object



468
469
470
# File 'lib/ari/resources/channel.rb', line 468

def play(options = {})
  self.class.play(options.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(options = {})
  self.class.play_with_id(options.merge(channelId: self.id, client: @client))
end

#record(options = {}) ⇒ Object



525
526
527
# File 'lib/ari/resources/channel.rb', line 525

def record(options = {})
  self.class.record(options.merge(channelId: self.id, client: @client))
end

#redirect(options = {}) ⇒ Object



190
191
192
# File 'lib/ari/resources/channel.rb', line 190

def redirect(options = {})
  self.class.redirect(options.merge(channelId: self.id, client: @client))
end

#ring(options = {}) ⇒ Object



228
229
230
# File 'lib/ari/resources/channel.rb', line 228

def ring(options = {})
  self.class.ring(options.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(options = {})
  self.class.ring_stop(options.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(options = {})
  self.class.send_dtmf(options.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(options = {})
  self.class.set_channel_var(options.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(options = {})
  self.class.snoop_channel(options.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(options = {})
  self.class.snoop_channel_with_id(options.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(options = {})
  self.class.start_moh(options.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(options = {})
  self.class.start_silence(options.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(options = {})
  self.class.stop_moh(options.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(options = {})
  self.class.stop_silence(options.merge(channelId: self.id, client: @client))
end

#unhold(options = {}) ⇒ Object



357
358
359
# File 'lib/ari/resources/channel.rb', line 357

def unhold(options = {})
  self.class.unhold(options.merge(channelId: self.id, client: @client))
end

#unmute(options = {}) ⇒ Object



317
318
319
# File 'lib/ari/resources/channel.rb', line 317

def unmute(options = {})
  self.class.unmute(options.merge(channelId: self.id, client: @client))
end