Ruby4Skype 0.2.1
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/lib/skypeapi/application.rb +415 -0
- data/lib/skypeapi/call.rb +220 -0
- data/lib/skypeapi/chat.rb +186 -0
- data/lib/skypeapi/chatmember.rb +33 -0
- data/lib/skypeapi/chatmessage.rb +64 -0
- data/lib/skypeapi/event.rb +46 -0
- data/lib/skypeapi/filetransfer.rb +31 -0
- data/lib/skypeapi/group.rb +81 -0
- data/lib/skypeapi/menuitem.rb +64 -0
- data/lib/skypeapi/message.rb +46 -0
- data/lib/skypeapi/object.rb +122 -0
- data/lib/skypeapi/os.rb +423 -0
- data/lib/skypeapi/profile.rb +124 -0
- data/lib/skypeapi/sharefunctions.rb +123 -0
- data/lib/skypeapi/sms.rb +84 -0
- data/lib/skypeapi/user.rb +110 -0
- data/lib/skypeapi/voicemail.rb +60 -0
- data/lib/skypeapi.rb +569 -0
- metadata +64 -0
@@ -0,0 +1,415 @@
|
|
1
|
+
module SkypeAPI
|
2
|
+
module Object
|
3
|
+
class Stream
|
4
|
+
def initialize app, streamString
|
5
|
+
@app = app
|
6
|
+
@id = streamString
|
7
|
+
@user = SkypeAPI.user(@id.split(':')[0])
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
@string
|
12
|
+
end
|
13
|
+
|
14
|
+
def user
|
15
|
+
@user
|
16
|
+
end
|
17
|
+
|
18
|
+
def write cmd, &block
|
19
|
+
@app.write self, cmd, block
|
20
|
+
end
|
21
|
+
|
22
|
+
def datagram cmd, &block
|
23
|
+
@app.datagram self, cmd, block
|
24
|
+
end
|
25
|
+
|
26
|
+
def read &block
|
27
|
+
@app.read self, block
|
28
|
+
end
|
29
|
+
|
30
|
+
def disconnect &block
|
31
|
+
@app.disconnect self, block
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Application < AbstractObject
|
36
|
+
OBJECT_NAME = "APPLICATION"
|
37
|
+
|
38
|
+
getter :Connectable , 'CONNECTABLE' do |str|
|
39
|
+
str.split(' ').collect{|i| SkypeAPI.user(i)}
|
40
|
+
end
|
41
|
+
|
42
|
+
getter :Connecting,'CONNECTING' do |str|
|
43
|
+
str.split(' ').collect{|i| SkypeAPI.user(i)}
|
44
|
+
end
|
45
|
+
|
46
|
+
getter :Streams, 'STREAMS' do |str|
|
47
|
+
str.split(' ').collect{|i| Stream.new(self, i)}
|
48
|
+
end
|
49
|
+
|
50
|
+
getter :Received, 'RECEIVED' do |str|
|
51
|
+
str.split(' ').collect do |i|
|
52
|
+
streamID, byte = i.split('=')
|
53
|
+
{:stream => Stream.new(self, streamID),:bytes => byte.to_i}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
getter :Sending, 'SENDING' do |str|
|
58
|
+
str.split(' ').collect do |i|
|
59
|
+
streamID, byte = i.split('=')
|
60
|
+
{:stream => Stream.new(self, streamID),:bytes => byte.to_i}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.create id
|
65
|
+
app = new id
|
66
|
+
app.create
|
67
|
+
app
|
68
|
+
end
|
69
|
+
|
70
|
+
def create
|
71
|
+
sendEcho "CREATE APPLICATION #{@id}"
|
72
|
+
end
|
73
|
+
|
74
|
+
def connect handle
|
75
|
+
sendEcho "ALTER APPLICATION #{@id} CONNECT #{handle}"
|
76
|
+
end
|
77
|
+
|
78
|
+
def write stream, cmd
|
79
|
+
sendAlter "WRITE", "#{stream} #{cmd}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def datagram stream, cmd
|
83
|
+
sendAlter "DATAGRAM", "#{stream} #{cmd}"
|
84
|
+
end
|
85
|
+
|
86
|
+
def read stream
|
87
|
+
res = sendCMD "ALTER APPLICATION #{@id} READ #{stream}"
|
88
|
+
res =~ /^ALTER APPLICATION #{@id} READ #{stream} (.*)$/
|
89
|
+
$1
|
90
|
+
end
|
91
|
+
|
92
|
+
def disconnect stream
|
93
|
+
sendEcho "ALTER APPLICATION #{@id} DISCONNECT #{stream}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def delete
|
97
|
+
sendEcho "DELETE APPLICATION #{@id}"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class A2A
|
102
|
+
extend Forwardable
|
103
|
+
include SkypeAPI::ShareFunctions
|
104
|
+
def initialize appName,base
|
105
|
+
@appName = appName
|
106
|
+
@eventListener = Hash.new
|
107
|
+
@base = base
|
108
|
+
@base.addNotify /^APPLICATION #{@appName} (.+)$/,method(:receiv)
|
109
|
+
end
|
110
|
+
|
111
|
+
def_delegators :@base, :sendCMD, :sendCallBack,:sendBlock,:addNotify,:delNotify
|
112
|
+
#:attach, :wait,:polling, :attached, :attached=, :received, :received=, :sent, :sent=
|
113
|
+
|
114
|
+
def getConnectable
|
115
|
+
sendSplit "GET APPLICATION #{@appName} CONNECTABLE","APPLICATION #{@appName} CONNECTABLE"
|
116
|
+
end
|
117
|
+
def getConnecting
|
118
|
+
sendSplit "GET APPLICATION #{@appName} CONNECTING","APPLICATION #{@appName} CONNECTING"
|
119
|
+
end
|
120
|
+
def getStreams
|
121
|
+
sendSplit "GET APPLICATION #{@appName} STREAMS","APPLICATION #{@appName} STREAMS"
|
122
|
+
end
|
123
|
+
def getReceived
|
124
|
+
streamByte2hash sendSplit("GET APPLICATION #{@appName} RECEIVED","APPLICATION #{@appName} RECEIVED")
|
125
|
+
end
|
126
|
+
def getSending
|
127
|
+
streamByte2hash sendSplit("GET APPLICATION #{@appName} SENDING","APPLICATION #{@appName} SENDING")
|
128
|
+
end
|
129
|
+
def create
|
130
|
+
sendEcho "CREATE APPLICATION #{@appName}"
|
131
|
+
end
|
132
|
+
def connect handle
|
133
|
+
sendEcho "ALTER APPLICATION #{@appName} CONNECT #{handle}"
|
134
|
+
end
|
135
|
+
def write stream, cmd, &block
|
136
|
+
if block_given?
|
137
|
+
sendCMD("ALTER APPLICATION #{@appName} WRITE #{stream} #{cmd}",&block)
|
138
|
+
else
|
139
|
+
sendEcho "ALTER APPLICATION #{@appName} WRITE #{stream} #{cmd}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
def datagram stream, cmd
|
143
|
+
sendEcho "ALTER APPLICATION #{@appName} DATAGRAM #{stream} #{cmd}"
|
144
|
+
end
|
145
|
+
def read stream, &block
|
146
|
+
if block_given?
|
147
|
+
sendCMD "ALTER APPLICATION #{@appName} READ #{stream}" do |res|
|
148
|
+
res =~ /^ALTER APPLICATION #{@appName} READ #{stream} (.*)$/m
|
149
|
+
block.call $1
|
150
|
+
end
|
151
|
+
else
|
152
|
+
sendCMD "ALTER APPLICATION #{@appName} READ #{stream}"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
def disconnect stream
|
156
|
+
sendEcho "ALTER APPLICATION #{@appName} DISCONNECT #{stream}"
|
157
|
+
end
|
158
|
+
def delete
|
159
|
+
sendEcho "DELETE APPLICATION #{@appName}"
|
160
|
+
delNotify /^APPLICATION #{appName} (.+)$/
|
161
|
+
end
|
162
|
+
|
163
|
+
def onEvent name,cb=Proc.new
|
164
|
+
@eventListener[name] = cb
|
165
|
+
end
|
166
|
+
|
167
|
+
def receiv res
|
168
|
+
case res
|
169
|
+
when /^CONNECTING (.+)$/m
|
170
|
+
@eventListener[:connecting].call $1.split(" ") if @eventListener[:connecting]
|
171
|
+
when /^STREAMS (.+)$/m
|
172
|
+
@eventListener[:connected].call $1.split(" ") if @eventListener[:connected]
|
173
|
+
when /^RECEIVED (.+)$/m
|
174
|
+
@eventListener[:received].call streamByte2hash($1.split(" ")) if @eventListener[:received]
|
175
|
+
when /^READ (.+?) (.+)$/m
|
176
|
+
@eventListener[:read].call $1, $2 if @eventListener[:read]
|
177
|
+
when /^DATAGRAM (.+?) (.+)$/m
|
178
|
+
@eventListener[:datagram].call $1, $2 if @eventListener[:datagram]
|
179
|
+
when /^SENDING (.+?)$/m
|
180
|
+
@eventListener[:sending].call streamByte2hash($1.split(" ")) if @eventListener[:sending]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
def streamByte2hash arr
|
186
|
+
ret = Hash.new do |hash,key|
|
187
|
+
hash[key] = 0
|
188
|
+
end
|
189
|
+
arr.each do |streamByte|
|
190
|
+
streamByte = streamByte.split "="
|
191
|
+
ret[streamByte[0]] = streamByte[1].to_i
|
192
|
+
end
|
193
|
+
return ret
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
class A2AEx < A2A
|
198
|
+
TRANS_LIMIT = 65000
|
199
|
+
SPLIT_LIMIT = 65000-2
|
200
|
+
|
201
|
+
extend Forwardable
|
202
|
+
include SkypeAPI::ShareFunctions
|
203
|
+
def initialize appName,base
|
204
|
+
super
|
205
|
+
@handle2stream = Hash.new
|
206
|
+
@sndBuffer = Hash.new do |hash,key|
|
207
|
+
hash[key] = Array.new
|
208
|
+
end
|
209
|
+
@rcvBuffer = Hash.new do |hash,key|
|
210
|
+
hash[key] = Array.new
|
211
|
+
end
|
212
|
+
@created = false
|
213
|
+
end
|
214
|
+
|
215
|
+
attr_reader :created, :sndBuffer, :rcvBuffer
|
216
|
+
|
217
|
+
def getStreams
|
218
|
+
streams = super
|
219
|
+
streamTreat streams
|
220
|
+
return @handle2stream.keys
|
221
|
+
end
|
222
|
+
|
223
|
+
def getConnection
|
224
|
+
@handle2stream.keys
|
225
|
+
end
|
226
|
+
|
227
|
+
def create
|
228
|
+
super
|
229
|
+
@created = true
|
230
|
+
end
|
231
|
+
|
232
|
+
def connect handles=getConnection
|
233
|
+
handles = [handles] unless handles.class == Array
|
234
|
+
handles.each do |handle|
|
235
|
+
super handle
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def connectAndWait handles
|
240
|
+
waitFlag = false
|
241
|
+
@base.addNotify /^APPLICATION #{@appName} CONNECTING $/,(Proc.new do
|
242
|
+
waitFlag = true
|
243
|
+
end)
|
244
|
+
handles = [handles] unless handles.class == Array
|
245
|
+
handles.each do |handle|
|
246
|
+
sendCMD "ALTER APPLICATION #{@appName} CONNECT #{handle}"
|
247
|
+
end
|
248
|
+
|
249
|
+
startTime = Time.now
|
250
|
+
i = 0
|
251
|
+
loop do
|
252
|
+
@base.polling
|
253
|
+
break if waitFlag or Time.now - startTime > 3
|
254
|
+
sleep 0.001
|
255
|
+
i+=1
|
256
|
+
end
|
257
|
+
@base.delNotify /^APPLICATION #{@appName} CONNECTING $/
|
258
|
+
end
|
259
|
+
|
260
|
+
def disconnect handles=getStreams
|
261
|
+
handles = [handles] unless handles.class == Array
|
262
|
+
handles.each do |h|
|
263
|
+
begin
|
264
|
+
super @handle2stream[h]
|
265
|
+
@handle2stream.delete h
|
266
|
+
rescue =>e
|
267
|
+
p e
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def transmit cmd, handles=getConnecting
|
273
|
+
handles = [handles] unless handles == Array
|
274
|
+
handles.each do |handle|
|
275
|
+
if cmd.size > SPLIT_LIMIT
|
276
|
+
tmp = Array.new
|
277
|
+
while cmd.size > SPLIT_LIMIT
|
278
|
+
tmp.push cmd[0,SPLIT_LIMIT] + "D"
|
279
|
+
cmd = cmd[SPLIT_LIMIT,cmd.length]
|
280
|
+
end
|
281
|
+
tmp.push cmd
|
282
|
+
cmd = tmp
|
283
|
+
else
|
284
|
+
cmd = [cmd]
|
285
|
+
end
|
286
|
+
handle = [handle] unless handle.class == Array
|
287
|
+
handle.each do |h|
|
288
|
+
@sndBuffer[h].concat cmd
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
def polling
|
294
|
+
if @created
|
295
|
+
f = false
|
296
|
+
@sndBuffer.each_value do |buffer|
|
297
|
+
if buffer.length > 0
|
298
|
+
f = true
|
299
|
+
break
|
300
|
+
end
|
301
|
+
end
|
302
|
+
if f
|
303
|
+
h2b = getSending
|
304
|
+
streams = Hash.new
|
305
|
+
@sndBuffer.each do |handle,buffer|
|
306
|
+
if @handle2stream[handle]
|
307
|
+
while buffer.length > 0
|
308
|
+
if buffer[0].size + h2b[handle] < TRANS_LIMIT
|
309
|
+
h2b[handle] += buffer[0].size
|
310
|
+
write handle,buffer.shift do |res|
|
311
|
+
#do nothing
|
312
|
+
end
|
313
|
+
else
|
314
|
+
break
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
def read handle, &block
|
324
|
+
handle = @handle2stream[handle]
|
325
|
+
unless handle
|
326
|
+
raise SkypeAPIError, "Read Error nonConnecting #{handle}"
|
327
|
+
else
|
328
|
+
super
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
def write handle, cmd, &block
|
333
|
+
stream = @handle2stream[handle]
|
334
|
+
unless stream
|
335
|
+
raise SkypeAPIError,"Write Error nonConnecting #{handle} #{cmd}"
|
336
|
+
else
|
337
|
+
super stream, cmd, &block
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
def datagram handle, cmd
|
342
|
+
handle = @handle2stream[handle]
|
343
|
+
super
|
344
|
+
end
|
345
|
+
|
346
|
+
private :write, :datagram, :read
|
347
|
+
|
348
|
+
def receiv res
|
349
|
+
case res
|
350
|
+
when /^CONNECTING (.*)$/m
|
351
|
+
@eventListener[:connecting].call $1.split(" ") if @eventListener[:connecting]
|
352
|
+
when /^STREAMS (.*)$/m
|
353
|
+
streams = $1.split " "
|
354
|
+
streamTreat streams
|
355
|
+
@eventListener[:connected].call @handle2stream.keys if @eventListener[:connected]
|
356
|
+
when /^RECEIVED (.+)$/m
|
357
|
+
res = $1
|
358
|
+
res.split(" ").each do |info|
|
359
|
+
stream = info.split("=")[0]
|
360
|
+
byte = info.split("=")[1]
|
361
|
+
handle = info.split(":")[0]
|
362
|
+
read handle do |content|
|
363
|
+
if content and not content.empty?
|
364
|
+
if content.size > SPLIT_LIMIT
|
365
|
+
@rcvBuffer[handle].push content[0,content.size-1]
|
366
|
+
else
|
367
|
+
if @rcvBuffer.length > 0
|
368
|
+
@rcvBuffer[handle].push content
|
369
|
+
tmp = @rcvBuffer[handle].join ""
|
370
|
+
@rcvBuffer[handle].clear
|
371
|
+
@eventListener[:read].call handle, tmp if @eventListener[:read]
|
372
|
+
else
|
373
|
+
@eventListener[:read].call handle, content if @eventListener[:read]
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
@eventListener[:received].call streamByte2hash(res.split(" ")) if @eventListener[:received] and res
|
380
|
+
when /^READ (.+?) (.+)$/m
|
381
|
+
#@eventListener[:read].call $1.split(":")[0], $2 if @eventListener[:read]
|
382
|
+
when /^DATAGRAM (.+?) (.+)$/m
|
383
|
+
@eventListener[:datagram].call $1.split(":")[0], $2 if @eventListener[:datagram]
|
384
|
+
when /^SENDING (.+?)$/m
|
385
|
+
@eventListener[:sending].call streamByte2hash($1.split(" ")) if @eventListener[:sending]
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
private
|
390
|
+
def streamTreat streams
|
391
|
+
@handle2stream.each do |handle,stream|
|
392
|
+
unless streams.include? stream
|
393
|
+
@sndBuffer[handle].clear
|
394
|
+
@rcvBuffer[handle].clear
|
395
|
+
end
|
396
|
+
end
|
397
|
+
@handle2stream.clear
|
398
|
+
streams.each do |st|
|
399
|
+
@handle2stream[st.split(":")[0]] = st
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def streamByte2hash arr
|
404
|
+
ret = Hash.new do |hash, key|
|
405
|
+
hash[key] = 0
|
406
|
+
end
|
407
|
+
arr.each do |streamByte|
|
408
|
+
streamByte = streamByte.split "="
|
409
|
+
ret[streamByte[0].split(":")[0]] = streamByte[1].to_i
|
410
|
+
end
|
411
|
+
return ret
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
module SkypeAPI
|
2
|
+
module Object
|
3
|
+
class Call < AbstractObject
|
4
|
+
OBJECT_NAME = "CALL"
|
5
|
+
|
6
|
+
def self.create *targets
|
7
|
+
targets = targets[0] if targets[0].class == Array
|
8
|
+
res = (@@skypeApi.sendOne "CALL " + targets.join(", "),"CALL").split(" ")
|
9
|
+
#return @@skypeApi.call(res[0]),res[2]
|
10
|
+
new res[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
getter :Timestamp, 'TIMESTAMP' do |str|
|
14
|
+
str.to_i
|
15
|
+
end
|
16
|
+
getter :Partner, 'PARTNER_HANDLE' do |str|
|
17
|
+
@@skypeApi.user str
|
18
|
+
end
|
19
|
+
getter :PartnerDispname, 'PARTNER_DISPNAME'
|
20
|
+
getter :TargetIdentity, 'TARGET_IDENTITY'
|
21
|
+
getter :ConfID, 'CONF_ID' do |str|
|
22
|
+
str.to_i
|
23
|
+
end
|
24
|
+
getter :Type, 'TYPE'
|
25
|
+
getter :Status, 'STATUS'
|
26
|
+
getter :VideoStatus, 'VIDEO_STATUS'
|
27
|
+
getter :VideoSendStatus, 'VIDEO_SEND_STATUS'
|
28
|
+
getter :VideoReceiveStatus, 'VIDEO_RECEIVE_STATUS'
|
29
|
+
getter :FailureReason, 'FAILUREREASON' do |str|
|
30
|
+
str.to_i
|
31
|
+
end
|
32
|
+
getter :Subject, 'SUBJECT'
|
33
|
+
getter :PSTNNumber, 'PSTN_NUMBER'
|
34
|
+
getter :Duration, 'DURATION' do |str|
|
35
|
+
str.to_i
|
36
|
+
end
|
37
|
+
getter :PSTNStatus, 'PSTN_STATUS'
|
38
|
+
getter :ConfParticipantsCount, 'CONF_PARTICIPANTS_COUNT' do |str|
|
39
|
+
str.to_i
|
40
|
+
end
|
41
|
+
|
42
|
+
notice :ConfParticipant, 'CONF_PARTICIPANT' do |str|
|
43
|
+
res = str.split(' ')
|
44
|
+
res[1] = @@skypeApi.user(res[1]) if res[1]
|
45
|
+
res
|
46
|
+
end
|
47
|
+
#?
|
48
|
+
def getConfParticipant n
|
49
|
+
str = sendGet "CONF_PARTICIPANT #{n}"
|
50
|
+
array = self::V2O[:ConfParticipant].call str
|
51
|
+
array.unshift n.to_s
|
52
|
+
array
|
53
|
+
end
|
54
|
+
|
55
|
+
getter :VMDuration, 'VM_DURATION' do |str|
|
56
|
+
str.to_i
|
57
|
+
end
|
58
|
+
getter :VMAllowedDuration, 'VM_ALLOWED_DURATION' do |str|
|
59
|
+
str.to_i
|
60
|
+
end
|
61
|
+
|
62
|
+
getter :Rate, 'RATE' do |str|
|
63
|
+
str.to_i
|
64
|
+
end
|
65
|
+
getter :RateCurrency, 'RATE_CURRENCY'
|
66
|
+
getter :RatePrecision, 'RATE_PRECISION' do |str|
|
67
|
+
str.to_f #?
|
68
|
+
end
|
69
|
+
|
70
|
+
getter :Input, 'INPUT'
|
71
|
+
getter :Output, 'OUTPUT'
|
72
|
+
getter :CaptureMic, 'CAPTURE_MIC'
|
73
|
+
getter :VAAInputStatus, 'VAA_INPUT_STATUS' do |str|
|
74
|
+
str._flag
|
75
|
+
end
|
76
|
+
|
77
|
+
getter :ForwardedBy, 'FORWARDED_BY'
|
78
|
+
getter :TransferActive, 'TRANSFER_ACTIVE' do |str|
|
79
|
+
str._flag
|
80
|
+
end
|
81
|
+
getter :TransferStatus, 'TRANSFER_STATUS'
|
82
|
+
getter :TransferredBy, 'TRANSFERRED_BY'
|
83
|
+
getter :TransferredTo, 'TRANSFERRED_TO'
|
84
|
+
|
85
|
+
notice :CanTransffer, 'CAN_TRANSFER' do |str|
|
86
|
+
res = str.split ' '
|
87
|
+
res[0] = @@skypeApi.user res[0]
|
88
|
+
res[1] = res[1]._flag
|
89
|
+
res
|
90
|
+
end
|
91
|
+
def getCanTransfer user
|
92
|
+
res = sendGet "CAN_TRANSFER #{user}"
|
93
|
+
V2O[:CanTransffer].call(user.to_s + ' ' + res)
|
94
|
+
end
|
95
|
+
|
96
|
+
getter :Seen, "SEEN" do |str|
|
97
|
+
str._flag
|
98
|
+
end
|
99
|
+
|
100
|
+
#Notify?
|
101
|
+
#getter :DTMF, "DTMF" do |str|
|
102
|
+
# str.to_i
|
103
|
+
#end
|
104
|
+
#getter :JoinConference, "JOIN_CONFERENCE"
|
105
|
+
#getter :StartVideoSend, "START_VIDEO_SEND"
|
106
|
+
#getter :StopVideoSend, "STOP_VIDEO_SEND"
|
107
|
+
#getter :StartVideoReceive, "START_VIDEO_RECEIVE"
|
108
|
+
#getter :StopVideoReceive, "STOP_VIDEO_RECEIVE"
|
109
|
+
|
110
|
+
def setSeen
|
111
|
+
sendSet "SEEN"
|
112
|
+
end
|
113
|
+
|
114
|
+
def setStatus s
|
115
|
+
sendSet "STATUS", s
|
116
|
+
end
|
117
|
+
|
118
|
+
def setStatusOnHold
|
119
|
+
setStatus "ONHOLD"
|
120
|
+
end
|
121
|
+
|
122
|
+
def setStatusInprogress
|
123
|
+
setStatus "INPROGRESS"
|
124
|
+
end
|
125
|
+
|
126
|
+
def setStatusFinished
|
127
|
+
setStatus "FINISHED"
|
128
|
+
end
|
129
|
+
|
130
|
+
def setDTMF num
|
131
|
+
sendSet "DTMF #{num}"
|
132
|
+
end
|
133
|
+
|
134
|
+
def setJoinConference call
|
135
|
+
sendSet "JOIN_CONFERENCE", masterID.to_s
|
136
|
+
end
|
137
|
+
|
138
|
+
def setStartVideoSend
|
139
|
+
sendSet "START_VIDEO_SEND"
|
140
|
+
end
|
141
|
+
|
142
|
+
def setStopVideoSend
|
143
|
+
sendSet "STOP_VIDEO_SEND"
|
144
|
+
end
|
145
|
+
|
146
|
+
def setStartVideoReceive
|
147
|
+
sendSet "START_VIDEO_RECEIVE"
|
148
|
+
end
|
149
|
+
|
150
|
+
def setStopVideoReceive
|
151
|
+
sendSet "STOP_VIDEO_RECEIVE"
|
152
|
+
end
|
153
|
+
|
154
|
+
def answer
|
155
|
+
sendAlter "ANSWER"
|
156
|
+
end
|
157
|
+
|
158
|
+
def hold
|
159
|
+
sendAlter "HOLD"
|
160
|
+
end
|
161
|
+
|
162
|
+
def resume
|
163
|
+
sendAlter "RESUME"
|
164
|
+
end
|
165
|
+
|
166
|
+
def hangup
|
167
|
+
sendAlter "HANGUP"
|
168
|
+
end
|
169
|
+
|
170
|
+
def end val=''
|
171
|
+
sendAlter "END", val
|
172
|
+
end
|
173
|
+
|
174
|
+
def dtmf num
|
175
|
+
sendAlter "DTMF", num
|
176
|
+
end
|
177
|
+
|
178
|
+
def transfer *users
|
179
|
+
sendAlter "TRANSFER", users.join(', ')
|
180
|
+
end
|
181
|
+
|
182
|
+
def joinConference call
|
183
|
+
sendAlter "JOIN_CONFERENCE", call.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
def startVideoSend
|
187
|
+
sendAlter "START_VIDEO_SEND"
|
188
|
+
end
|
189
|
+
|
190
|
+
def stopVideoSend
|
191
|
+
sendAlter "STOP_VIDEO_SEND"
|
192
|
+
end
|
193
|
+
|
194
|
+
def startVideoReceive
|
195
|
+
sendAlter "START_VIDEO_RECEIVE"
|
196
|
+
end
|
197
|
+
|
198
|
+
def stopVideoReceive
|
199
|
+
sendAlter"STOP_VIDEO_RECEIVE"
|
200
|
+
end
|
201
|
+
|
202
|
+
def setInput arg
|
203
|
+
sendAlter "SET_INPUT", arg
|
204
|
+
end
|
205
|
+
|
206
|
+
def setOutput arg
|
207
|
+
sendAlter "SET_INPUT", arg
|
208
|
+
end
|
209
|
+
|
210
|
+
def setCaptureMic arg
|
211
|
+
sendAlter "SET_CAPUTURE_MIC", arg
|
212
|
+
end
|
213
|
+
|
214
|
+
|
215
|
+
def alter value
|
216
|
+
sendOne "ALTER CALL #{@id} #{value}","ALTER CALL #{@id}"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|