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

#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)

177
178
179
180
181
# File 'lib/ari/resources/channel.rb', line 177

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.

Raises:

  • (ArgumentError)

157
158
159
160
161
# File 'lib/ari/resources/channel.rb', line 157

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.

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

.get(options = {}) ⇒ Object

GET /channels/%channelId

Active channel

Parameters:

channelId (required) - Channel's id

Raises:

  • (ArgumentError)

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

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)

513
514
515
516
517
518
519
# File 'lib/ari/resources/channel.rb', line 513

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)

520
521
522
523
524
525
526
# File 'lib/ari/resources/channel.rb', line 520

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


133
134
135
136
137
138
139
# File 'lib/ari/resources/channel.rb', line 133

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)

304
305
306
307
308
# File 'lib/ari/resources/channel.rb', line 304

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)

263
264
265
266
267
# File 'lib/ari/resources/channel.rb', line 263

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 context - The context to dial after the endpoint answers. If omitted, uses 'default' priority - The priority to dial after the endpoint answers. If omitted, uses 1 app - The application that is subscribed to the originated channel, and passed to the Stasis application. appArgs - The application arguments to pass to the Stasis application. 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.

Raises:

  • (ArgumentError)

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

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 context - The context to dial after the endpoint answers. If omitted, uses 'default' priority - The priority to dial after the endpoint answers. If omitted, uses 1 app - The application that is subscribed to the originated channel, and passed to the Stasis application. appArgs - The application arguments to pass to the Stasis application. 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.

Raises:

  • (ArgumentError)

110
111
112
113
114
115
116
# File 'lib/ari/resources/channel.rb', line 110

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 context - The context to dial after the endpoint answers. If omitted, uses 'default' priority - The priority to dial after the endpoint answers. If omitted, uses 1 app - The application that is subscribed to the originated channel, and passed to the Stasis application. appArgs - The application arguments to pass to the Stasis application. 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.

Raises:

  • (ArgumentError)

117
118
119
120
121
122
123
# File 'lib/ari/resources/channel.rb', line 117

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)

434
435
436
437
438
439
440
# File 'lib/ari/resources/channel.rb', line 434

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)

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

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)

468
469
470
471
472
473
474
475
# File 'lib/ari/resources/channel.rb', line 468

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)

490
491
492
493
494
495
496
497
# File 'lib/ari/resources/channel.rb', line 490

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

.ring(options = {}) ⇒ Object

POST /channels/%channelId/ring

Send a ringing indication to a channel

Parameters:

channelId (required) - Channel's id

Raises:

  • (ArgumentError)

196
197
198
199
200
# File 'lib/ari/resources/channel.rb', line 196

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


215
216
217
218
219
220
221
# File 'lib/ari/resources/channel.rb', line 215

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


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

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)

242
243
244
245
246
# File 'lib/ari/resources/channel.rb', line 242

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)

247
248
249
250
251
# File 'lib/ari/resources/channel.rb', line 247

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)

537
538
539
540
541
542
# File 'lib/ari/resources/channel.rb', line 537

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)

543
544
545
546
547
548
# File 'lib/ari/resources/channel.rb', line 543

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)

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

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)

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

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)

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

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)

598
599
600
601
602
603
604
605
# File 'lib/ari/resources/channel.rb', line 598

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)

345
346
347
348
349
# File 'lib/ari/resources/channel.rb', line 345

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)

387
388
389
390
391
# File 'lib/ari/resources/channel.rb', line 387

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)

350
351
352
353
354
# File 'lib/ari/resources/channel.rb', line 350

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)

392
393
394
395
396
# File 'lib/ari/resources/channel.rb', line 392

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


365
366
367
368
369
370
371
# File 'lib/ari/resources/channel.rb', line 365

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


407
408
409
410
411
412
413
# File 'lib/ari/resources/channel.rb', line 407

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


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

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


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

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


323
324
325
326
327
328
329
# File 'lib/ari/resources/channel.rb', line 323

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


283
284
285
286
287
288
289
# File 'lib/ari/resources/channel.rb', line 283

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


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

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

#continue_in_dialplan(options = {}) ⇒ Object


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

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

#get(options = {}) ⇒ Object


87
88
89
# File 'lib/ari/resources/channel.rb', line 87

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

#get_channel_var(options = {}) ⇒ Object


522
523
524
# File 'lib/ari/resources/channel.rb', line 522

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

#hangup(options = {}) ⇒ Object


141
142
143
# File 'lib/ari/resources/channel.rb', line 141

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

#hold(options = {}) ⇒ Object


310
311
312
# File 'lib/ari/resources/channel.rb', line 310

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

#mute(options = {}) ⇒ Object


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

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

#originate_with_id(options = {}) ⇒ Object


119
120
121
# File 'lib/ari/resources/channel.rb', line 119

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

#play(options = {}) ⇒ Object


442
443
444
# File 'lib/ari/resources/channel.rb', line 442

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

#play_with_id(options = {}) ⇒ Object


470
471
472
# File 'lib/ari/resources/channel.rb', line 470

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

#record(options = {}) ⇒ Object


499
500
501
# File 'lib/ari/resources/channel.rb', line 499

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

#ring(options = {}) ⇒ Object


202
203
204
# File 'lib/ari/resources/channel.rb', line 202

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

#ring_stop(options = {}) ⇒ Object


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

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

#send_dtmf(options = {}) ⇒ Object


249
250
251
# File 'lib/ari/resources/channel.rb', line 249

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

#set_channel_var(options = {}) ⇒ Object


545
546
547
# File 'lib/ari/resources/channel.rb', line 545

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

#snoop_channel(options = {}) ⇒ Object


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

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

#snoop_channel_with_id(options = {}) ⇒ Object


600
601
602
# File 'lib/ari/resources/channel.rb', line 600

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

#start_moh(options = {}) ⇒ Object


352
353
354
# File 'lib/ari/resources/channel.rb', line 352

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

#start_silence(options = {}) ⇒ Object


394
395
396
# File 'lib/ari/resources/channel.rb', line 394

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

#stop_moh(options = {}) ⇒ Object


374
375
376
# File 'lib/ari/resources/channel.rb', line 374

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

#stop_silence(options = {}) ⇒ Object


416
417
418
# File 'lib/ari/resources/channel.rb', line 416

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

#unhold(options = {}) ⇒ Object


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

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

#unmute(options = {}) ⇒ Object


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

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