ruby-agi 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Release-Notes +2 -0
- data/extconf.rb +2 -0
- data/lib/ruby-agi/agi.rb +847 -0
- data/lib/{asterisk_variable.rb → ruby-agi/asterisk_variable.rb} +49 -34
- data/lib/ruby-agi/command.rb +897 -0
- data/lib/ruby-agi.rb +5 -0
- metadata +12 -32
- data/examples/call_log.rb +0 -0
- data/lib/agi.rb +0 -310
- data/lib/command.rb +0 -486
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -0
- /data/lib/{error.rb → ruby-agi/error.rb} +0 -0
- /data/lib/{return_status.rb → ruby-agi/return_status.rb} +0 -0
data/lib/ruby-agi.rb
ADDED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-agi
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date:
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2006-01-08 00:00:00 -05:00
|
8
8
|
summary: Ruby Language API for Asterisk
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -18,35 +18,13 @@ bindir: bin
|
|
18
18
|
has_rdoc: true
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 1.8.3
|
24
24
|
version:
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
-
- |
|
29
|
-
-----BEGIN CERTIFICATE-----
|
30
|
-
MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDARpbmZv
|
31
|
-
MRgwFgYKCZImiZPyLGQBGRYIYmVlcGxvdmUxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
32
|
-
HhcNMDUxMjIwMjAyOTEy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ihnxz5Jtr
|
47
|
-
wX/kBA==
|
48
|
-
-----END CERTIFICATE-----
|
49
|
-
|
50
28
|
authors:
|
51
29
|
- Mohammad Khan
|
52
30
|
files:
|
@@ -54,12 +32,14 @@ files:
|
|
54
32
|
- LICENSE
|
55
33
|
- INSTALL
|
56
34
|
- DOWNLOAD
|
57
|
-
-
|
58
|
-
- lib/
|
59
|
-
- lib/
|
60
|
-
- lib/
|
61
|
-
- lib/
|
62
|
-
-
|
35
|
+
- extconf.rb
|
36
|
+
- lib/ruby-agi/agi.rb
|
37
|
+
- lib/ruby-agi/command.rb
|
38
|
+
- lib/ruby-agi/asterisk_variable.rb
|
39
|
+
- lib/ruby-agi/error.rb
|
40
|
+
- lib/ruby-agi/return_status.rb
|
41
|
+
- lib/ruby-agi.rb
|
42
|
+
- Release-Notes
|
63
43
|
test_files: []
|
64
44
|
|
65
45
|
rdoc_options: []
|
data/examples/call_log.rb
DELETED
File without changes
|
data/lib/agi.rb
DELETED
@@ -1,310 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# File: agi.rb
|
3
|
-
#
|
4
|
-
# ruby-agi: Ruby Language API for Asterisk
|
5
|
-
#
|
6
|
-
# Copyright (C) <2005> Mohammad Khan <info@beeplove.com>
|
7
|
-
#
|
8
|
-
# This program is free software; you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
10
|
-
# the Free Software Foundation; either version 2 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with this program; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
require 'error.rb'
|
25
|
-
require 'command.rb'
|
26
|
-
require 'asterisk_variable.rb'
|
27
|
-
require 'return_status.rb'
|
28
|
-
require 'sync'
|
29
|
-
|
30
|
-
|
31
|
-
class AGI
|
32
|
-
|
33
|
-
# constructor method of class AGI
|
34
|
-
#
|
35
|
-
# <b>Parameters</b>
|
36
|
-
#
|
37
|
-
# <b>Returns</b>
|
38
|
-
#
|
39
|
-
def initialize
|
40
|
-
@env = nil
|
41
|
-
@command = nil
|
42
|
-
|
43
|
-
@stdin_semaphore = nil
|
44
|
-
@stdout_semaphore = nil
|
45
|
-
@stderr_semaphore = nil
|
46
|
-
|
47
|
-
@debug = nil
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def command
|
52
|
-
if @command.nil?
|
53
|
-
@command = Command.new(@stdin_semaphore, @stdout_semaphore)
|
54
|
-
end
|
55
|
-
return @command
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
def env
|
60
|
-
if @env.nil?
|
61
|
-
@env = AsteriskVariable.new
|
62
|
-
end
|
63
|
-
|
64
|
-
return @env
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
def stdin_semaphore
|
69
|
-
if @stdin_semaphore.nil?
|
70
|
-
@stdin_semaphore = Sync.new
|
71
|
-
end
|
72
|
-
$stdin.sync = true
|
73
|
-
|
74
|
-
return @stdin_semaphore
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
def stdout_semaphore
|
79
|
-
if @stdout_semaphore.nil?
|
80
|
-
@stdout_semaphore = Sync.new
|
81
|
-
end
|
82
|
-
$stdout.sync = true
|
83
|
-
|
84
|
-
return @stdout_semaphore
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
def stderr_semaphore
|
89
|
-
if @stderr_semaphore.nil?
|
90
|
-
@stderr_semaphore = Sync.new
|
91
|
-
end
|
92
|
-
$stderr.sync = true
|
93
|
-
|
94
|
-
return @stderr_semaphore
|
95
|
-
end
|
96
|
-
|
97
|
-
public
|
98
|
-
def semaphore
|
99
|
-
if block_given?
|
100
|
-
stderr_semaphore.synchronize do
|
101
|
-
stdout_semaphore.synchronize do
|
102
|
-
stdin_semaphore.synchronize do
|
103
|
-
yield
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def debug
|
111
|
-
return @debug
|
112
|
-
end
|
113
|
-
|
114
|
-
def debug=(val)
|
115
|
-
@debug = val
|
116
|
-
end
|
117
|
-
|
118
|
-
def debug?
|
119
|
-
return @debug == true
|
120
|
-
end
|
121
|
-
|
122
|
-
def request
|
123
|
-
return env.request
|
124
|
-
end
|
125
|
-
|
126
|
-
def channel
|
127
|
-
return env.channel
|
128
|
-
end
|
129
|
-
|
130
|
-
def language
|
131
|
-
return env.language
|
132
|
-
end
|
133
|
-
|
134
|
-
def type
|
135
|
-
return env.type
|
136
|
-
end
|
137
|
-
|
138
|
-
def unique_id
|
139
|
-
return env.unique_id
|
140
|
-
end
|
141
|
-
|
142
|
-
def caller_id
|
143
|
-
return env.caller_id
|
144
|
-
end
|
145
|
-
|
146
|
-
def caller_id_name
|
147
|
-
return env.caller_id_name
|
148
|
-
end
|
149
|
-
|
150
|
-
def calling_pres
|
151
|
-
return env.calling_pres
|
152
|
-
end
|
153
|
-
|
154
|
-
def calling_ani_2
|
155
|
-
return env.calling_ani_2
|
156
|
-
end
|
157
|
-
|
158
|
-
def calling_ton
|
159
|
-
return env.calling_ton
|
160
|
-
end
|
161
|
-
|
162
|
-
def calling_tns
|
163
|
-
return env.calling_tns
|
164
|
-
end
|
165
|
-
|
166
|
-
def dn_id
|
167
|
-
return env.dn_id
|
168
|
-
end
|
169
|
-
|
170
|
-
def rdn_id
|
171
|
-
return env.rdn_id
|
172
|
-
end
|
173
|
-
|
174
|
-
def context
|
175
|
-
return env.context
|
176
|
-
end
|
177
|
-
|
178
|
-
def extension
|
179
|
-
return env.extension
|
180
|
-
end
|
181
|
-
|
182
|
-
def priority
|
183
|
-
return env.priority
|
184
|
-
end
|
185
|
-
|
186
|
-
def enhanced
|
187
|
-
return env.enhanced
|
188
|
-
end
|
189
|
-
|
190
|
-
def account_code
|
191
|
-
return env.account_code
|
192
|
-
end
|
193
|
-
|
194
|
-
def raw_command(str)
|
195
|
-
return command.raw_command(str)
|
196
|
-
end
|
197
|
-
|
198
|
-
def answer
|
199
|
-
return command.answer
|
200
|
-
end
|
201
|
-
|
202
|
-
def set_auto_hangup(val)
|
203
|
-
return command.set_auto_hangup(val)
|
204
|
-
end
|
205
|
-
|
206
|
-
def channel_status(channel=nil)
|
207
|
-
return command.channel_status(channel)
|
208
|
-
end
|
209
|
-
|
210
|
-
def exec(asterisk_application, options=nil)
|
211
|
-
return command.exec(asterisk_application, options)
|
212
|
-
end
|
213
|
-
|
214
|
-
def get_data(filename, timeout=nil, max_digit=nil)
|
215
|
-
return command.get_data(filename, timeout=nil, max_digit=nil)
|
216
|
-
end
|
217
|
-
|
218
|
-
def get_variable(name)
|
219
|
-
return command.get_variable(name)
|
220
|
-
end
|
221
|
-
|
222
|
-
def hangup(channel=nil)
|
223
|
-
return command.hangup(channel)
|
224
|
-
end
|
225
|
-
|
226
|
-
def noop(msg)
|
227
|
-
return command.noop(msg)
|
228
|
-
end
|
229
|
-
|
230
|
-
def receive_char(timeout=0)
|
231
|
-
return command.receive_char(timeout)
|
232
|
-
end
|
233
|
-
|
234
|
-
def receive_text(timeout=0)
|
235
|
-
return command.receive_text(timeout)
|
236
|
-
end
|
237
|
-
|
238
|
-
def record_file(filename, format='gsm', escape_digits=nil, timeout=nil, beep=true)
|
239
|
-
return command.record_file(filename, format, escape_digits, timeout, beep)
|
240
|
-
end
|
241
|
-
|
242
|
-
def say_digits(digit_string, escape_digits=nil)
|
243
|
-
return command.say_digits(digit_string, escape_digits)
|
244
|
-
end
|
245
|
-
|
246
|
-
def say_number(number, escape_digits=nil)
|
247
|
-
return command.say_number(number, escape_digits)
|
248
|
-
end
|
249
|
-
|
250
|
-
def say_phonetic(string, escape_digits=nil)
|
251
|
-
return command.say_phonetic(string, escape_digits)
|
252
|
-
end
|
253
|
-
|
254
|
-
def say_time(time=Time.now.to_i, escape_digits='#')
|
255
|
-
return command.say_time(time, escape_digits)
|
256
|
-
end
|
257
|
-
|
258
|
-
def send_image(image)
|
259
|
-
return command.send_image(image)
|
260
|
-
end
|
261
|
-
|
262
|
-
def send_text(text)
|
263
|
-
return command.send_text(text)
|
264
|
-
end
|
265
|
-
|
266
|
-
def set_caller_id(number)
|
267
|
-
return command.set_caller_id(number)
|
268
|
-
end
|
269
|
-
|
270
|
-
def set_context(context)
|
271
|
-
return command.set_context(context)
|
272
|
-
end
|
273
|
-
|
274
|
-
def set_extension(extension)
|
275
|
-
return command.set_extension(extension)
|
276
|
-
end
|
277
|
-
|
278
|
-
def set_priority(priority)
|
279
|
-
return command.set_priority(priority)
|
280
|
-
end
|
281
|
-
|
282
|
-
def set_music(mode=true, moh_class='default')
|
283
|
-
return command.set_music(mode, moh_class)
|
284
|
-
end
|
285
|
-
|
286
|
-
def set_variable(name, value)
|
287
|
-
return command.set_variable(name, value)
|
288
|
-
end
|
289
|
-
|
290
|
-
def stream_file(filename, escape_digits='#')
|
291
|
-
return command.stream_file(filename, escape_digits)
|
292
|
-
end
|
293
|
-
|
294
|
-
def tdd_mode(settings=true)
|
295
|
-
return command.tdd_mode(settings)
|
296
|
-
end
|
297
|
-
|
298
|
-
def verbose(message, level=3)
|
299
|
-
return command.verbose(message, level)
|
300
|
-
end
|
301
|
-
|
302
|
-
def wait_for_digit(timeout=nil)
|
303
|
-
return command.wait_for_digit(timeout)
|
304
|
-
end
|
305
|
-
|
306
|
-
def record(filename, format='gsm', escape_digits=nil, timeout=nil, beep=true, max_tries=3)
|
307
|
-
return command.record(filename, format, escape_digits, timeout, beep, max_tries)
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|