freeswitcher 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -5
- data/examples/dtmf_test.rb +3 -3
- data/examples/oes_demo.rb +0 -1
- data/lib/fsr.rb +1 -1
- metadata +7 -7
data/README
CHANGED
@@ -62,9 +62,9 @@ Example of creating an Outbound Eventsocket listener:
|
|
62
62
|
Example of creating an Outbound Eventsocket listener that can read DTMF input and keep state:
|
63
63
|
|
64
64
|
#!/usr/bin/env ruby
|
65
|
-
|
66
|
-
require
|
67
|
-
require '
|
65
|
+
|
66
|
+
require 'fsr'
|
67
|
+
require 'fsr/listener/outbound'
|
68
68
|
|
69
69
|
FSR.load_all_applications
|
70
70
|
FSR.load_all_commands
|
@@ -74,7 +74,6 @@ Example of creating an Outbound Eventsocket listener that can read DTMF input an
|
|
74
74
|
def session_initiated(session, step = 0)
|
75
75
|
@step ||= step
|
76
76
|
exten = session.headers[:channel_caller_id_number]
|
77
|
-
pp session.headers
|
78
77
|
FSR::Log.info "*** Answering incoming call from #{exten}"
|
79
78
|
answer # Answer the call
|
80
79
|
end
|
@@ -107,7 +106,8 @@ Example of creating an Inbound Eventsocket listener:
|
|
107
106
|
#!/usr/bin/env ruby
|
108
107
|
|
109
108
|
require 'fsr'
|
110
|
-
require
|
109
|
+
require 'fsr/listener/inbound'
|
110
|
+
require 'pp'
|
111
111
|
|
112
112
|
class IesDemo < FSR::Listener::Inbound
|
113
113
|
|
data/examples/dtmf_test.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), "..", 'lib', 'fsr')
|
3
4
|
require "fsr/listener/outbound"
|
4
|
-
require 'pp'
|
5
5
|
$stdout.flush
|
6
|
+
|
6
7
|
FSR.load_all_applications
|
7
8
|
FSR.load_all_commands
|
8
9
|
class DtmfDemo < FSR::Listener::Outbound
|
@@ -10,7 +11,6 @@ class DtmfDemo < FSR::Listener::Outbound
|
|
10
11
|
def session_initiated(session, step = 0)
|
11
12
|
@step ||= step
|
12
13
|
exten = session.headers[:channel_caller_id_number]
|
13
|
-
pp session.headers
|
14
14
|
FSR::Log.info "*** Answering incoming call from #{exten}"
|
15
15
|
answer # Answer the call
|
16
16
|
end
|
data/examples/oes_demo.rb
CHANGED
data/lib/fsr.rb
CHANGED
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.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayson Vaughn
|
@@ -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 Outbound Eventsocket listener that can read DTMF input and keep state: #!/usr/bin/env ruby require
|
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' require 'fsr/listener/outbound' 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] 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' require 'pp' 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
|
|
@@ -165,9 +165,9 @@ post_install_message: |
|
|
165
165
|
Example of creating an Outbound Eventsocket listener that can read DTMF input and keep state:
|
166
166
|
|
167
167
|
#!/usr/bin/env ruby
|
168
|
-
|
169
|
-
require
|
170
|
-
require '
|
168
|
+
|
169
|
+
require 'fsr'
|
170
|
+
require 'fsr/listener/outbound'
|
171
171
|
|
172
172
|
FSR.load_all_applications
|
173
173
|
FSR.load_all_commands
|
@@ -177,7 +177,6 @@ post_install_message: |
|
|
177
177
|
def session_initiated(session, step = 0)
|
178
178
|
@step ||= step
|
179
179
|
exten = session.headers[:channel_caller_id_number]
|
180
|
-
pp session.headers
|
181
180
|
FSR::Log.info "*** Answering incoming call from #{exten}"
|
182
181
|
answer # Answer the call
|
183
182
|
end
|
@@ -210,7 +209,8 @@ post_install_message: |
|
|
210
209
|
#!/usr/bin/env ruby
|
211
210
|
|
212
211
|
require 'fsr'
|
213
|
-
require
|
212
|
+
require 'fsr/listener/inbound'
|
213
|
+
require 'pp'
|
214
214
|
|
215
215
|
class IesDemo < FSR::Listener::Inbound
|
216
216
|
|