adhearsion-asterisk 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -0
- data/README.md +49 -35
- data/lib/adhearsion/asterisk.rb +21 -0
- data/lib/adhearsion/asterisk/version.rb +1 -1
- metadata +5 -6
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -52,45 +52,59 @@ Examples
|
|
52
52
|
|
53
53
|
|
54
54
|
```ruby
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
echotest {
|
60
|
-
play 'demo-echotest'
|
61
|
-
execute 'Echo'
|
62
|
-
play 'demo-echodone'
|
63
|
-
}
|
64
|
-
|
65
|
-
saytime {
|
66
|
-
t = Time.now
|
67
|
-
date = t.to_date
|
68
|
-
date_format = 'ABdY'
|
69
|
-
execute "SayUnixTime", t.to_i, date_format
|
70
|
-
play_time date, :format => date_format
|
71
|
-
}
|
72
|
-
|
73
|
-
callqueue {
|
74
|
-
case extension
|
75
|
-
when 5001
|
76
|
-
queue 'sales'
|
77
|
-
when 5002
|
78
|
-
queue 'support'
|
55
|
+
class Voicemail < Adhearsion::CallController
|
56
|
+
def run
|
57
|
+
voicemail "8000"
|
79
58
|
end
|
80
|
-
|
59
|
+
end
|
60
|
+
|
61
|
+
class EchoTest < Adhearsion::CallController
|
62
|
+
def run
|
63
|
+
play 'demo-echotest'
|
64
|
+
execute 'Echo'
|
65
|
+
play 'demo-echodone'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class SayTime < Adhearsion::CallController
|
70
|
+
def run
|
71
|
+
t = Time.now
|
72
|
+
date = t.to_date
|
73
|
+
date_format = 'ABdY'
|
74
|
+
execute "SayUnixTime", t.to_i, date_format
|
75
|
+
play_time date, :format => date_format
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class CallQueue < Adhearsion::CallController
|
80
|
+
def run
|
81
|
+
case variables[:x_agi_extension]
|
82
|
+
when 5001
|
83
|
+
queue 'sales'
|
84
|
+
when 5002
|
85
|
+
queue 'support'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
81
89
|
|
82
|
-
|
83
|
-
|
84
|
-
|
90
|
+
class SalesAgent < Adhearsion::CallController
|
91
|
+
def run
|
92
|
+
queue('sales').join!
|
93
|
+
end
|
94
|
+
end
|
85
95
|
|
86
|
-
|
87
|
-
|
88
|
-
|
96
|
+
class SupportAgent < Adhearsion::CallController
|
97
|
+
def run
|
98
|
+
queue('support').join!
|
99
|
+
end
|
100
|
+
end
|
89
101
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
102
|
+
class Operator < Adhearsion::CallController
|
103
|
+
def run
|
104
|
+
enable_feature :blind_transfer
|
105
|
+
dial extension, :options => "Tt"
|
106
|
+
end
|
107
|
+
end
|
94
108
|
|
95
109
|
|
96
110
|
```
|
data/lib/adhearsion/asterisk.rb
CHANGED
@@ -10,5 +10,26 @@ module Adhearsion
|
|
10
10
|
extend ActiveSupport::Autoload
|
11
11
|
|
12
12
|
autoload :QueueProxy
|
13
|
+
|
14
|
+
#
|
15
|
+
# Execute an AMI action synchronously
|
16
|
+
#
|
17
|
+
# @param [String] name the name of the action to execute
|
18
|
+
# @param [Hash<String => Object>] options options to pass to the action
|
19
|
+
#
|
20
|
+
# @yield [Punchblock::Event::Asterisk::AMI::Event] block to handle each event resulting from the action
|
21
|
+
#
|
22
|
+
# @return [Punchblock::Event::Complete] action complete event
|
23
|
+
#
|
24
|
+
# @example Execute a CoreShowChannels action, handling each channel event:
|
25
|
+
#
|
26
|
+
# Adhearsion::Asterisk.execute_ami_action('CoreShowChannels') { |channel| puts channel.inspect }
|
27
|
+
#
|
28
|
+
def self.execute_ami_action(name, options = {}, &block)
|
29
|
+
component = Punchblock::Component::Asterisk::AMI::Action.new :name => name, :params => options
|
30
|
+
component.register_event_handler(Punchblock::Event::Asterisk::AMI::Event, &block) if block
|
31
|
+
Adhearsion::PunchblockPlugin.execute_component component
|
32
|
+
component.complete_event
|
33
|
+
end
|
13
34
|
end
|
14
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion-asterisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: adhearsion
|
@@ -280,7 +280,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
segments:
|
282
282
|
- 0
|
283
|
-
hash: -
|
283
|
+
hash: -1875001914852062926
|
284
284
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
285
285
|
none: false
|
286
286
|
requirements:
|
@@ -289,10 +289,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
289
|
version: '0'
|
290
290
|
segments:
|
291
291
|
- 0
|
292
|
-
hash: -
|
292
|
+
hash: -1875001914852062926
|
293
293
|
requirements: []
|
294
294
|
rubyforge_project: adhearsion-asterisk
|
295
|
-
rubygems_version: 1.8.
|
295
|
+
rubygems_version: 1.8.21
|
296
296
|
signing_key:
|
297
297
|
specification_version: 3
|
298
298
|
summary: Asterisk specific features for Adhearsion
|
@@ -310,4 +310,3 @@ test_files:
|
|
310
310
|
- spec/has_agi_context.rb
|
311
311
|
- spec/spec_helper.rb
|
312
312
|
- spec/support/the_following_code.rb
|
313
|
-
has_rdoc:
|