voicemail 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85483d596c2b6e25016b05a3ea29885e8c243851
4
- data.tar.gz: b06686ed9549ffa75661d4f3065ff0c60e21e2fc
3
+ metadata.gz: 8ece901d2e7597ad7c46d21892c1c18860366229
4
+ data.tar.gz: 5179e5142890487aafe759b21d459212f90e8170
5
5
  SHA512:
6
- metadata.gz: 21e6b40a6f88258cc4dc9f4324029d5a654da70d4feb1bc7f5513b942e9e0b72852dfb8aabbaef387b9db741c25807822c8c9760a2d04bc8d2e374fcb53f9a53
7
- data.tar.gz: 8b7cc4401c5f949e89a4aec9ce381d2ec304efaf7c5278b6a3a4dfe55bced067fb6824fe2b590edf627d75a41d4d595385056c73d2ad3ee316d6a6430282de99
6
+ metadata.gz: f741bdf352fb6c34412461e81a1ce85810d01d2ad680248e41d54c3d2dc033dd817edcc0d025a50147b7115c85a9220d77ea46e5171b3e5bf1a6180e84f18d3a
7
+ data.tar.gz: bbc20bd448644acb1b896835f09f28254f5730d3d1a8579207c981bd83b4cff4ca49120987c079ec7f729e0b415350776ef1f36a6815d0ceda6be4686ebec692
@@ -8,8 +8,7 @@ module Voicemail
8
8
  end
9
9
 
10
10
  def play_message
11
- menu current_message[:uri].gsub(/\.wav/, ''), config.messages.menu,
12
- timeout: config.menu_timeout, tries: config.menu_tries do
11
+ menu message_uri, config.messages.menu, timeout: config.menu_timeout, tries: config.menu_tries do
13
12
  match 1 do
14
13
  archive_message
15
14
  end
@@ -41,8 +40,7 @@ module Voicemail
41
40
  play_time current_message[:received], format: config.datetime_format
42
41
  play config.messages.from
43
42
  from_digits = current_message[:from].scan(/\d/).join
44
- execute "SayDigits", from_digits unless from_digits.empty?
45
- # say_characters '1234'
43
+ say_characters from_digits unless from_digits.empty?
46
44
  end
47
45
 
48
46
  def rewind_message
@@ -65,5 +63,9 @@ module Voicemail
65
63
  @message = metadata[:message] || nil
66
64
  raise ArgumentError, "MailboxPlayMessageController needs a valid message passed to it" unless @message
67
65
  end
66
+
67
+ def message_uri
68
+ current_message[:uri].gsub(/\.wav/, '')
69
+ end
68
70
  end
69
71
  end
@@ -35,9 +35,9 @@ module Voicemail
35
35
 
36
36
  def record_greeting
37
37
  play config.set_greeting.before_record
38
- record_comp = record config.set_greeting.recording.to_hash.merge(interruptible: true, max_duration: 30_000)
38
+ record_comp = record config.set_greeting.recording.to_hash.merge(interruptible: true)
39
39
  @temp_recording = record_comp.complete_event.recording.uri.gsub(/file:\/\//, '').gsub(/\.wav/, '')
40
- play @temp_recording
40
+ play_audio @temp_recording
41
41
 
42
42
  menu config.set_greeting.after_record,
43
43
  timeout: config.menu_timeout, tries: config.menu_tries do
@@ -13,10 +13,14 @@ module Voicemail
13
13
  menu_tries 3, desc: "Tries to get matching input for all menus"
14
14
  datetime_format "Q 'digits/at' IMp", desc: "Fromat to use for message date and time TTS"
15
15
 
16
+ force_183 false, desc: "Only #answer if the mailbox is found"
17
+
16
18
  desc "Voicemail recording options"
17
19
  recording {
18
- max_duration 5_000, desc: "Maximum duration for recording in milliseconds"
20
+ final_timeout 2, desc: "Maximum duration to run after recording in seconds"
21
+ max_duration 30, desc: "Maximum duration for recording in seconds"
19
22
  start_beep true, desc: "Play a beep before recording"
23
+ stop_beep false, desc: "Play a beep after recording"
20
24
  }
21
25
 
22
26
  desc "Configuration for registered users"
@@ -63,7 +63,6 @@ module Voicemail
63
63
  received: Time.now,
64
64
  uri: recording_uri.gsub(/file:\/\//, '')
65
65
  }
66
- logger.fatal "store[:recordings][#{mailbox_id}] << recording"
67
66
  store[:recordings][mailbox_id] << recording
68
67
  logger.info "Saving recording: #{recording.inspect}"
69
68
  end
@@ -79,10 +78,6 @@ module Voicemail
79
78
  store[:mailboxes] ||= {}
80
79
  store[:recordings] ||= {}
81
80
  store[:archived] ||= {}
82
-
83
- store[:mailboxes][1] = {greeting_message: "Hello.", id: 1, pin: '1234'}
84
- store[:recordings][1] ||= []
85
- store[:archived][1] ||= []
86
81
  end
87
82
  end
88
83
 
@@ -1,3 +1,3 @@
1
1
  module Voicemail
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  module Voicemail
2
2
  class VoicemailController < ApplicationController
3
3
  def run
4
- answer
4
+ answer unless config.force_183
5
5
  if mailbox
6
+ answer if config.force_183
6
7
  play_greeting
7
8
  handle_recording
8
9
  else
@@ -16,7 +17,7 @@ module Voicemail
16
17
 
17
18
  def handle_recording
18
19
  @from = call.from
19
- record_comp = record config.recording.to_hash.merge(interruptible: true, max_duration: 30_000, direction: :recv)
20
+ record_comp = record config.recording.to_hash.merge(interruptible: true, direction: :recv)
20
21
  save_recording record_comp.complete_event.recording.uri
21
22
  end
22
23
 
@@ -34,7 +34,7 @@ describe Voicemail::MailboxPlayMessageController do
34
34
  should_play config.messages.message_received_on
35
35
  subject.should_receive(:play_time).once.with(message[:received], format: config.datetime_format)
36
36
  should_play config.messages.from
37
- subject.should_receive(:execute).once.with("SayDigits", "39335135335")
37
+ subject.should_receive(:say_characters).once.with "39335135335"
38
38
  controller.intro_message
39
39
  end
40
40
  end
@@ -39,8 +39,8 @@ describe Voicemail::MailboxSetGreetingController do
39
39
  it "plays the appropriate sounds, records, plays back recording, and calls the recording menu" do
40
40
  should_play config.set_greeting.before_record
41
41
  recording_component.should_receive("complete_event.recording.uri").and_return(file_path)
42
- subject.should_receive(:record).once.with(config.set_greeting.recording.to_hash.merge(interruptible: true, max_duration: 30_000)).and_return(recording_component)
43
- should_play file_path
42
+ subject.should_receive(:record).once.with(config.set_greeting.recording.to_hash.merge(interruptible: true)).and_return recording_component
43
+ subject.should_receive(:play_audio).with file_path
44
44
  subject.should_receive(:menu).once.with(config.set_greeting.after_record,
45
45
  { timeout: config.menu_timeout,
46
46
  tries: config.menu_tries }, Proc)
@@ -3,20 +3,32 @@ require 'spec_helper'
3
3
  describe Voicemail::VoicemailController do
4
4
  include VoicemailControllerSpecHelper
5
5
 
6
- before do
7
- subject.should_receive(:answer).once
8
- end
9
-
10
6
  describe "#run" do
11
7
  context "with a missing mailbox parameter in metadata" do
12
8
  let(:metadata) { Hash.new }
13
9
 
14
10
  it "should raise an error if there is no mailbox in the metadata" do
11
+ subject.should_receive(:answer).once
15
12
  expect { controller.run }.to raise_error ArgumentError
16
13
  end
17
14
  end
18
15
 
16
+ context "When force_183 is set and there's no mailbox" do
17
+ let(:mailbox) { nil }
18
+
19
+ before { config.force_183 = true }
20
+ after { config.force_183 = false }
21
+
22
+ it "should not answer" do
23
+ should_play config.mailbox_not_found
24
+ subject.should_receive(:hangup).once
25
+ controller.run
26
+ end
27
+ end
28
+
19
29
  context "with a present mailbox parameter in metadata" do
30
+ before { subject.should_receive(:answer).once }
31
+
20
32
  context "with an invalid mailbox" do
21
33
  let(:mailbox) { nil }
22
34
 
@@ -52,14 +64,13 @@ describe Voicemail::VoicemailController do
52
64
 
53
65
  it "saves the recording" do
54
66
  recording_component.should_receive("complete_event.recording.uri").and_return(file_path)
55
- subject.should_receive(:record).with(config.recording.to_hash.merge(interruptible: true, max_duration: 30_000, direction: :recv)).and_return(recording_component)
67
+ subject.should_receive(:record).with(config.recording.to_hash.merge(interruptible: true, direction: :recv)).and_return(recording_component)
56
68
  storage_instance.should_receive(:save_recording).with(mailbox[:id], call.from, file_path)
57
69
  should_play
58
70
  controller.run
59
71
  end
60
72
  end
61
73
  end
62
-
63
74
  end
64
75
  end
65
76
  end
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Voicemail::VERSION
8
8
  s.authors = ["Luca Pradovera"]
9
9
  s.email = ["lpradovera@mojolingo.com"]
10
+ s.license = 'MIT'
10
11
  s.homepage = "http://github.com/adhearsion/voicemail"
11
12
  s.summary = %q{Voicemail for Adhearsion}
12
13
  s.description = %q{A simple, extensible voicemail implementation}
@@ -17,11 +18,10 @@ Gem::Specification.new do |s|
17
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
19
  s.require_paths = ["lib"]
19
20
 
20
- s.add_runtime_dependency %q<adhearsion>, [">= 2.3.0"]
21
- s.add_runtime_dependency %q<activesupport>
21
+ s.add_runtime_dependency %q<adhearsion>, ["~> 2.4"]
22
22
 
23
23
  s.add_development_dependency %q<bundler>
24
- s.add_development_dependency %q<rspec>, [">= 2.5.0"]
24
+ s.add_development_dependency %q<rspec>, ["~> 2.14.0"]
25
25
  s.add_development_dependency %q<yard>, ["~> 0.6.0"]
26
26
  s.add_development_dependency %q<rake>, [">= 0"]
27
27
  s.add_development_dependency %q<guard-rspec>
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voicemail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Pradovera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adhearsion
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 2.3.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: 2.3.0
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
17
+ - - ~>
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: '2.4'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - '>='
24
+ - - ~>
39
25
  - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: '2.4'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +42,16 @@ dependencies:
56
42
  name: rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - '>='
45
+ - - ~>
60
46
  - !ruby/object:Gem::Version
61
- version: 2.5.0
47
+ version: 2.14.0
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - '>='
52
+ - - ~>
67
53
  - !ruby/object:Gem::Version
68
- version: 2.5.0
54
+ version: 2.14.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: yard
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -163,7 +149,8 @@ files:
163
149
  - tmp/.gitignore
164
150
  - voicemail.gemspec
165
151
  homepage: http://github.com/adhearsion/voicemail
166
- licenses: []
152
+ licenses:
153
+ - MIT
167
154
  metadata: {}
168
155
  post_install_message:
169
156
  rdoc_options: []