bougyman-freeswitcher 0.1.4 → 0.3.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/AUTHORS CHANGED
@@ -1,13 +1,3 @@
1
1
  Following persons have contributed to freeswitcher.
2
2
  (Sorted by number of submitted patches, then alphabetically)
3
3
 
4
- 103 TJ Vanderpoel <bougy.man@gmail.com>
5
- 64 Jayson Vaughn <jayson@onedrop.home>
6
- 28 Michael Fellinger <m.fellinger@gmail.com>
7
- 6 Jayson Vaughn <jayson@onedrop.(none)>
8
- 6 Mikael Bjerkeland <mikael@consoll.no>
9
- 4 foo <jvaughn@hellspass.nationwide-recovery.com>
10
- 4 Jayson Vaughn <vaughn.jayson@gmail.com>
11
- 3 Kevin Berry <kevin@opensourcealchemist.com>
12
- 1 jayson vaughn <jayson@falcon.(none)>
13
- 1 U-Paul-PC\Paul <Paul@Paul-PC.(none)>
data/CHANGELOG CHANGED
@@ -1,3 +1,126 @@
1
+ [bf6befa | Mon May 18 23:22:36 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
2
+
3
+ * functionality for receiving variables passed to a block complete. README updated. Convert Rakefile file options to Pathname
4
+
5
+ [7b0bf11 | Mon May 18 20:31:48 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
6
+
7
+ * Added yardoc comments
8
+
9
+ [7b7efa7 | Mon May 18 20:10:30 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
10
+
11
+ * Removed FSR::Log.info debugging line from uuid_getvar and setvar
12
+
13
+ [fda2ff4 | Mon May 18 19:55:19 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
14
+
15
+ * Added FSR::App::UuidGetVar and UuidSetVar
16
+
17
+ [39338cd | Mon May 18 18:55:17 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
18
+
19
+ * Corrected typo s/header_and_content/header_and_content_hash
20
+
21
+ [cb4d1cc | Mon May 18 18:54:08 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
22
+
23
+ * And also it seems I need to include a parameter for hash_header in
24
+
25
+ [a818d62 | Mon May 18 18:51:25 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
26
+
27
+ * Need to add a second paremeter to check_for_updated_session that
28
+
29
+
30
+
31
+ [6302892 | Mon May 18 18:49:17 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
32
+
33
+ * Changed session_header_and_content to header_and_content_hash
34
+
35
+ [5b8d9a4 | Mon May 18 18:47:57 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
36
+
37
+ * Corrected some typos in previous refactor of Outbound#receive_reply
38
+
39
+ [12a13eb | Mon May 18 18:41:40 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
40
+
41
+ * Refactored Outbound#receive_request to decouple it a tad. Still could
42
+
43
+
44
+
45
+ [6a95fa1 | Mon May 18 18:16:43 UTC 2009] Jayson Vaughn <jayson@onedrop.nationwide-recovery.com>
46
+
47
+ * Refactored FSR::App::PlayAndGetDigits to now yeild the read_var in a
48
+
49
+
50
+
51
+ [5093e71 | Mon May 18 15:08:39 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
52
+
53
+ * Read will now yield the read variable in a block
54
+
55
+ Updated README
56
+
57
+ [e71a1a5 | Mon May 18 01:55:43 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
58
+
59
+ * reverted design error, putting SENDMSG_METHOD into Read attaching to Outbound, not App
60
+
61
+ [273bdaf | Mon May 18 01:34:02 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
62
+
63
+ * removed &block from read method definition after failing spec
64
+
65
+ [ad1bbd1 | Mon May 18 00:37:44 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
66
+
67
+ * left out another to_sym
68
+
69
+ [19f8581 | Mon May 18 00:32:23 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
70
+
71
+ * left out a to_sym
72
+
73
+ [f445058 | Mon May 18 00:31:43 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
74
+
75
+ * typos galore, fixed wrong constant name in Read. created the queue_pop method to handle popping procs, adding the session.headers[@read_var] if it exist to the proc called
76
+
77
+ [93ecad2 | Mon May 18 00:19:16 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
78
+
79
+ * TEST push to test changes, read/outbound test needed
80
+
81
+ [30a39ad | Sat May 16 20:41:41 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
82
+
83
+ * Added specs for originate, defaults to Cmd
84
+
85
+ * Added specs for failing cases of Cmd::Originate
86
+ * Move DEFAULT_OPTIONS to FSR::Cmd::Command so commands inherit this
87
+ * Move default_options method to FSR::Cmd::Command as well.
88
+ * Used default_options block in Originate for options population
89
+
90
+ [865d177 | Sat May 16 17:56:45 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
91
+
92
+ * filling out originate specs, testing options and argument types
93
+
94
+ [19b81ff | Wed May 13 16:03:35 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
95
+
96
+ * refactored to a new default_options
97
+
98
+ [081112a | Wed May 13 15:32:20 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
99
+
100
+ * changed handling of :ignore_early_media in target_options of originate to behave properly. Added argument checks for some originate arguments
101
+
102
+ [55ec1c5 | Mon May 11 17:14:34 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
103
+
104
+ * New specs now pass
105
+
106
+ [ab262c9 | Mon May 11 17:13:48 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
107
+
108
+ * Added specs for FSR::App::Answer, FSBreak, and FSSleep
109
+
110
+ [1faf55f | Mon May 11 16:44:51 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
111
+
112
+ * Updated gemspec for 0.1.4
113
+
114
+ [011a3e6 | Mon May 11 16:43:14 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
115
+
116
+ * Sync changes with Master
117
+
118
+
119
+
120
+ [f036509 | Mon May 11 16:36:04 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
121
+
122
+ * Version 0.1.4
123
+
1
124
  [a110dc6 | Mon May 11 16:12:17 UTC 2009] Jayson Vaughn <jayson@onedrop.(none)>
2
125
 
3
126
  * Corrected typos in README
data/MANIFEST CHANGED
@@ -6,14 +6,6 @@ MANIFEST
6
6
  NEWS
7
7
  README
8
8
  Rakefile
9
- examples/bin/cmd_demo.rb
10
- examples/bin/dtmf_test.rb
11
- examples/bin/ies_demo.rb
12
- examples/bin/ies_demo_with_hook.rb
13
- examples/bin/oes_demo.rb
14
- examples/dtmf_test.rb
15
- examples/ies_demo.rb
16
- examples/ies_demo_with_hook.rb
17
9
  examples/inbound_event_socket.rb
18
10
  examples/inbound_socket_events.rb
19
11
  examples/outbound_event_socket.rb
@@ -61,7 +53,6 @@ lib/fsr/listener/header_and_content_response.rb
61
53
  lib/fsr/listener/inbound.rb
62
54
  lib/fsr/listener/inbound/event.rb
63
55
  lib/fsr/listener/outbound.rb
64
- lib/fsr/listener/outbound.rb.orig
65
56
  lib/fsr/model/call.rb
66
57
  lib/fsr/version.rb
67
58
  tasks/authors.rake
@@ -80,9 +71,12 @@ tasks/spec.rake
80
71
  tasks/yard.rake
81
72
  spec/helper.rb
82
73
  spec/fsr/app.rb
74
+ spec/fsr/app/answer.rb
83
75
  spec/fsr/app/bridge.rb
84
76
  spec/fsr/app/conference.rb
85
77
  spec/fsr/app/fifo.rb
78
+ spec/fsr/app/fs_break.rb
79
+ spec/fsr/app/fs_sleep.rb
86
80
  spec/fsr/app/hangup.rb
87
81
  spec/fsr/app/limit.rb
88
82
  spec/fsr/app/log.rb
data/README CHANGED
@@ -10,8 +10,8 @@ A ruby library for interacting with the "FreeSWITCH" (http://www.freeswitch.org)
10
10
 
11
11
  REQUIREMENTS
12
12
  ------------
13
- - ruby (>= 1.8)
14
- - eventmachine (If you wish to use Outbound and Inbound listener)
13
+ * ruby (>= 1.8)
14
+ * eventmachine (If you wish to use Outbound and Inbound listener)
15
15
 
16
16
  USAGE
17
17
  -----
@@ -22,97 +22,94 @@ An Outbound Event Listener Example that reads and returns DTMF input:
22
22
  Simply just create a subclass of FSR::Listner::Outbound and all
23
23
  new calls/sessions will invoke the "session_initiated" callback method.
24
24
 
25
- * NOTE: FSR uses blocks within the 'session_inititated' method to ensure
26
- that the next "freeswich command" is not executed until the previous
27
- "Freeswitch command" has finished. This is kicked off by "answer do"
28
-
29
- require 'fsr'
30
- require 'fsr/listener/outbound'
31
-
32
- class OutboundDemo < FSR::Listener::Outbound
33
-
34
- def session_initiated
35
- exten = @session.headers[:caller_caller_id_number]
36
- FSR::Log.info "*** Answering incoming call from #{exten}"
37
-
38
- answer do
39
- FSR::Log.info "***Reading DTMF from #{exten}"
40
- read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do
41
- FSR::Log.info "*** Updating session for #{exten}"
42
- update_session do
43
- FSR::Log.info "***Success, grabbed #{@session.headers[:variable_input].strip} from #{exten}"
44
- hangup #Hangup the call
45
- end
46
- end
47
- end
25
+ <b>NOTE</b>: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. This is kicked off by "answer do"
26
+
27
+ #!/usr/bin/ruby
28
+ require 'fsr'
29
+ require 'fsr/listener/outbound'
30
+
31
+ class OutboundDemo < FSR::Listener::Outbound
48
32
 
33
+ def session_initiated
34
+ exten = @session.headers[:caller_caller_id_number]
35
+ FSR::Log.info "*** Answering incoming call from #{exten}"
36
+
37
+ answer do
38
+ FSR::Log.info "***Reading DTMF from #{exten}"
39
+ read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do |read_var|
40
+ FSR::Log.info "***Success, grabbed #{read_var.strip} from #{exten}"
41
+ hangup #Hangup the call
42
+ end
49
43
  end
50
44
 
51
45
  end
52
46
 
53
- FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1"
47
+ end
54
48
 
49
+ FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1"
55
50
 
56
51
  An Inbound Event Socket Listener example using FreeSWITCHeR's hook system:
57
52
  --------------------------------------------------------------------------
58
53
 
59
- require 'pp'
60
- require 'fsr'
61
- require "fsr/listener/inbound"
54
+ #!/usr/bin/ruby
55
+ require 'pp'
56
+ require 'fsr'
57
+ require "fsr/listener/inbound"
62
58
 
63
- # EXAMPLE 1
64
- # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example
65
- FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
59
+ # EXAMPLE 1
60
+ # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example
61
+ FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
66
62
 
67
- # EXAMPLE 2
68
- # Define a method to handle CHANNEL_HANGUP events.
69
- def custom_channel_hangup_handler(event)
70
- FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:"
71
- pp event
72
- end
63
+ # EXAMPLE 2
64
+ # Define a method to handle CHANNEL_HANGUP events.
65
+ def custom_channel_hangup_handler(event)
66
+ FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:"
67
+ pp event
68
+ end
73
69
 
74
- # This adds a hook for EXAMPLE 2
75
- FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
70
+ # This adds a hook for EXAMPLE 2
71
+ FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
76
72
 
77
73
 
78
- # Start FSR Inbound Listener
79
- FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
74
+ # Start FSR Inbound Listener
75
+ FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
80
76
 
81
77
 
82
78
  An Inbound Event Socket Listener example using the on_event callback method instead of hooks:
83
79
  ---------------------------------------------------------------------------------------------
84
80
 
85
- require 'pp'
86
- require 'fsr'
87
- require "fsr/listener/inbound"
88
-
81
+ #!/usr/bin/ruby
82
+ require 'pp'
83
+ require 'fsr'
84
+ require "fsr/listener/inbound"
89
85
 
90
- class IesDemo < FSR::Listener::Inbound
91
86
 
92
- def on_event(event)
93
- pp event.headers
94
- pp event.content[:event_name]
95
- end
87
+ class IesDemo < FSR::Listener::Inbound
96
88
 
89
+ def on_event(event)
90
+ pp event.headers
91
+ pp event.content[:event_name]
97
92
  end
98
93
 
99
- FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021)
94
+ end
95
+
96
+ FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021)
100
97
 
101
98
 
102
99
  An example of using FSR::CommandSocket to originate a new call in irb:
103
100
  ----------------------------------------------------------------------
104
101
 
105
- irb(main):001:0> require 'fsr'
106
- => true
102
+ irb(main):001:0> require 'fsr'
103
+ => true
107
104
 
108
- irb(main):002:0> FSR.load_all_commands
109
- => [:sofia, :originate]
105
+ irb(main):002:0> FSR.load_all_commands
106
+ => [:sofia, :originate]
110
107
 
111
- irb(main):003:0> sock = FSR::CommandSocket.new
112
- => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon">
108
+ irb(main):003:0> sock = FSR::CommandSocket.new
109
+ => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon">
113
110
 
114
- irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run
115
- => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"}
111
+ irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run
112
+ => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"}
116
113
 
117
114
 
118
115
 
data/Rakefile CHANGED
@@ -3,13 +3,13 @@ require "rubygems"
3
3
  require "lib/fsr"
4
4
  require "pathname"
5
5
 
6
- PROJECT_COPYRIGHT = File.read(Pathname.new(__FILE__).dirname.join("License.txt"))
7
- PROJECT_README = Pathname.new(__FILE__).dirname.join("README").expand_path.to_s
6
+ PROJECT_COPYRIGHT = Pathname(__FILE__).dirname.join("License.txt").read
7
+ PROJECT_README = Pathname(__FILE__).dirname.join("README").expand_path.to_s
8
8
  PROJECT_FILES = %x{git ls-files}.split
9
9
  RELEASE_FILES = PROJECT_FILES.reject { |f| f.match(/^(?:contrib)(?:\/|$)/) }
10
10
  GEM_FILES = RELEASE_FILES.reject { |f| f.match(/^(?:spec)(?:\/|$)/) }
11
11
  PROJECT_SPECS = (RELEASE_FILES - GEM_FILES).reject { |d| d.match(/(?:helper.rb)$/) }
12
- GEM_FILES << "spec/helper.rb" if Pathname.new("spec/helper.rb").file?
12
+ GEM_FILES << "spec/helper.rb" if Pathname("spec/helper.rb").file?
13
13
 
14
14
 
15
15
  GEMSPEC = Gem::Specification.new do |spec|
@@ -25,7 +25,7 @@ GEMSPEC = Gem::Specification.new do |spec|
25
25
  spec.test_files = PROJECT_SPECS
26
26
  spec.require_path = "lib"
27
27
 
28
- description = File.read(PROJECT_README)
28
+ description = Pathname(PROJECT_README).read
29
29
  spec.description = description
30
30
  spec.rubyforge_project = "freeswitcher"
31
31
  spec.post_install_message = description
@@ -12,12 +12,9 @@ class OutboundDemo < FSR::Listener::Outbound
12
12
 
13
13
  answer do
14
14
  FSR::Log.info "***Reading DTMF from #{exten}"
15
- read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do
16
- FSR::Log.info "*** Updating session for #{exten}"
17
- update_session do
18
- FSR::Log.info "***Success, grabbed #{@session.headers[:variable_input].strip} from #{exten}"
15
+ read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do |read_var|
16
+ FSR::Log.info "***Success, grabbed #{read_var.strip} from #{exten}"
19
17
  hangup #Hangup the call
20
- end
21
18
  end
22
19
  end
23
20
 
data/freeswitcher.gemspec CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{freeswitcher}
5
- s.version = "0.1.4"
5
+ s.version = "0.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jayson Vaughn", "Michael Fellinger", "Kevin Berry", "TJ Vanderpoel"]
9
- s.date = %q{2009-05-11}
10
- s.description = %q{========================================================= FreeSWITCHeR Copyright (c) 2009 The Rubyists (Jayson Vaughn, Tj Vanderpoel, Michael Fellinger, Kevin Berry) Distributed under the terms of the MIT License. ========================================================== ABOUT ----- A ruby library for interacting with the "FreeSWITCH" (http://www.freeswitch.org) opensource telephony platform REQUIREMENTS ------------ - ruby (>= 1.8) - eventmachine (If you wish to use Outbound and Inbound listener) USAGE ----- An Outbound Event Listener Example that reads and returns DTMF input: -------------------------------------------------------------------- Simply just create a subclass of FSR::Listner::Outbound and all new calls/sessions will invoke the "session_initiated" callback method. * NOTE: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. This is kicked off by "answer do" require 'fsr' require 'fsr/listener/outbound' class OutboundDemo < FSR::Listener::Outbound def session_initiated exten = @session.headers[:caller_caller_id_number] FSR::Log.info "*** Answering incoming call from #{exten}" answer do FSR::Log.info "***Reading DTMF from #{exten}" read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do FSR::Log.info "*** Updating session for #{exten}" update_session do FSR::Log.info "***Success, grabbed #{@session.headers[:variable_input].strip} from #{exten}" hangup #Hangup the call end end end end end FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1" An Inbound Event Socket Listener example using FreeSWITCHeR's hook system: -------------------------------------------------------------------------- require 'pp' require 'fsr' require "fsr/listener/inbound" # EXAMPLE 1 # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" } # EXAMPLE 2 # Define a method to handle CHANNEL_HANGUP events. def custom_channel_hangup_handler(event) FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:" pp event end # This adds a hook for EXAMPLE 2 FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) } # Start FSR Inbound Listener FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021) An Inbound Event Socket Listener example using the on_event callback method instead of hooks: --------------------------------------------------------------------------------------------- require 'pp' require 'fsr' require "fsr/listener/inbound" class IesDemo < FSR::Listener::Inbound def on_event(event) pp event.headers pp event.content[:event_name] end end FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021) An example of using FSR::CommandSocket to originate a new call in irb: ---------------------------------------------------------------------- irb(main):001:0> require 'fsr' => true irb(main):002:0> FSR.load_all_commands => [:sofia, :originate] irb(main):003:0> sock = FSR::CommandSocket.new => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon"> irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"} SUPPORT ------- Home page at http://code.rubyists.com/projects/fs #rubyists on FreeNode}
9
+ s.date = %q{2009-05-18}
10
+ s.description = %q{========================================================= FreeSWITCHeR Copyright (c) 2009 The Rubyists (Jayson Vaughn, Tj Vanderpoel, Michael Fellinger, Kevin Berry) Distributed under the terms of the MIT License. ========================================================== ABOUT ----- A ruby library for interacting with the "FreeSWITCH" (http://www.freeswitch.org) opensource telephony platform REQUIREMENTS ------------ * ruby (>= 1.8) * eventmachine (If you wish to use Outbound and Inbound listener) USAGE ----- An Outbound Event Listener Example that reads and returns DTMF input: -------------------------------------------------------------------- Simply just create a subclass of FSR::Listner::Outbound and all new calls/sessions will invoke the "session_initiated" callback method. <b>NOTE</b>: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. This is kicked off by "answer do" #!/usr/bin/ruby require 'fsr' require 'fsr/listener/outbound' class OutboundDemo < FSR::Listener::Outbound def session_initiated exten = @session.headers[:caller_caller_id_number] FSR::Log.info "*** Answering incoming call from #{exten}" answer do FSR::Log.info "***Reading DTMF from #{exten}" read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do |read_var| FSR::Log.info "***Success, grabbed #{read_var.strip} from #{exten}" hangup #Hangup the call end end end end FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1" An Inbound Event Socket Listener example using FreeSWITCHeR's hook system: -------------------------------------------------------------------------- #!/usr/bin/ruby require 'pp' require 'fsr' require "fsr/listener/inbound" # EXAMPLE 1 # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" } # EXAMPLE 2 # Define a method to handle CHANNEL_HANGUP events. def custom_channel_hangup_handler(event) FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:" pp event end # This adds a hook for EXAMPLE 2 FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) } # Start FSR Inbound Listener FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021) An Inbound Event Socket Listener example using the on_event callback method instead of hooks: --------------------------------------------------------------------------------------------- #!/usr/bin/ruby require 'pp' require 'fsr' require "fsr/listener/inbound" class IesDemo < FSR::Listener::Inbound def on_event(event) pp event.headers pp event.content[:event_name] end end FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021) An example of using FSR::CommandSocket to originate a new call in irb: ---------------------------------------------------------------------- irb(main):001:0> require 'fsr' => true irb(main):002:0> FSR.load_all_commands => [:sofia, :originate] irb(main):003:0> sock = FSR::CommandSocket.new => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon"> irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"} SUPPORT ------- Home page at http://code.rubyists.com/projects/fs #rubyists on FreeNode}
11
11
  s.email = %q{FreeSWITCHeR@rubyists.com}
12
- s.files = [".gitignore", "AUTHORS", "CHANGELOG", "License.txt", "MANIFEST", "NEWS", "README", "Rakefile", "examples/bin/cmd_demo.rb", "examples/bin/dtmf_test.rb", "examples/bin/ies_demo.rb", "examples/bin/ies_demo_with_hook.rb", "examples/bin/oes_demo.rb", "examples/dtmf_test.rb", "examples/ies_demo.rb", "examples/ies_demo_with_hook.rb", "examples/inbound_event_socket.rb", "examples/inbound_socket_events.rb", "examples/outbound_event_socket.rb", "freeswitcher.gemspec", "lib/fsr.rb", "lib/fsr/app.rb", "lib/fsr/app/answer.rb", "lib/fsr/app/bridge.rb", "lib/fsr/app/conference.rb", "lib/fsr/app/fifo.rb", "lib/fsr/app/fs_break.rb", "lib/fsr/app/fs_sleep.rb", "lib/fsr/app/hangup.rb", "lib/fsr/app/limit.rb", "lib/fsr/app/log.rb", "lib/fsr/app/play_and_get_digits.rb", "lib/fsr/app/playback.rb", "lib/fsr/app/read.rb", "lib/fsr/app/set.rb", "lib/fsr/app/speak.rb", "lib/fsr/app/transfer.rb", "lib/fsr/app/uuid_dump.rb", "lib/fsr/app/uuid_getvar.rb", "lib/fsr/app/uuid_setvar.rb", "lib/fsr/cmd.rb", "lib/fsr/cmd/calls.rb", "lib/fsr/cmd/fsctl.rb", "lib/fsr/cmd/originate.rb", "lib/fsr/cmd/sofia.rb", "lib/fsr/cmd/sofia/profile.rb", "lib/fsr/cmd/sofia/status.rb", "lib/fsr/cmd/sofia_contact.rb", "lib/fsr/cmd/status.rb", "lib/fsr/command_socket.rb", "lib/fsr/database.rb", "lib/fsr/database/call_limit.rb", "lib/fsr/database/core.rb", "lib/fsr/database/sofia_reg_external.rb", "lib/fsr/database/sofia_reg_internal.rb", "lib/fsr/database/voicemail_default.rb", "lib/fsr/event_socket.rb", "lib/fsr/fake_socket.rb", "lib/fsr/listener.rb", "lib/fsr/listener/header_and_content_response.rb", "lib/fsr/listener/inbound.rb", "lib/fsr/listener/inbound/event.rb", "lib/fsr/listener/outbound.rb", "lib/fsr/listener/outbound.rb.orig", "lib/fsr/model/call.rb", "lib/fsr/version.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/copyright.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/spec.rake", "tasks/yard.rake", "spec/helper.rb", "spec/fsr/app.rb", "spec/fsr/app/bridge.rb", "spec/fsr/app/conference.rb", "spec/fsr/app/fifo.rb", "spec/fsr/app/hangup.rb", "spec/fsr/app/limit.rb", "spec/fsr/app/log.rb", "spec/fsr/app/play_and_get_digits.rb", "spec/fsr/app/playback.rb", "spec/fsr/app/set.rb", "spec/fsr/app/transfer.rb", "spec/fsr/cmd.rb", "spec/fsr/cmd/calls.rb", "spec/fsr/cmd/originate.rb", "spec/fsr/cmd/sofia.rb", "spec/fsr/cmd/sofia/profile.rb", "spec/fsr/listener.rb", "spec/fsr/listener/inbound.rb", "spec/fsr/listener/outbound.rb", "spec/fsr/loading.rb"]
12
+ s.files = [".gitignore", "AUTHORS", "CHANGELOG", "License.txt", "MANIFEST", "NEWS", "README", "Rakefile", "examples/inbound_event_socket.rb", "examples/inbound_socket_events.rb", "examples/outbound_event_socket.rb", "freeswitcher.gemspec", "lib/fsr.rb", "lib/fsr/app.rb", "lib/fsr/app/answer.rb", "lib/fsr/app/bridge.rb", "lib/fsr/app/conference.rb", "lib/fsr/app/fifo.rb", "lib/fsr/app/fs_break.rb", "lib/fsr/app/fs_sleep.rb", "lib/fsr/app/hangup.rb", "lib/fsr/app/limit.rb", "lib/fsr/app/log.rb", "lib/fsr/app/play_and_get_digits.rb", "lib/fsr/app/playback.rb", "lib/fsr/app/read.rb", "lib/fsr/app/set.rb", "lib/fsr/app/speak.rb", "lib/fsr/app/transfer.rb", "lib/fsr/app/uuid_dump.rb", "lib/fsr/app/uuid_getvar.rb", "lib/fsr/app/uuid_setvar.rb", "lib/fsr/cmd.rb", "lib/fsr/cmd/calls.rb", "lib/fsr/cmd/fsctl.rb", "lib/fsr/cmd/originate.rb", "lib/fsr/cmd/sofia.rb", "lib/fsr/cmd/sofia/profile.rb", "lib/fsr/cmd/sofia/status.rb", "lib/fsr/cmd/sofia_contact.rb", "lib/fsr/cmd/status.rb", "lib/fsr/command_socket.rb", "lib/fsr/database.rb", "lib/fsr/database/call_limit.rb", "lib/fsr/database/core.rb", "lib/fsr/database/sofia_reg_external.rb", "lib/fsr/database/sofia_reg_internal.rb", "lib/fsr/database/voicemail_default.rb", "lib/fsr/event_socket.rb", "lib/fsr/fake_socket.rb", "lib/fsr/listener.rb", "lib/fsr/listener/header_and_content_response.rb", "lib/fsr/listener/inbound.rb", "lib/fsr/listener/inbound/event.rb", "lib/fsr/listener/outbound.rb", "lib/fsr/model/call.rb", "lib/fsr/version.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/copyright.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/spec.rake", "tasks/yard.rake", "spec/helper.rb", "spec/fsr/app.rb", "spec/fsr/app/answer.rb", "spec/fsr/app/bridge.rb", "spec/fsr/app/conference.rb", "spec/fsr/app/fifo.rb", "spec/fsr/app/fs_break.rb", "spec/fsr/app/fs_sleep.rb", "spec/fsr/app/hangup.rb", "spec/fsr/app/limit.rb", "spec/fsr/app/log.rb", "spec/fsr/app/play_and_get_digits.rb", "spec/fsr/app/playback.rb", "spec/fsr/app/set.rb", "spec/fsr/app/transfer.rb", "spec/fsr/cmd.rb", "spec/fsr/cmd/calls.rb", "spec/fsr/cmd/originate.rb", "spec/fsr/cmd/sofia.rb", "spec/fsr/cmd/sofia/profile.rb", "spec/fsr/listener.rb", "spec/fsr/listener/inbound.rb", "spec/fsr/listener/outbound.rb", "spec/fsr/loading.rb"]
13
13
  s.homepage = %q{http://code.rubyists.com/projects/fs}
14
14
  s.post_install_message = %q{=========================================================
15
15
  FreeSWITCHeR
@@ -23,8 +23,8 @@ A ruby library for interacting with the "FreeSWITCH" (http://www.freeswitch.org)
23
23
 
24
24
  REQUIREMENTS
25
25
  ------------
26
- - ruby (>= 1.8)
27
- - eventmachine (If you wish to use Outbound and Inbound listener)
26
+ * ruby (>= 1.8)
27
+ * eventmachine (If you wish to use Outbound and Inbound listener)
28
28
 
29
29
  USAGE
30
30
  -----
@@ -35,97 +35,94 @@ An Outbound Event Listener Example that reads and returns DTMF input:
35
35
  Simply just create a subclass of FSR::Listner::Outbound and all
36
36
  new calls/sessions will invoke the "session_initiated" callback method.
37
37
 
38
- * NOTE: FSR uses blocks within the 'session_inititated' method to ensure
39
- that the next "freeswich command" is not executed until the previous
40
- "Freeswitch command" has finished. This is kicked off by "answer do"
41
-
42
- require 'fsr'
43
- require 'fsr/listener/outbound'
44
-
45
- class OutboundDemo < FSR::Listener::Outbound
46
-
47
- def session_initiated
48
- exten = @session.headers[:caller_caller_id_number]
49
- FSR::Log.info "*** Answering incoming call from #{exten}"
50
-
51
- answer do
52
- FSR::Log.info "***Reading DTMF from #{exten}"
53
- read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do
54
- FSR::Log.info "*** Updating session for #{exten}"
55
- update_session do
56
- FSR::Log.info "***Success, grabbed #{@session.headers[:variable_input].strip} from #{exten}"
57
- hangup #Hangup the call
58
- end
59
- end
60
- end
38
+ <b>NOTE</b>: FSR uses blocks within the 'session_inititated' method to ensure that the next "freeswich command" is not executed until the previous "Freeswitch command" has finished. This is kicked off by "answer do"
39
+
40
+ #!/usr/bin/ruby
41
+ require 'fsr'
42
+ require 'fsr/listener/outbound'
43
+
44
+ class OutboundDemo < FSR::Listener::Outbound
61
45
 
46
+ def session_initiated
47
+ exten = @session.headers[:caller_caller_id_number]
48
+ FSR::Log.info "*** Answering incoming call from #{exten}"
49
+
50
+ answer do
51
+ FSR::Log.info "***Reading DTMF from #{exten}"
52
+ read("/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav", 4, 10, "input", 7000) do |read_var|
53
+ FSR::Log.info "***Success, grabbed #{read_var.strip} from #{exten}"
54
+ hangup #Hangup the call
55
+ end
62
56
  end
63
57
 
64
58
  end
65
59
 
66
- FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1"
60
+ end
67
61
 
62
+ FSR.start_oes! OutboundDemo, :port => 8084, :host => "127.0.0.1"
68
63
 
69
64
  An Inbound Event Socket Listener example using FreeSWITCHeR's hook system:
70
65
  --------------------------------------------------------------------------
71
66
 
72
- require 'pp'
73
- require 'fsr'
74
- require "fsr/listener/inbound"
67
+ #!/usr/bin/ruby
68
+ require 'pp'
69
+ require 'fsr'
70
+ require "fsr/listener/inbound"
75
71
 
76
- # EXAMPLE 1
77
- # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example
78
- FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
72
+ # EXAMPLE 1
73
+ # This adds a hook on CHANNEL_CREATE events. You can also create a method to handle the event you're after. See the next example
74
+ FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| FSR::Log.info "*** [#{event.content[:unique_id]}] Channel created - greetings from the hook!" }
79
75
 
80
- # EXAMPLE 2
81
- # Define a method to handle CHANNEL_HANGUP events.
82
- def custom_channel_hangup_handler(event)
83
- FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:"
84
- pp event
85
- end
76
+ # EXAMPLE 2
77
+ # Define a method to handle CHANNEL_HANGUP events.
78
+ def custom_channel_hangup_handler(event)
79
+ FSR::Log.info "*** [#{event.content[:unique_id]}] Channel hangup. The event:"
80
+ pp event
81
+ end
86
82
 
87
- # This adds a hook for EXAMPLE 2
88
- FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
83
+ # This adds a hook for EXAMPLE 2
84
+ FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
89
85
 
90
86
 
91
- # Start FSR Inbound Listener
92
- FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
87
+ # Start FSR Inbound Listener
88
+ FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
93
89
 
94
90
 
95
91
  An Inbound Event Socket Listener example using the on_event callback method instead of hooks:
96
92
  ---------------------------------------------------------------------------------------------
97
93
 
98
- require 'pp'
99
- require 'fsr'
100
- require "fsr/listener/inbound"
101
-
94
+ #!/usr/bin/ruby
95
+ require 'pp'
96
+ require 'fsr'
97
+ require "fsr/listener/inbound"
102
98
 
103
- class IesDemo < FSR::Listener::Inbound
104
99
 
105
- def on_event(event)
106
- pp event.headers
107
- pp event.content[:event_name]
108
- end
100
+ class IesDemo < FSR::Listener::Inbound
109
101
 
102
+ def on_event(event)
103
+ pp event.headers
104
+ pp event.content[:event_name]
110
105
  end
111
106
 
112
- FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021)
107
+ end
108
+
109
+ FSR.start_ies!(IesDemo, :host => "localhost", :port => 8021)
113
110
 
114
111
 
115
112
  An example of using FSR::CommandSocket to originate a new call in irb:
116
113
  ----------------------------------------------------------------------
117
114
 
118
- irb(main):001:0> require 'fsr'
119
- => true
115
+ irb(main):001:0> require 'fsr'
116
+ => true
120
117
 
121
- irb(main):002:0> FSR.load_all_commands
122
- => [:sofia, :originate]
118
+ irb(main):002:0> FSR.load_all_commands
119
+ => [:sofia, :originate]
123
120
 
124
- irb(main):003:0> sock = FSR::CommandSocket.new
125
- => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon">
121
+ irb(main):003:0> sock = FSR::CommandSocket.new
122
+ => #<FSR::CommandSocket:0xb7a89104 @server="127.0.0.1", @socket=#<TCPSocket:0xb7a8908c>, @port="8021", @auth="ClueCon">
126
123
 
127
- irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run
128
- => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"}
124
+ irb(main):007:0> sock.originate(:target => 'sofia/gateway/carlos/8179395222', :endpoint => FSR::App::Bridge.new("user/bougyman")).run
125
+ => {"Job-UUID"=>"732075a4-7dd5-4258-b124-6284a82a5ae7", "body"=>"", "Content-Type"=>"command/reply", "Reply-Text"=>"+OK Job-UUID: 732075a4-7dd5-4258-b124-6284a82a5ae7"}
129
126
 
130
127
 
131
128
 
@@ -138,7 +135,7 @@ Home page at http://code.rubyists.com/projects/fs
138
135
  s.rubyforge_project = %q{freeswitcher}
139
136
  s.rubygems_version = %q{1.3.1}
140
137
  s.summary = %q{A library for interacting with the "FreeSWITCH":http://freeswitch.org telephony platform}
141
- s.test_files = ["spec/fsr/app.rb", "spec/fsr/app/bridge.rb", "spec/fsr/app/conference.rb", "spec/fsr/app/fifo.rb", "spec/fsr/app/hangup.rb", "spec/fsr/app/limit.rb", "spec/fsr/app/log.rb", "spec/fsr/app/play_and_get_digits.rb", "spec/fsr/app/playback.rb", "spec/fsr/app/set.rb", "spec/fsr/app/transfer.rb", "spec/fsr/cmd.rb", "spec/fsr/cmd/calls.rb", "spec/fsr/cmd/originate.rb", "spec/fsr/cmd/sofia.rb", "spec/fsr/cmd/sofia/profile.rb", "spec/fsr/listener.rb", "spec/fsr/listener/inbound.rb", "spec/fsr/listener/outbound.rb", "spec/fsr/loading.rb"]
138
+ s.test_files = ["spec/fsr/app.rb", "spec/fsr/app/answer.rb", "spec/fsr/app/bridge.rb", "spec/fsr/app/conference.rb", "spec/fsr/app/fifo.rb", "spec/fsr/app/fs_break.rb", "spec/fsr/app/fs_sleep.rb", "spec/fsr/app/hangup.rb", "spec/fsr/app/limit.rb", "spec/fsr/app/log.rb", "spec/fsr/app/play_and_get_digits.rb", "spec/fsr/app/playback.rb", "spec/fsr/app/set.rb", "spec/fsr/app/transfer.rb", "spec/fsr/cmd.rb", "spec/fsr/cmd/calls.rb", "spec/fsr/cmd/originate.rb", "spec/fsr/cmd/sofia.rb", "spec/fsr/cmd/sofia/profile.rb", "spec/fsr/listener.rb", "spec/fsr/listener/inbound.rb", "spec/fsr/listener/outbound.rb", "spec/fsr/loading.rb"]
142
139
 
143
140
  if s.respond_to? :specification_version then
144
141
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION