summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-11 10:10:30 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-11 10:10:30 +0100
commita78b515325d0d6032b28025c543318f5e4c8839f (patch)
treebf158711a7af6154afe353dc609f6dd3a887672c /lib
parentd53e0c5aefc7540efb98e873d402f6939ec28134 (diff)
parent184870d68e545beef05495d8f2f56ddbd5efc886 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'lib')
-rw-r--r--lib/freeswitch_event.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/freeswitch_event.rb b/lib/freeswitch_event.rb
index b6e5cbc..68d9df2 100644
--- a/lib/freeswitch_event.rb
+++ b/lib/freeswitch_event.rb
@@ -44,8 +44,8 @@ class FreeswitchEventSocket
@socket.close
end
- def read()
- return @socket.recv(1024)
+ def read(read_bytes=1024)
+ return @socket.recv(read_bytes)
end
def result()
@@ -130,4 +130,20 @@ class FreeswitchAPI
return false
end
+
+ def self.channel_variable_get(channel_uuid, variable_name)
+ result = nil
+ event = FreeswitchEventSocket.new()
+ if event && event.connect()
+ event.command( "api uuid_getvar #{channel_uuid} #{variable_name}")
+ event_result = event.result()
+ if event_result && event_result["Content-Type"] == 'api/response' && event_result["Content-Length"].to_i > 0
+ result = event.read(event_result["Content-Length"].to_i)
+ end
+ event.close()
+ end
+
+ return result
+ end
+
end