Module: RubyAsterisk::AMI::Commands::Channel

Included in:
RubyAsterisk::AMI::Client
Defined in:
lib/ruby-asterisk/ami/commands/channel.rb

Overview

Channel commands

Instance Method Summary collapse

Instance Method Details

#atxfer(channel:, exten:, context:, priority: '1') ⇒ Object



48
49
50
51
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 48

def atxfer(channel:, exten:, context:, priority: '1')
  execute 'Atxfer',
          { 'Channel' => channel, 'Exten' => exten.to_s, 'Context' => context, 'Priority' => priority }
end

#channelsObject



33
34
35
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 33

def channels
  execute 'Command', { 'Command' => 'show channels' }
end

#core_show_channelsObject



11
12
13
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 11

def core_show_channels
  execute 'CoreShowChannels'
end

#hangup(channel) ⇒ Object



44
45
46
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 44

def hangup(channel)
  execute 'Hangup', { 'Channel' => channel }
end

#originate(channel, context, callee, priority, variable: nil, caller_id: nil, timeout: 30_000, async: nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 19

def originate(channel, context, callee, priority, variable: nil, caller_id: nil, timeout: 30_000, async: nil)
  execute 'Originate',
          { 'Channel' => channel, 'Context' => context, 'Exten' => callee, 'Priority' => priority,
            'CallerID' => caller_id || channel, 'Timeout' => timeout.to_s, 'Variable' => variable,
            'Async' => async },
          timeout: [@timeout, timeout / 1000].max
end

#originate_app(channel:, application:, data:, async:) ⇒ Object



27
28
29
30
31
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 27

def originate_app(channel:, application:, data:, async:)
  execute 'Originate',
          { 'Channel' => channel, 'Application' => application, 'Data' => data, 'Timeout' => '30000',
            'Async' => async }
end

#redirect(channel, context, callee, priority, variable: nil, caller_id: nil, timeout: 30_000) ⇒ Object



37
38
39
40
41
42
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 37

def redirect(channel, context, callee, priority, variable: nil, caller_id: nil, timeout: 30_000)
  execute 'Redirect',
          { 'Channel' => channel, 'Context' => context, 'Exten' => callee, 'Priority' => priority,
            'CallerID' => caller_id || channel, 'Timeout' => timeout.to_s, 'Variable' => variable },
          timeout: [@timeout, timeout / 1000].max
end

#status(channel: nil, action_id: nil) ⇒ Object



15
16
17
# File 'lib/ruby-asterisk/ami/commands/channel.rb', line 15

def status(channel: nil, action_id: nil)
  execute 'Status', { 'Channel' => channel, 'ActionID' => action_id }
end