erichmond-ruby-agi 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +38 -0
- data/DOWNLOAD +3 -0
- data/INSTALL +11 -0
- data/LICENSE +223 -0
- data/README +14 -0
- data/Rakefile +20 -0
- data/Release-Notes +11 -0
- data/VERSION +1 -0
- data/examples/call_log.rb +18 -0
- data/extconf.rb +2 -0
- data/lib/ruby-agi/agi.rb +891 -0
- data/lib/ruby-agi/asterisk_variable.rb +239 -0
- data/lib/ruby-agi/command.rb +908 -0
- data/lib/ruby-agi/error.rb +45 -0
- data/lib/ruby-agi/return_status.rb +92 -0
- data/lib/ruby-agi.rb +5 -0
- data/ruby-agi.gemspec +54 -0
- metadata +73 -0
data/ChangeLog
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
2006-03-05
|
2
|
+
-- ruby-agi-1.1.2 released
|
3
|
+
-- bug # 3733 fixed.
|
4
|
+
-- AGI#initialize will make sure the above bug won't happen.
|
5
|
+
|
6
|
+
2006-02-08
|
7
|
+
-- method AsteriskVariable#init_caller_variable updated to have correct callerid
|
8
|
+
-- method ReturnStatus#timeout? updated
|
9
|
+
|
10
|
+
2006-01-16 (revision 23)
|
11
|
+
-- ruby-agi-1.1.0 released
|
12
|
+
-- method calleridnumber added and is generated from callerid
|
13
|
+
-- method calleridname gets name from callerid method,
|
14
|
+
currently I found asterisk returns nothing because of missing agi_calleridname
|
15
|
+
-- method jump_to added
|
16
|
+
|
17
|
+
2006-01-10 (revision 22)
|
18
|
+
-- following files added to svn repository
|
19
|
+
ruby-agi-1.0.1.gem
|
20
|
+
ruby-agi-1.0.2.gem
|
21
|
+
Release-Notes
|
22
|
+
ruby-agi-1.0.2.tgz
|
23
|
+
|
24
|
+
2006-01-09 (revision 21)
|
25
|
+
-- gemspec file updated to work properly with ruby-1.8.3
|
26
|
+
|
27
|
+
2006-01-08 (revision 20)
|
28
|
+
-- ruby-agi-1.0.1 released
|
29
|
+
|
30
|
+
2006-01-08 (revision 19)
|
31
|
+
-- examples/call_log.rb added
|
32
|
+
|
33
|
+
2006-01-08 (revision 18)
|
34
|
+
-- ruby-agi-0.0.2.gem removed from subversion repository
|
35
|
+
|
36
|
+
2006-01-08 (revision 17)
|
37
|
+
-- Started to maintain ChangeLog !!
|
38
|
+
|
data/DOWNLOAD
ADDED
data/INSTALL
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
I strongly suggest to install ruby-agi using gem,
|
2
|
+
% gem install ruby-agi
|
3
|
+
To update your existing ruby-agi using gem, try
|
4
|
+
% gem update ruby-agi
|
5
|
+
|
6
|
+
If you don't have gem intalled on your computer, download it from here
|
7
|
+
http://www.rubygems.org
|
8
|
+
|
9
|
+
Alternatively, do
|
10
|
+
1. ruby extconf.rb
|
11
|
+
2. make install
|
data/LICENSE
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
3
|
+
|
4
|
+
0. This License applies to any program or other work which contains
|
5
|
+
a notice placed by the copyright holder saying it may be distributed
|
6
|
+
under the terms of this General Public License. The "Program", below,
|
7
|
+
refers to any such program or work, and a "work based on the Program"
|
8
|
+
means either the Program or any derivative work under copyright law:
|
9
|
+
that is to say, a work containing the Program or a portion of it,
|
10
|
+
either verbatim or with modifications and/or translated into another
|
11
|
+
language. (Hereinafter, translation is included without limitation in
|
12
|
+
the term "modification".) Each licensee is addressed as "you".
|
13
|
+
|
14
|
+
Activities other than copying, distribution and modification are not
|
15
|
+
covered by this License; they are outside its scope. The act of
|
16
|
+
running the Program is not restricted, and the output from the Program
|
17
|
+
is covered only if its contents constitute a work based on the
|
18
|
+
Program (independent of having been made by running the Program).
|
19
|
+
Whether that is true depends on what the Program does.
|
20
|
+
|
21
|
+
1. You may copy and distribute verbatim copies of the Program's
|
22
|
+
source code as you receive it, in any medium, provided that you
|
23
|
+
conspicuously and appropriately publish on each copy an appropriate
|
24
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
25
|
+
notices that refer to this License and to the absence of any warranty;
|
26
|
+
and give any other recipients of the Program a copy of this License
|
27
|
+
along with the Program.
|
28
|
+
|
29
|
+
You may charge a fee for the physical act of transferring a copy, and
|
30
|
+
you may at your option offer warranty protection in exchange for a fee.
|
31
|
+
|
32
|
+
2. You may modify your copy or copies of the Program or any portion
|
33
|
+
of it, thus forming a work based on the Program, and copy and
|
34
|
+
distribute such modifications or work under the terms of Section 1
|
35
|
+
above, provided that you also meet all of these conditions:
|
36
|
+
|
37
|
+
a) You must cause the modified files to carry prominent notices
|
38
|
+
stating that you changed the files and the date of any change.
|
39
|
+
|
40
|
+
b) You must cause any work that you distribute or publish, that in
|
41
|
+
whole or in part contains or is derived from the Program or any
|
42
|
+
part thereof, to be licensed as a whole at no charge to all third
|
43
|
+
parties under the terms of this License.
|
44
|
+
|
45
|
+
c) If the modified program normally reads commands interactively
|
46
|
+
when run, you must cause it, when started running for such
|
47
|
+
interactive use in the most ordinary way, to print or display an
|
48
|
+
announcement including an appropriate copyright notice and a
|
49
|
+
notice that there is no warranty (or else, saying that you provide
|
50
|
+
a warranty) and that users may redistribute the program under
|
51
|
+
these conditions, and telling the user how to view a copy of this
|
52
|
+
License. (Exception: if the Program itself is interactive but
|
53
|
+
does not normally print such an announcement, your work based on
|
54
|
+
the Program is not required to print an announcement.)
|
55
|
+
|
56
|
+
These requirements apply to the modified work as a whole. If
|
57
|
+
identifiable sections of that work are not derived from the Program,
|
58
|
+
and can be reasonably considered independent and separate works in
|
59
|
+
themselves, then this License, and its terms, do not apply to those
|
60
|
+
sections when you distribute them as separate works. But when you
|
61
|
+
distribute the same sections as part of a whole which is a work based
|
62
|
+
on the Program, the distribution of the whole must be on the terms of
|
63
|
+
this License, whose permissions for other licensees extend to the
|
64
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
65
|
+
|
66
|
+
Thus, it is not the intent of this section to claim rights or contest
|
67
|
+
your rights to work written entirely by you; rather, the intent is to
|
68
|
+
exercise the right to control the distribution of derivative or
|
69
|
+
collective works based on the Program.
|
70
|
+
|
71
|
+
In addition, mere aggregation of another work not based on the Program
|
72
|
+
with the Program (or with a work based on the Program) on a volume of
|
73
|
+
a storage or distribution medium does not bring the other work under
|
74
|
+
the scope of this License.
|
75
|
+
|
76
|
+
3. You may copy and distribute the Program (or a work based on it,
|
77
|
+
under Section 2) in object code or executable form under the terms of
|
78
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
79
|
+
|
80
|
+
a) Accompany it with the complete corresponding machine-readable
|
81
|
+
source code, which must be distributed under the terms of Sections
|
82
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
83
|
+
|
84
|
+
b) Accompany it with a written offer, valid for at least three
|
85
|
+
years, to give any third party, for a charge no more than your
|
86
|
+
cost of physically performing source distribution, a complete
|
87
|
+
machine-readable copy of the corresponding source code, to be
|
88
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
89
|
+
customarily used for software interchange; or,
|
90
|
+
|
91
|
+
c) Accompany it with the information you received as to the offer
|
92
|
+
to distribute corresponding source code. (This alternative is
|
93
|
+
allowed only for noncommercial distribution and only if you
|
94
|
+
received the program in object code or executable form with such
|
95
|
+
an offer, in accord with Subsection b above.)
|
96
|
+
|
97
|
+
The source code for a work means the preferred form of the work for
|
98
|
+
making modifications to it. For an executable work, complete source
|
99
|
+
code means all the source code for all modules it contains, plus any
|
100
|
+
associated interface definition files, plus the scripts used to
|
101
|
+
control compilation and installation of the executable. However, as a
|
102
|
+
special exception, the source code distributed need not include
|
103
|
+
anything that is normally distributed (in either source or binary
|
104
|
+
form) with the major components (compiler, kernel, and so on) of the
|
105
|
+
operating system on which the executable runs, unless that component
|
106
|
+
itself accompanies the executable.
|
107
|
+
|
108
|
+
If distribution of executable or object code is made by offering
|
109
|
+
access to copy from a designated place, then offering equivalent
|
110
|
+
access to copy the source code from the same place counts as
|
111
|
+
distribution of the source code, even though third parties are not
|
112
|
+
compelled to copy the source along with the object code.
|
113
|
+
|
114
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
115
|
+
except as expressly provided under this License. Any attempt
|
116
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
117
|
+
void, and will automatically terminate your rights under this License.
|
118
|
+
However, parties who have received copies, or rights, from you under
|
119
|
+
this License will not have their licenses terminated so long as such
|
120
|
+
parties remain in full compliance.
|
121
|
+
|
122
|
+
5. You are not required to accept this License, since you have not
|
123
|
+
signed it. However, nothing else grants you permission to modify or
|
124
|
+
distribute the Program or its derivative works. These actions are
|
125
|
+
prohibited by law if you do not accept this License. Therefore, by
|
126
|
+
modifying or distributing the Program (or any work based on the
|
127
|
+
Program), you indicate your acceptance of this License to do so, and
|
128
|
+
all its terms and conditions for copying, distributing or modifying
|
129
|
+
the Program or works based on it.
|
130
|
+
|
131
|
+
6. Each time you redistribute the Program (or any work based on the
|
132
|
+
Program), the recipient automatically receives a license from the
|
133
|
+
original licensor to copy, distribute or modify the Program subject to
|
134
|
+
these terms and conditions. You may not impose any further
|
135
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
136
|
+
You are not responsible for enforcing compliance by third parties to
|
137
|
+
this License.
|
138
|
+
|
139
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
140
|
+
infringement or for any other reason (not limited to patent issues),
|
141
|
+
conditions are imposed on you (whether by court order, agreement or
|
142
|
+
otherwise) that contradict the conditions of this License, they do not
|
143
|
+
excuse you from the conditions of this License. If you cannot
|
144
|
+
distribute so as to satisfy simultaneously your obligations under this
|
145
|
+
License and any other pertinent obligations, then as a consequence you
|
146
|
+
may not distribute the Program at all. For example, if a patent
|
147
|
+
license would not permit royalty-free redistribution of the Program by
|
148
|
+
all those who receive copies directly or indirectly through you, then
|
149
|
+
the only way you could satisfy both it and this License would be to
|
150
|
+
refrain entirely from distribution of the Program.
|
151
|
+
|
152
|
+
If any portion of this section is held invalid or unenforceable under
|
153
|
+
any particular circumstance, the balance of the section is intended to
|
154
|
+
apply and the section as a whole is intended to apply in other
|
155
|
+
circumstances.
|
156
|
+
|
157
|
+
It is not the purpose of this section to induce you to infringe any
|
158
|
+
patents or other property right claims or to contest validity of any
|
159
|
+
such claims; this section has the sole purpose of protecting the
|
160
|
+
integrity of the free software distribution system, which is
|
161
|
+
implemented by public license practices. Many people have made
|
162
|
+
generous contributions to the wide range of software distributed
|
163
|
+
through that system in reliance on consistent application of that
|
164
|
+
system; it is up to the author/donor to decide if he or she is willing
|
165
|
+
to distribute software through any other system and a licensee cannot
|
166
|
+
impose that choice.
|
167
|
+
|
168
|
+
This section is intended to make thoroughly clear what is believed to
|
169
|
+
be a consequence of the rest of this License.
|
170
|
+
|
171
|
+
8. If the distribution and/or use of the Program is restricted in
|
172
|
+
certain countries either by patents or by copyrighted interfaces, the
|
173
|
+
original copyright holder who places the Program under this License
|
174
|
+
may add an explicit geographical distribution limitation excluding
|
175
|
+
those countries, so that distribution is permitted only in or among
|
176
|
+
countries not thus excluded. In such case, this License incorporates
|
177
|
+
the limitation as if written in the body of this License.
|
178
|
+
|
179
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
180
|
+
of the General Public License from time to time. Such new versions will
|
181
|
+
be similar in spirit to the present version, but may differ in detail to
|
182
|
+
address new problems or concerns.
|
183
|
+
|
184
|
+
Each version is given a distinguishing version number. If the Program
|
185
|
+
specifies a version number of this License which applies to it and "any
|
186
|
+
later version", you have the option of following the terms and conditions
|
187
|
+
either of that version or of any later version published by the Free
|
188
|
+
Software Foundation. If the Program does not specify a version number of
|
189
|
+
this License, you may choose any version ever published by the Free Software
|
190
|
+
Foundation.
|
191
|
+
|
192
|
+
10. If you wish to incorporate parts of the Program into other free
|
193
|
+
programs whose distribution conditions are different, write to the author
|
194
|
+
to ask for permission. For software which is copyrighted by the Free
|
195
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
196
|
+
make exceptions for this. Our decision will be guided by the two goals
|
197
|
+
of preserving the free status of all derivatives of our free software and
|
198
|
+
of promoting the sharing and reuse of software generally.
|
199
|
+
|
200
|
+
NO WARRANTY
|
201
|
+
|
202
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
203
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
204
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
205
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
206
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
207
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
208
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
209
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
210
|
+
REPAIR OR CORRECTION.
|
211
|
+
|
212
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
213
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
214
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
215
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
216
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
217
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
218
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
219
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
220
|
+
POSSIBILITY OF SUCH DAMAGES.
|
221
|
+
|
222
|
+
END OF TERMS AND CONDITIONS
|
223
|
+
|
data/README
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
This library comes with absolutely no warranty.
|
2
|
+
|
3
|
+
ruby-agi is a library to write AGI scripts in ruby language for Asterisk. ruby-agi does not depend of Asterisk Manager.
|
4
|
+
There have a very simple AGI script in example/call_log.rb.
|
5
|
+
I couldn't write any tutorial for ruby-agi and I am not good at it, if anybody want to give me a hand on writing documentation and tutorial, would be greatly appreciated.
|
6
|
+
|
7
|
+
Here are a sites that may help to know more about ruby-agi
|
8
|
+
http://ruby-agi.rubyforge.org (ruby-agi homepage)
|
9
|
+
|
10
|
+
Feel free to send me email, if you don't find any answer related to ruby-agi
|
11
|
+
|
12
|
+
Thank you,
|
13
|
+
Mohammad Khan,
|
14
|
+
email: info <AT> beeplove <DOT> com
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift('lib')
|
4
|
+
|
5
|
+
gem 'git'
|
6
|
+
require 'git'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'jeweler'
|
10
|
+
Jeweler::Tasks.new do |gemspec|
|
11
|
+
gemspec.name = "ruby-agi"
|
12
|
+
gemspec.summary = "Ruby AGI interface into Asterisk"
|
13
|
+
gemspec.description = "This is a fork of ruby-agi version 1.1.2 by Mohammad Khan. We've made some fixes for rails compatibility, and preferred the v1.1.2 codebase over the 2.0.0 codebase, so we've created a gem for our own local use that other people are welcome to use, if it suits them."
|
14
|
+
gemspec.email = "eric@newvo.com"
|
15
|
+
gemspec.homepage = "http://github.com/erichmond/ruby-agi"
|
16
|
+
gemspec.authors = ["Mohammad Khan", "Carlos Lenz", "Eric Richmond"]
|
17
|
+
end
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler"
|
20
|
+
end
|
data/Release-Notes
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.1
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# File : call_log.rb
|
4
|
+
# Purpose: log caller and calleridname in syslog as warning message
|
5
|
+
# Author: Mohammad Khan, info@beeplove.com
|
6
|
+
# Liscense: GNU GENERAL PUBLIC LICENSE
|
7
|
+
#
|
8
|
+
|
9
|
+
|
10
|
+
require 'syslog'
|
11
|
+
require 'rubygems'
|
12
|
+
require_gem 'ruby-agi'
|
13
|
+
|
14
|
+
|
15
|
+
log = Syslog.open("call_log.rb")
|
16
|
+
agi = AGI.new
|
17
|
+
|
18
|
+
log.warning("#{agi.callerid} <#{agi.calleridname}>")
|
data/extconf.rb
ADDED