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.
-
#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.
-
.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
- #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 |
#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
177 178 179 180 181 |
# File 'lib/ari/resources/channel.rb', line 177 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.
157 158 159 160 161 |
# File 'lib/ari/resources/channel.rb', line 157 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.
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 |
.get(options = {}) ⇒ Object
GET /channels/%channelId
Active channel
Parameters:
channelId (required) - Channel’s id
80 81 82 83 84 85 |
# File 'lib/ari/resources/channel.rb', line 80 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
513 514 515 516 517 518 519 |
# File 'lib/ari/resources/channel.rb', line 513 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
520 521 522 523 524 525 526 |
# File 'lib/ari/resources/channel.rb', line 520 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
133 134 135 136 137 138 139 |
# File 'lib/ari/resources/channel.rb', line 133 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
304 305 306 307 308 |
# File 'lib/ari/resources/channel.rb', line 304 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
263 264 265 266 267 |
# File 'lib/ari/resources/channel.rb', line 263 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 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.
64 65 66 67 68 69 |
# File 'lib/ari/resources/channel.rb', line 64 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 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.
110 111 112 113 114 115 116 |
# File 'lib/ari/resources/channel.rb', line 110 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 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.
117 118 119 120 121 122 123 |
# File 'lib/ari/resources/channel.rb', line 117 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.
434 435 436 437 438 439 440 |
# File 'lib/ari/resources/channel.rb', line 434 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.
460 461 462 463 464 465 466 467 |
# File 'lib/ari/resources/channel.rb', line 460 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.
468 469 470 471 472 473 474 475 |
# File 'lib/ari/resources/channel.rb', line 468 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
490 491 492 493 494 495 496 497 |
# File 'lib/ari/resources/channel.rb', line 490 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 |
.ring(options = {}) ⇒ Object
POST /channels/%channelId/ring
Send a ringing indication to a channel
Parameters:
channelId (required) - Channel’s id
196 197 198 199 200 |
# File 'lib/ari/resources/channel.rb', line 196 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
215 216 217 218 219 220 221 |
# File 'lib/ari/resources/channel.rb', line 215 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
222 223 224 225 226 227 228 |
# File 'lib/ari/resources/channel.rb', line 222 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.
242 243 244 245 246 |
# File 'lib/ari/resources/channel.rb', line 242 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.
247 248 249 250 251 |
# File 'lib/ari/resources/channel.rb', line 247 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
537 538 539 540 541 542 |
# File 'lib/ari/resources/channel.rb', line 537 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
543 544 545 546 547 548 |
# File 'lib/ari/resources/channel.rb', line 543 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
563 564 565 566 567 568 569 |
# File 'lib/ari/resources/channel.rb', line 563 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
590 591 592 593 594 595 596 597 |
# File 'lib/ari/resources/channel.rb', line 590 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
570 571 572 573 574 575 576 |
# File 'lib/ari/resources/channel.rb', line 570 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
598 599 600 601 602 603 604 605 |
# File 'lib/ari/resources/channel.rb', line 598 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
345 346 347 348 349 |
# File 'lib/ari/resources/channel.rb', line 345 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
387 388 389 390 391 |
# File 'lib/ari/resources/channel.rb', line 387 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
350 351 352 353 354 |
# File 'lib/ari/resources/channel.rb', line 350 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
392 393 394 395 396 |
# File 'lib/ari/resources/channel.rb', line 392 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
365 366 367 368 369 370 371 |
# File 'lib/ari/resources/channel.rb', line 365 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
407 408 409 410 411 412 413 |
# File 'lib/ari/resources/channel.rb', line 407 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
372 373 374 375 376 377 378 |
# File 'lib/ari/resources/channel.rb', line 372 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
414 415 416 417 418 419 420 |
# File 'lib/ari/resources/channel.rb', line 414 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
323 324 325 326 327 328 329 |
# File 'lib/ari/resources/channel.rb', line 323 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
283 284 285 286 287 288 289 |
# File 'lib/ari/resources/channel.rb', line 283 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
183 184 185 |
# File 'lib/ari/resources/channel.rb', line 183 def answer( = {}) self.class.answer(.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( = {}) self.class.continue_in_dialplan(.merge(channelId: self.id, client: @client)) end |
#get(options = {}) ⇒ Object
87 88 89 |
# File 'lib/ari/resources/channel.rb', line 87 def get( = {}) self.class.get(.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( = {}) self.class.get_channel_var(.merge(channelId: self.id, client: @client)) end |
#hangup(options = {}) ⇒ Object
141 142 143 |
# File 'lib/ari/resources/channel.rb', line 141 def hangup( = {}) self.class.hangup(.merge(channelId: self.id, client: @client)) end |
#hold(options = {}) ⇒ Object
310 311 312 |
# File 'lib/ari/resources/channel.rb', line 310 def hold( = {}) self.class.hold(.merge(channelId: self.id, client: @client)) end |
#mute(options = {}) ⇒ Object
269 270 271 |
# File 'lib/ari/resources/channel.rb', line 269 def mute( = {}) self.class.mute(.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( = {}) self.class.originate_with_id(.merge(channelId: self.id, client: @client)) end |
#play(options = {}) ⇒ Object
442 443 444 |
# File 'lib/ari/resources/channel.rb', line 442 def play( = {}) self.class.play(.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( = {}) self.class.play_with_id(.merge(channelId: self.id, client: @client)) end |
#record(options = {}) ⇒ Object
499 500 501 |
# File 'lib/ari/resources/channel.rb', line 499 def record( = {}) self.class.record(.merge(channelId: self.id, client: @client)) end |
#ring(options = {}) ⇒ Object
202 203 204 |
# File 'lib/ari/resources/channel.rb', line 202 def ring( = {}) self.class.ring(.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( = {}) self.class.ring_stop(.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( = {}) self.class.send_dtmf(.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( = {}) self.class.set_channel_var(.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( = {}) self.class.snoop_channel(.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( = {}) self.class.snoop_channel_with_id(.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( = {}) self.class.start_moh(.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( = {}) self.class.start_silence(.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( = {}) self.class.stop_moh(.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( = {}) self.class.stop_silence(.merge(channelId: self.id, client: @client)) end |
#unhold(options = {}) ⇒ Object
331 332 333 |
# File 'lib/ari/resources/channel.rb', line 331 def unhold( = {}) self.class.unhold(.merge(channelId: self.id, client: @client)) end |
#unmute(options = {}) ⇒ Object
291 292 293 |
# File 'lib/ari/resources/channel.rb', line 291 def unmute( = {}) self.class.unmute(.merge(channelId: self.id, client: @client)) end |