freeswitcher 0.0.10 → 0.0.11

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/README CHANGED
@@ -59,6 +59,49 @@ Example of creating an Outbound Eventsocket listener:
59
59
 
60
60
 
61
61
 
62
+ Example of creating an Outbound Eventsocket listener that can read DTMF input and keep state:
63
+
64
+ #!/usr/bin/env ruby
65
+
66
+ require "fsr/listener/outbound"
67
+ require 'pp'
68
+
69
+ FSR.load_all_applications
70
+ FSR.load_all_commands
71
+
72
+ class DtmfDemo < FSR::Listener::Outbound
73
+
74
+ def session_initiated(session, step = 0)
75
+ @step ||= step
76
+ exten = session.headers[:channel_caller_id_number]
77
+ pp session.headers
78
+ FSR::Log.info "*** Answering incoming call from #{exten}"
79
+ answer # Answer the call
80
+ end
81
+
82
+ def receive_reply(reply)
83
+ exten = @session.headers[:channel_caller_id_number]
84
+ @step += 1
85
+ case @step
86
+ when 1
87
+ FSR::Log.info "*** Reading dtmf for #{exten}"
88
+ read "/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav",4,10,"test",15000 # read test
89
+ when 2
90
+ FSR::Log.info "*** updating session for #{exten}"
91
+ update_session
92
+ when 3
93
+ FSR::Log.info "** Success, grabbed #{reply.content[:variable_test].strip} from #{exten}"
94
+ FSR::Log.info "*** Hanging up call"
95
+ hangup # Hangup the call
96
+ end
97
+ end
98
+
99
+ end
100
+
101
+ FSR.start_oes! DtmfDemo, :port => 8084, :host => "127.0.0.1"
102
+
103
+
104
+
62
105
  Example of creating an Inbound Eventsocket listener:
63
106
 
64
107
  #!/usr/bin/env ruby
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ require 'eventmachine'
3
+ require "fsr/listener/outbound"
4
+ require 'pp'
5
+ $stdout.flush
6
+ FSR.load_all_applications
7
+ FSR.load_all_commands
8
+ class DtmfDemo < FSR::Listener::Outbound
9
+
10
+ def session_initiated(session, step = 0)
11
+ @step ||= step
12
+ exten = session.headers[:channel_caller_id_number]
13
+ pp session.headers
14
+ FSR::Log.info "*** Answering incoming call from #{exten}"
15
+ answer # Answer the call
16
+ end
17
+
18
+ def receive_reply(reply)
19
+ exten = @session.headers[:channel_caller_id_number]
20
+ @step += 1
21
+ case @step
22
+ when 1
23
+ FSR::Log.info "*** Reading dtmf for #{exten}"
24
+ read "/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav",4,10,"test",15000 # read test
25
+ when 2
26
+ FSR::Log.info "*** updating session for #{exten}"
27
+ update_session
28
+ when 3
29
+ FSR::Log.info "** Success, grabbed #{reply.content[:variable_test].strip} from #{exten}"
30
+ FSR::Log.info "*** Hanging up call"
31
+ hangup # Hangup the call
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ FSR.start_oes! DtmfDemo, :port => 8084, :host => "127.0.0.1"
File without changes
@@ -20,8 +20,6 @@ end
20
20
  FSL::Inbound.add_event_hook(:CHANNEL_HANGUP) {|event| custom_channel_hangup_handler(event) }
21
21
 
22
22
 
23
-
24
-
25
23
  # Start FSR Inbound Listener
26
24
  FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)
27
25
 
File without changes
data/lib/fsr.rb CHANGED
@@ -6,7 +6,7 @@ require 'pp'
6
6
  module FSR
7
7
  # Global configuration options
8
8
  #
9
- VERSION = '0.0.10'
9
+ VERSION = '0.0.11'
10
10
  FS_INSTALL_PATHS = ["/usr/local/freeswitch", "/opt/freeswitch", "/usr/freeswitch"]
11
11
  DEFAULT_CALLER_ID_NUMBER = '8675309'
12
12
  DEFAULT_CALLER_ID_NAME = "FSR"
@@ -3,12 +3,12 @@ module FSR
3
3
  module App
4
4
  # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_hangup
5
5
  class Hangup < Application
6
- def initialize(data = nil)
7
- @data = data
6
+ def initialize(cause = nil)
7
+ @cause = cause
8
8
  end
9
9
 
10
10
  def arguments
11
- @data
11
+ @cause
12
12
  end
13
13
 
14
14
  def sendmsg
@@ -1,4 +1,3 @@
1
-
2
1
  require "fsr/app"
3
2
  module FSR
4
3
  module App
@@ -10,11 +9,11 @@ module FSR
10
9
  @wavfile = wavfile
11
10
  end
12
11
  def arguments
13
- [@wavfile]
12
+ @wavfile
14
13
  end
15
14
 
16
15
  def sendmsg
17
- "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
16
+ "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments]
18
17
  end
19
18
  end
20
19
 
@@ -0,0 +1,22 @@
1
+ require "fsr/app"
2
+ module FSR
3
+ # http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_read
4
+ module App
5
+ class Read < Application
6
+ def initialize(sound_file, min = 0, max = 10, chan_var = "fsr_read_dtmf", timeout = 10000, terminators = ["#"])
7
+ @sound_file, @min, @max, @chan_var, @timeout, @terminators = sound_file, min, max, chan_var, timeout, terminators
8
+ end
9
+
10
+ def arguments
11
+ [@min, @max, @sound_file, @chan_var, @timeout, @terminators.join(",")]
12
+ end
13
+
14
+ def sendmsg
15
+ "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
16
+ end
17
+
18
+ end
19
+
20
+ register(:read, Read)
21
+ end
22
+ end
@@ -6,8 +6,8 @@ module FSR
6
6
 
7
7
  def initialize(destination_number, dialplan = nil, context = nil)
8
8
  @destination_number = destination_number
9
- @dialplan = dialplan || "XML"
10
- @context = context || "default"
9
+ @dialplan = dialplan
10
+ @context = context
11
11
  end
12
12
 
13
13
  def arguments
@@ -0,0 +1,22 @@
1
+ require "fsr/app"
2
+ module FSR
3
+ #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_dump
4
+ module App
5
+ class UuidDump < Application
6
+ def initialize(uuid)
7
+ @uuid = uuid # Unique channel ID
8
+ end
9
+
10
+ def arguments
11
+ [@uuid]
12
+ end
13
+
14
+ def sendmsg
15
+ "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
16
+ end
17
+
18
+ end
19
+
20
+ register(:uuid_dump, UuidDump)
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require "fsr/app"
2
+ module FSR
3
+ #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_getvar
4
+ module App
5
+ class UuidGetVar < Application
6
+ def initialize(uuid, var)
7
+ @uuid = uuid # Unique channel ID
8
+ @var = var # Channel variable you wish to 'get'
9
+ end
10
+
11
+ def arguments
12
+ [@uuid, @var]
13
+ end
14
+
15
+ def sendmsg
16
+ "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
17
+ end
18
+
19
+ end
20
+
21
+ register(:uuid_getvar, UuidGetVar)
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ require "fsr/app"
2
+ module FSR
3
+ #http://wiki.freeswitch.org/wiki/Mod_commands#uuid_setvar
4
+ module App
5
+ class UuidSetVar < Application
6
+ def initialize(uuid, var, assignment)
7
+ @uuid = uuid # Unique channel ID
8
+ @var = var # Channel variable you wish to 'set'
9
+ @assignment
10
+ end
11
+
12
+ def arguments
13
+ [@uuid, @var, @assignment]
14
+ end
15
+
16
+ def sendmsg
17
+ "call-command: execute\nexecute-app-name: %s\nexecute-app-arg: %s\nevent-lock:true\n\n" % [app_name, arguments.join(" ")]
18
+ end
19
+
20
+ end
21
+
22
+ register(:uuid_setvar, UuidSetVar)
23
+ end
24
+ end
@@ -26,10 +26,17 @@ module FSR
26
26
  hash_content = headers_2_hash(content)
27
27
  session = HeaderAndContentResponse.new({:headers => hash_header, :content => hash_content})
28
28
  if @session.nil?
29
- @session = self
29
+ @session = session
30
30
  session_initiated(session)
31
31
  else
32
- receive_reply(session)
32
+ if session.headers[:event_name].nil?
33
+ receive_reply(session)
34
+ else
35
+ if session.headers[:event_name].to_s.match(/CHANNEL_DATA/i)
36
+ @session = session
37
+ receive_reply(HeaderAndConentResponse.new({:headers => {:session => "update"}, :content => {}}))
38
+ end
39
+ end
33
40
  end
34
41
  end
35
42
 
@@ -56,6 +63,12 @@ module FSR
56
63
  self.respond_to?(:send_data) ? send_data(message) : message
57
64
  end
58
65
 
66
+ # Update_session
67
+
68
+ def update_session
69
+ send_data("api uuid_dump #{@session.headers[:unique_id]}\n\n")
70
+ end
71
+
59
72
  end
60
73
 
61
74
  end
@@ -0,0 +1,16 @@
1
+ require 'spec/helper'
2
+ require "fsr/app"
3
+ FSR::App.load_application("hangup")
4
+
5
+ describe "Testing FSR::App::Hangup" do
6
+ it "Hangs up the channel" do
7
+ hangup = FSR::App::Hangup.new
8
+ hangup.sendmsg.should == "call-command: execute\nexecute-app-name: hangup\nexecute-app-arg: \n\n"
9
+ end
10
+
11
+ it "Hangs up the channel using a hangup cause" do
12
+ hangup = FSR::App::Hangup.new("USER_BUSY")
13
+ hangup.sendmsg.should == "call-command: execute\nexecute-app-name: hangup\nexecute-app-arg: USER_BUSY\n\n"
14
+ end
15
+
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec/helper'
2
+ require "fsr/app"
3
+ FSR::App.load_application("log")
4
+
5
+ describe "Testing FSR::App::Log" do
6
+ it "Logs to the console" do
7
+ log = FSR::App::Log.new(1, "This is a test! :-)")
8
+ log.sendmsg.should == "call-command: execute\nexecute-app-name: log\nexecute-app-arg: 1 This is a test! :-)\nevent-lock:true\n\n"
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec/helper'
2
+ require "fsr/app"
3
+ FSR::App.load_application("playback")
4
+
5
+ describe "Testing FSR::App::Playback" do
6
+ it "Plays a file or stream" do
7
+ playback = FSR::App::Playback.new("shout://scfire-ntc-aa01.stream.aol.com/stream/1035")
8
+ playback.sendmsg.should == "call-command: execute\nexecute-app-name: playback\nexecute-app-arg: shout://scfire-ntc-aa01.stream.aol.com/stream/1035\nevent-lock:true\n\n"
9
+ end
10
+
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec/helper'
2
+ require "fsr/app"
3
+ FSR::App.load_application("set")
4
+
5
+ describe "Testing FSR::App::Set" do
6
+ # Utilize the [] shortcut to start a conference
7
+ it "Sets a single variable" do
8
+ set = FSR::App::Set.new("hangup_after_bridge", true)
9
+ set.sendmsg.should == "call-command: execute\nexecute-app-name: set\nexecute-app-arg: hangup_after_bridge=true\nevent-lock:true\n\n"
10
+ end
11
+
12
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec/helper'
2
+ require "fsr/app"
3
+ FSR::App.load_application("transfer")
4
+
5
+ describe "Testing FSR::App::Transfer" do
6
+ it "Transfers the call" do
7
+ transfer = FSR::App::Transfer.new("500", "XML", "default")
8
+ transfer.sendmsg.should == "call-command: execute\nexecute-app-name: transfer\nexecute-app-arg: 500 XML default\nevent-lock:true\n\n"
9
+ end
10
+
11
+ end
@@ -16,4 +16,11 @@ describe "Testing FSR::Listener::Inbound" do
16
16
  FSR::Listener::Inbound.method_defined?(:post_init).should == true
17
17
  end
18
18
 
19
+ it "adds and deletes hooks" do
20
+ FSL::Inbound.add_event_hook(:CHANNEL_CREATE) {|event| puts event.inspect }
21
+ FSL::Inbound::HOOKS.size.should == 1
22
+ FSL::Inbound.del_event_hook(:CHANNEL_CREATE)
23
+ FSL::Inbound::HOOKS.size.should == 0
24
+ end
25
+
19
26
  end
@@ -4,7 +4,7 @@ require 'spec/helper'
4
4
  describe "Testing FSR module loading methods" do
5
5
  # When you add applications you must modify the expected apps_loaded behavior
6
6
  it "Loads all applications" do
7
- all_apps = [:set, :transfer, :speak, :fs_sleep, :playback, :answer, :fifo, :bridge, :hangup, :conference, :fs_break, :log]
7
+ all_apps = [:uuid_dump, :uuid_setvar, :uuid_getvar, :read, :set, :transfer, :speak, :fs_sleep, :playback, :answer, :fifo, :bridge, :hangup, :conference, :fs_break, :log]
8
8
  # Add any apps which will load to this set
9
9
  apps_loaded = FSR.load_all_applications
10
10
  apps_loaded.kind_of?(Array).should == true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freeswitcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Vaughn
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-04-11 00:00:00 -05:00
15
+ date: 2009-04-16 00:00:00 -05:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: "0"
27
27
  version:
28
- description: "========================================================= FreeSWITCHeR Copyright (c) 2009 The Rubyists (Jayson Vaughn, Tj Vanderpoel, Michael Fellinger, Kevin Berry) Distributed under the terms of the MIT License. ========================================================== About ----- *** STILL UNDER HEAVY DEVELOPMENT *** A ruby library for interacting with the \"FreeSWITCH\" (http://www.freeswitch.org) opensource telephony platform *** STILL UNDER HEAVY DEVELOPMENT *** Requirements ------------ - ruby (>= 1.8) - eventmachine (If you wish to use Outbound and Inbound listener) Usage ----- Example of originating a new call in 'irb' using FSR::CommandSocket#originate: 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\"} Example of creating an Outbound Eventsocket listener: #!/usr/bin/env ruby require 'fsr' require \"fsr/listener/outbound\" class OesDemo < FSR::Listener::Outbound def session_initiated(session) number = session.headers[:caller_caller_id_number] # Grab the inbound caller id FSR::Log.info \"*** Answering incoming call from #{number}\" answer # Answer the call set(\"hangup_after_bridge\", \"true\")# Set a variable speak 'Hello, This is your phone switch. Have a great day' # use mod_flite to speak hangup # Hangup the call end end FSR.start_oes!(OesDemo, :port => 1888, :host => \"localhost\") Example of creating an Inbound Eventsocket listener: #!/usr/bin/env ruby 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) Support ------- Home page at http://code.rubyists.com/projects/fs #rubyists on FreeNode"
28
+ description: "========================================================= FreeSWITCHeR Copyright (c) 2009 The Rubyists (Jayson Vaughn, Tj Vanderpoel, Michael Fellinger, Kevin Berry) Distributed under the terms of the MIT License. ========================================================== About ----- *** STILL UNDER HEAVY DEVELOPMENT *** A ruby library for interacting with the \"FreeSWITCH\" (http://www.freeswitch.org) opensource telephony platform *** STILL UNDER HEAVY DEVELOPMENT *** Requirements ------------ - ruby (>= 1.8) - eventmachine (If you wish to use Outbound and Inbound listener) Usage ----- Example of originating a new call in 'irb' using FSR::CommandSocket#originate: 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\"} Example of creating an Outbound Eventsocket listener: #!/usr/bin/env ruby require 'fsr' require \"fsr/listener/outbound\" class OesDemo < FSR::Listener::Outbound def session_initiated(session) number = session.headers[:caller_caller_id_number] # Grab the inbound caller id FSR::Log.info \"*** Answering incoming call from #{number}\" answer # Answer the call set(\"hangup_after_bridge\", \"true\")# Set a variable speak 'Hello, This is your phone switch. Have a great day' # use mod_flite to speak hangup # Hangup the call end end FSR.start_oes!(OesDemo, :port => 1888, :host => \"localhost\") Example of creating an Outbound Eventsocket listener that can read DTMF input and keep state: #!/usr/bin/env ruby require \"fsr/listener/outbound\" require 'pp' FSR.load_all_applications FSR.load_all_commands class DtmfDemo < FSR::Listener::Outbound def session_initiated(session, step = 0) @step ||= step exten = session.headers[:channel_caller_id_number] pp session.headers FSR::Log.info \"*** Answering incoming call from #{exten}\" answer # Answer the call end def receive_reply(reply) exten = @session.headers[:channel_caller_id_number] @step += 1 case @step when 1 FSR::Log.info \"*** Reading dtmf for #{exten}\" read \"/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav\",4,10,\"test\",15000 # read test when 2 FSR::Log.info \"*** updating session for #{exten}\" update_session when 3 FSR::Log.info \"** Success, grabbed #{reply.content[:variable_test].strip} from #{exten}\" FSR::Log.info \"*** Hanging up call\" hangup # Hangup the call end end end FSR.start_oes! DtmfDemo, :port => 8084, :host => \"127.0.0.1\" Example of creating an Inbound Eventsocket listener: #!/usr/bin/env ruby 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) Support ------- Home page at http://code.rubyists.com/projects/fs #rubyists on FreeNode"
29
29
  email: FreeSWITCHeR@rubyists.com
30
30
  executables: []
31
31
 
@@ -38,12 +38,11 @@ files:
38
38
  - NEWS
39
39
  - README
40
40
  - Rakefile
41
- - bin
42
- - bin/cmd_demo.rb
43
- - bin/ies_demo.rb
44
- - bin/ies_demo_with_hook.rb
45
- - bin/oes_demo.rb
46
- - bin/oes_demo2.rb
41
+ - examples
42
+ - examples/dtmf_test.rb
43
+ - examples/ies_demo.rb
44
+ - examples/ies_demo_with_hook.rb
45
+ - examples/oes_demo.rb
47
46
  - lib
48
47
  - lib/fsr
49
48
  - lib/fsr/app
@@ -56,9 +55,13 @@ files:
56
55
  - lib/fsr/app/hangup.rb
57
56
  - lib/fsr/app/log.rb
58
57
  - lib/fsr/app/playback.rb
58
+ - lib/fsr/app/read.rb
59
59
  - lib/fsr/app/set.rb
60
60
  - lib/fsr/app/speak.rb
61
61
  - lib/fsr/app/transfer.rb
62
+ - lib/fsr/app/uuid_dump.rb
63
+ - lib/fsr/app/uuid_getvar.rb
64
+ - lib/fsr/app/uuid_setvar.rb
62
65
  - lib/fsr/app.rb
63
66
  - lib/fsr/cmd
64
67
  - lib/fsr/cmd/fsctl.rb
@@ -159,6 +162,49 @@ post_install_message: |
159
162
 
160
163
 
161
164
 
165
+ Example of creating an Outbound Eventsocket listener that can read DTMF input and keep state:
166
+
167
+ #!/usr/bin/env ruby
168
+
169
+ require "fsr/listener/outbound"
170
+ require 'pp'
171
+
172
+ FSR.load_all_applications
173
+ FSR.load_all_commands
174
+
175
+ class DtmfDemo < FSR::Listener::Outbound
176
+
177
+ def session_initiated(session, step = 0)
178
+ @step ||= step
179
+ exten = session.headers[:channel_caller_id_number]
180
+ pp session.headers
181
+ FSR::Log.info "*** Answering incoming call from #{exten}"
182
+ answer # Answer the call
183
+ end
184
+
185
+ def receive_reply(reply)
186
+ exten = @session.headers[:channel_caller_id_number]
187
+ @step += 1
188
+ case @step
189
+ when 1
190
+ FSR::Log.info "*** Reading dtmf for #{exten}"
191
+ read "/home/freeswitch/freeswitch/sounds/music/8000/sweet.wav",4,10,"test",15000 # read test
192
+ when 2
193
+ FSR::Log.info "*** updating session for #{exten}"
194
+ update_session
195
+ when 3
196
+ FSR::Log.info "** Success, grabbed #{reply.content[:variable_test].strip} from #{exten}"
197
+ FSR::Log.info "*** Hanging up call"
198
+ hangup # Hangup the call
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ FSR.start_oes! DtmfDemo, :port => 8084, :host => "127.0.0.1"
205
+
206
+
207
+
162
208
  Example of creating an Inbound Eventsocket listener:
163
209
 
164
210
  #!/usr/bin/env ruby
@@ -214,6 +260,11 @@ test_files:
214
260
  - spec/fsr/app/bridge.rb
215
261
  - spec/fsr/app/conference.rb
216
262
  - spec/fsr/app/fifo.rb
263
+ - spec/fsr/app/hangup.rb
264
+ - spec/fsr/app/log.rb
265
+ - spec/fsr/app/playback.rb
266
+ - spec/fsr/app/set.rb
267
+ - spec/fsr/app/transfer.rb
217
268
  - spec/fsr/app.rb
218
269
  - spec/fsr/cmd
219
270
  - spec/fsr/cmd/originate.rb
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'pp'
4
- require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr')
5
- require "fsr/cmd"
6
-
7
- FSR.load_all_commands
8
- sock = FSR::CommandSocket.new
9
-
10
- # Check the status of our server
11
- pp sock.status.run
12
-
13
- # Check max sessions
14
- pp sock.fsctl.max_sessions
15
- # Set max sessions
16
- pp sock.fsctl.max_sessions = 3000
17
-
18
- # Check up a sofia user
19
- pp sock.sofia_contact(:contact => "internal/user@domain.com").run
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'eventmachine'
5
- require 'pp'
6
- require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr')
7
- puts $LOAD_PATH.inspect
8
- $stdout.flush
9
- require "fsr/listener/outbound"
10
-
11
- class OesDemo < EventMachine::Protocols::HeaderAndContentProtocol
12
-
13
- def post_init
14
- send_data("connect\r\n\r\n")
15
- end
16
-
17
- def receive_request(header, content)
18
- pp "BEGINNING"
19
- pp header
20
- pp content
21
- pp "END"
22
- end
23
-
24
- end
25
-
26
- FSR.start_oes!(OesDemo, :port => 1888, :host => "192.168.6.32")