gs_phone 0.0.3 → 0.0.4
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/CHANGES.txt +7 -0
- data/INSTALL.txt +33 -0
- data/MAINTAINERS.txt +3 -0
- data/README.txt +12 -3
- data/ROADMAP.txt +32 -0
- data/Rakefile +2 -2
- data/TODO.txt +3 -0
- data/bin/gs_phone +1 -36
- data/lib/gs_phone.rb +94 -6
- data/lib/gs_phone/version.rb +1 -1
- data/test/gs_phone_test.rb +101 -61
- metadata +10 -4
data/CHANGES.txt
CHANGED
data/INSTALL.txt
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Adapted from: http://theadmin.org/articles/2007/03/23/gs_phone-ruby-program-to-remotely-configure-grandstream-voip-phone
|
2
|
+
|
3
|
+
### How do I get it?
|
4
|
+
|
5
|
+
There are three ways to get gs_phone.
|
6
|
+
|
7
|
+
1. (Recommended) Grab the gem from Rubyforge. It is packaged like many other Ruby libraries and this will let you keep up to date and any changes to the program.
|
8
|
+
|
9
|
+
gem install gs_phone
|
10
|
+
|
11
|
+
2. Grab the [archive file][1] from Rubyforge.
|
12
|
+
|
13
|
+
3. Get the latest Subversion copy. The repository is public for reading so a quick checkout should work.
|
14
|
+
|
15
|
+
svn checkout https://svn.theadmin.org/public/gs_phone/trunk/ gs_phone
|
16
|
+
|
17
|
+
You can also get the release code in the tags folders
|
18
|
+
|
19
|
+
svn checkout https://svn.theadmin.org/public/gs_phone/tags/release-0.0.2/ gs_phone-0.0.2
|
20
|
+
|
21
|
+
In order to use gs_phone you will also need to download [gsutil][2] from Charles Howes. The main file we are looking for is called gsutil
|
22
|
+
|
23
|
+
|
24
|
+
### How do I use it?
|
25
|
+
|
26
|
+
1. First you will need to run gs_phone to have it setup a folder and some files for you. Currenly they are hardcoded to HOME/.gs_phone but they could change soon. Just run gs_phone and it should notice you need the files and create them for you.
|
27
|
+
2. Next you need to point gs_phone to your gsutil program. You can either copy gsutil into HOME/.gs_phone or modify the config.yml for gs_phone to point to the correct location.
|
28
|
+
3. gs_phone should now work. Run the help command to get an idea of some of the functions. You can also run help on a command to see what a specific command does.
|
29
|
+
|
30
|
+
Eric Davis
|
31
|
+
|
32
|
+
[1]: http://rubyforge.org/frs/?group_id=3216
|
33
|
+
[2]: http://www.pkts.ca/gsutil.shtml
|
data/MAINTAINERS.txt
ADDED
data/README.txt
CHANGED
@@ -4,19 +4,28 @@ Copyright (C) 2007 Eric Davis
|
|
4
4
|
|
5
5
|
= Description
|
6
6
|
|
7
|
+
Application to mange and configure a group of Grandstream Voip phones.
|
7
8
|
|
8
9
|
= Dependencies
|
9
10
|
|
10
|
-
YAML
|
11
|
+
YAML is required.
|
11
12
|
|
12
13
|
= Installation
|
13
14
|
|
14
15
|
RubyGem way:
|
15
16
|
$ gem install gs_phone
|
16
17
|
|
17
|
-
=
|
18
|
+
= Usage
|
18
19
|
|
19
|
-
|
20
|
+
A shell program, 'gs_phone', is installed by RubyGems and is the primary way to
|
21
|
+
use gs_phone. Running "gs_phone help" will provide usage examples.
|
22
|
+
|
23
|
+
Additional the library can be called through the public methods by another Ruby
|
24
|
+
application. See the RDoc for details on how to use the public methods.
|
25
|
+
|
26
|
+
= Example configurations
|
27
|
+
|
28
|
+
Example configuration files are provided in the "examples" directory.
|
20
29
|
|
21
30
|
= Contact
|
22
31
|
|
data/ROADMAP.txt
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
= Version 0.0.2 =
|
2
|
+
|
3
|
+
* Rework command line passing
|
4
|
+
|
5
|
+
= Version 0.0.3 =
|
6
|
+
|
7
|
+
* Add unit tests
|
8
|
+
|
9
|
+
= Version 0.0.4 =
|
10
|
+
|
11
|
+
* Separate pubic and private methods
|
12
|
+
* Add in the 'all' commands
|
13
|
+
|
14
|
+
= Version 0.0.5 =
|
15
|
+
|
16
|
+
* Refactor design
|
17
|
+
|
18
|
+
= Version 0.0.6 =
|
19
|
+
|
20
|
+
* Add in command to get a list of ip addresses
|
21
|
+
|
22
|
+
= Version 0.1.0 =
|
23
|
+
|
24
|
+
* Beta Release
|
25
|
+
* Replace gsutil script
|
26
|
+
|
27
|
+
= Version 1.0.0 =
|
28
|
+
|
29
|
+
* Stable release
|
30
|
+
* ???
|
31
|
+
|
32
|
+
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ AUTHOR = "Eric Davis" # can also be an array of Authors
|
|
15
15
|
EMAIL = "edavis10@gmail.com"
|
16
16
|
DESCRIPTION = "Application to mange and configure a group of Grandstream Voip phones"
|
17
17
|
GEM_NAME = "gs_phone" # what ppl will type to install your gem
|
18
|
-
RUBYFORGE_PROJECT = "
|
18
|
+
RUBYFORGE_PROJECT = "gs-phone" # The unix name for your project
|
19
19
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
20
20
|
|
21
21
|
NAME = "gs_phone"
|
@@ -50,7 +50,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
50
50
|
#p.changes - A description of the release's latest changes.
|
51
51
|
#p.extra_deps - An array of rubygem dependencies.
|
52
52
|
p.spec_extras = {
|
53
|
-
"extra_rdoc_files" => ["CHANGES.txt", "README.txt", "COPYING.txt", "TODO.txt"]
|
53
|
+
"extra_rdoc_files" => ["CHANGES.txt", "README.txt", "COPYING.txt", "TODO.txt", "MAINTAINERS.txt", "ROADMAP.txt", "INSTALL.txt"]
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
data/TODO.txt
CHANGED
@@ -4,6 +4,7 @@ This is the list of tasks that need to be done or have been completed.
|
|
4
4
|
|
5
5
|
= CURRENT
|
6
6
|
|
7
|
+
* Refactor design
|
7
8
|
* Announce package
|
8
9
|
* Get a list of the ip addresses currently assigned (Currently this works: grep -i '^ip' users.yml | awk '// {print $2}' | sort)
|
9
10
|
* Allow asterisk intregration
|
@@ -28,3 +29,5 @@ This is the list of tasks that need to be done or have been completed.
|
|
28
29
|
* Add unit tests
|
29
30
|
* Cleanup the option parser
|
30
31
|
* Cleanup the output from the program (e.g. remove "GS >")
|
32
|
+
* Make methods private
|
33
|
+
* BUG: No interface to the all commands (e.g. reboot all)
|
data/bin/gs_phone
CHANGED
@@ -10,39 +10,4 @@ require 'gs_phone'
|
|
10
10
|
|
11
11
|
|
12
12
|
gs = GrandStream.new
|
13
|
-
|
14
|
-
if not ARGV.nil? and ARGV.include?("-v")
|
15
|
-
gs.verbose = true
|
16
|
-
ARGV.delete_if { |a| a == "-v"}
|
17
|
-
end
|
18
|
-
|
19
|
-
@command = ARGV[0]
|
20
|
-
@ip = ARGV[1]
|
21
|
-
@current_ip = ARGV[2]
|
22
|
-
@admin = ARGV[3]
|
23
|
-
|
24
|
-
case @command
|
25
|
-
when "help"
|
26
|
-
response = gs.help(ARGV[1])
|
27
|
-
when "new"
|
28
|
-
# Don't use response because we want to give feeback throughout this process
|
29
|
-
puts gs.add_user(@ip)
|
30
|
-
puts gs.make(@ip)
|
31
|
-
puts gs.update_config(@ip, @current_ip, @admin)
|
32
|
-
puts gs.reboot_phone(@ip)
|
33
|
-
when "add"
|
34
|
-
response = gs.add_user(@ip)
|
35
|
-
when "make"
|
36
|
-
response = gs.make(@ip)
|
37
|
-
when "update"
|
38
|
-
response = gs.update_config(@ip, @current_ip, @admin)
|
39
|
-
when "reboot"
|
40
|
-
response = gs.reboot_phone(@ip)
|
41
|
-
when "find"
|
42
|
-
response = gs.find_ip
|
43
|
-
else
|
44
|
-
response = gs.help
|
45
|
-
end
|
46
|
-
|
47
|
-
# Print out any responses, used for verbose options
|
48
|
-
puts response unless response.nil?
|
13
|
+
puts gs.parse_arguements(ARGV)
|
data/lib/gs_phone.rb
CHANGED
@@ -50,7 +50,77 @@ class GrandStream
|
|
50
50
|
# TODO: need to find a way to stop printing this in TEST
|
51
51
|
# puts @new_config_created unless @new_config_created.nil?
|
52
52
|
end
|
53
|
+
|
54
|
+
# This is the main event handler. Send it an array of arguements that match
|
55
|
+
# the following signatures. Arguements marked with * are optional:
|
56
|
+
#
|
57
|
+
# help => "help", *command
|
58
|
+
# new => "new", ip, *current_ip, *admin_password
|
59
|
+
# add => "add", *username, *password, *mac_address
|
60
|
+
# make => "make", *ip
|
61
|
+
# make all => "make", "all"
|
62
|
+
# update => "update", *ip
|
63
|
+
# update all => "update", "all"
|
64
|
+
# reboot => "reboot", *ip
|
65
|
+
# reboot all => "reboot", "all"
|
66
|
+
# find => "find", *ip
|
67
|
+
#
|
68
|
+
def parse_arguements(arguements)
|
69
|
+
if not arguements.nil? and arguements.include?("-v")
|
70
|
+
@verbose = true
|
71
|
+
arguements.delete_if { |a| a == "-v"}
|
72
|
+
end
|
53
73
|
|
74
|
+
@command = arguements[0]
|
75
|
+
@ip = arguements[1]
|
76
|
+
@current_ip = arguements[2]
|
77
|
+
@admin = arguements[3]
|
78
|
+
|
79
|
+
case @command
|
80
|
+
when "help"
|
81
|
+
response = help(arguements[1])
|
82
|
+
when "new"
|
83
|
+
# Don't use response because we want to give feeback throughout this process
|
84
|
+
puts add_user(@ip)
|
85
|
+
puts make(@ip)
|
86
|
+
puts update_config(@ip, @current_ip, @admin)
|
87
|
+
puts reboot_phone(@ip)
|
88
|
+
when "add"
|
89
|
+
username = arguements[2]
|
90
|
+
password = arguements[3]
|
91
|
+
extension = arguements[3] # TODO: assuming password and extensions are the same.
|
92
|
+
mac_addy = arguements[4]
|
93
|
+
response = add_user(@ip,username,password,mac_addy)
|
94
|
+
when "make"
|
95
|
+
if @ip != "all"
|
96
|
+
response = make(@ip)
|
97
|
+
else
|
98
|
+
response = make_all
|
99
|
+
end
|
100
|
+
when "update"
|
101
|
+
if @ip != "all"
|
102
|
+
response = update_config(@ip, @current_ip, @admin)
|
103
|
+
else
|
104
|
+
response = update_all
|
105
|
+
end
|
106
|
+
when "reboot"
|
107
|
+
if @ip != "all"
|
108
|
+
response = reboot_phone(@ip)
|
109
|
+
else
|
110
|
+
response = reboot_all
|
111
|
+
end
|
112
|
+
when "find"
|
113
|
+
response = find_ip(@ip)
|
114
|
+
else
|
115
|
+
response = help
|
116
|
+
end
|
117
|
+
|
118
|
+
# Print out any responses, used for verbose options
|
119
|
+
return response unless response.nil?
|
120
|
+
end
|
121
|
+
|
122
|
+
private
|
123
|
+
|
54
124
|
def help(command=nil)
|
55
125
|
usage_summary(command)
|
56
126
|
end
|
@@ -184,9 +254,21 @@ class GrandStream
|
|
184
254
|
data = YAML::load_documents(users) do |element|
|
185
255
|
@user_list[element['ext']] = element['ip']
|
186
256
|
end
|
257
|
+
|
258
|
+
responses = String.new
|
187
259
|
@user_list.each do |ext,ip|
|
188
|
-
make(ip)
|
260
|
+
response = make(ip)
|
261
|
+
if response
|
262
|
+
responses << response
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if not @verbose
|
267
|
+
return nil
|
268
|
+
else
|
269
|
+
return responses
|
189
270
|
end
|
271
|
+
|
190
272
|
end
|
191
273
|
|
192
274
|
|
@@ -256,7 +338,7 @@ class GrandStream
|
|
256
338
|
end
|
257
339
|
|
258
340
|
# Reboot all phones
|
259
|
-
def
|
341
|
+
def reboot_all
|
260
342
|
puts "Rebooting all phones" if @verbose
|
261
343
|
@user_list = Hash.new
|
262
344
|
|
@@ -323,10 +405,12 @@ EOADD
|
|
323
405
|
usage =<<EOMAKE
|
324
406
|
Usage: make IP_ADDRESS
|
325
407
|
|
326
|
-
Creates the configuration file for the phone at IP_ADDRESS
|
408
|
+
Creates the configuration file for the phone at IP_ADDRESS. 'all' can be used
|
409
|
+
as the IP_ADDRESS to make configurations all of the systems.
|
327
410
|
|
328
411
|
Ex:
|
329
412
|
make 192.168.1.200
|
413
|
+
make all
|
330
414
|
|
331
415
|
EOMAKE
|
332
416
|
|
@@ -334,7 +418,8 @@ EOMAKE
|
|
334
418
|
usage =<<EOUPDATE
|
335
419
|
Usage: update IP_ADDRESS [CURRENT_ADDRESS] [ADMIN_PASSWORD]
|
336
420
|
|
337
|
-
Sends the updated configuration file for IP_ADDRESS to the phone.
|
421
|
+
Sends the updated configuration file for IP_ADDRESS to the phone. 'all' can be
|
422
|
+
used as the IP_ADDRESS to update all of the systems.
|
338
423
|
|
339
424
|
Optionally, a phone configuration can be sent to a phone that currently has
|
340
425
|
a different ip address by using CURRENT_ADDRESS
|
@@ -345,20 +430,23 @@ Ex:
|
|
345
430
|
update 192.168.1.200
|
346
431
|
update 192.168.1.200 192.168.1.10 <= Send '200's update to the phone at '10'
|
347
432
|
update 192.168.1.200 192.168.1.10 admin <= Also uses the factory password
|
433
|
+
update all
|
348
434
|
|
349
435
|
|
350
436
|
EOUPDATE
|
351
437
|
|
352
438
|
when "reboot"
|
353
439
|
usage =<<EOREBOOT
|
354
|
-
Usage: reboot
|
440
|
+
Usage: reboot IP_ADDRESS
|
355
441
|
|
356
|
-
Reboots the phone at IP_ADDRESS.
|
442
|
+
Reboots the phone at IP_ADDRESS. 'all' can be used as the IP_ADDRESS to reboot
|
443
|
+
all of the systems.
|
357
444
|
|
358
445
|
CAUTION: Some firmware will allow the phone to be rebooted while it is in use!
|
359
446
|
|
360
447
|
Ex:
|
361
448
|
reboot 192.168.1.200
|
449
|
+
reboot all
|
362
450
|
|
363
451
|
EOREBOOT
|
364
452
|
|
data/lib/gs_phone/version.rb
CHANGED
data/test/gs_phone_test.rb
CHANGED
@@ -70,7 +70,7 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
70
70
|
def test_add_user
|
71
71
|
create_new_settings
|
72
72
|
gs = GrandStream.new
|
73
|
-
gs.
|
73
|
+
gs.parse_arguements(["add","192.168.100.23","John Doe","200","000B820B0A7C"])
|
74
74
|
|
75
75
|
assert File.exists?("tmp/users.yml")
|
76
76
|
users = YAML::load(File.open("tmp/users.yml"))
|
@@ -85,10 +85,10 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
85
85
|
def test_make
|
86
86
|
create_new_settings
|
87
87
|
gs = GrandStream.new
|
88
|
-
gs.
|
88
|
+
gs.parse_arguements(["add","192.168.100.23","John Doe","200","000B820B0A7C"])
|
89
89
|
|
90
90
|
# Make the file and check that it is correct
|
91
|
-
gs.make
|
91
|
+
assert_equal "Made config for extension 200",gs.parse_arguements(['make','192.168.100.23'])
|
92
92
|
assert File.exists?("tmp/templates/192.168.100.23.cfg")
|
93
93
|
|
94
94
|
config = File.read("tmp/templates/192.168.100.23.cfg")
|
@@ -122,12 +122,12 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
122
122
|
|
123
123
|
# Create some users
|
124
124
|
userlist.each do |ip,user|
|
125
|
-
gs.
|
125
|
+
gs.parse_arguements(["add",ip,user,rand(300).to_s,"000B820B0A7C"])
|
126
126
|
end
|
127
127
|
|
128
128
|
# Make all of the files
|
129
|
-
gs.
|
130
|
-
|
129
|
+
assert_nil gs.parse_arguements(['make','all'])
|
130
|
+
|
131
131
|
# Check that they are all there and correct
|
132
132
|
userlist.each do |ip, user|
|
133
133
|
assert File.exists?("tmp/templates/#{ip}.cfg")
|
@@ -140,9 +140,9 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
140
140
|
def test_find_ip
|
141
141
|
create_new_settings
|
142
142
|
gs = GrandStream.new
|
143
|
-
gs.
|
143
|
+
gs.parse_arguements(["add","192.168.100.23","John Doe","200","000B820B0A7C"])
|
144
144
|
|
145
|
-
assert_equal "192.168.100.23", gs.
|
145
|
+
assert_equal "192.168.100.23", gs.parse_arguements(['find','200'])
|
146
146
|
end
|
147
147
|
|
148
148
|
# Reboot the phone
|
@@ -151,7 +151,7 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
151
151
|
# Change the admin password so the mock will work
|
152
152
|
change_admin_password
|
153
153
|
gs = GrandStream.new
|
154
|
-
assert_nil gs.
|
154
|
+
assert_nil gs.parse_arguements(['reboot',"192.168.1.25"]) # a nil return means no error
|
155
155
|
|
156
156
|
end
|
157
157
|
|
@@ -159,7 +159,7 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
159
159
|
def test_reboot_incorrect_password
|
160
160
|
create_new_settings
|
161
161
|
gs = GrandStream.new
|
162
|
-
assert_equal "ERROR: Failed to reboot phone", gs.
|
162
|
+
assert_equal "ERROR: Failed to reboot phone", gs.parse_arguements(['reboot',"192.168.1.25"])
|
163
163
|
|
164
164
|
end
|
165
165
|
|
@@ -170,10 +170,10 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
170
170
|
# Change the admin password so the mock will work
|
171
171
|
change_admin_password
|
172
172
|
gs = GrandStream.new
|
173
|
-
gs.
|
174
|
-
gs.
|
173
|
+
gs.parse_arguements(["add","192.168.1.25","John Doe1","200","000B820B0A7C"])
|
174
|
+
gs.parse_arguements(["add","192.168.1.25","John Doe2","201","000B820B0A7C"])
|
175
175
|
|
176
|
-
assert_nil gs.
|
176
|
+
assert_nil gs.parse_arguements(['reboot','all'])
|
177
177
|
|
178
178
|
end
|
179
179
|
|
@@ -183,10 +183,10 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
183
183
|
# Change the admin password so the mock will work
|
184
184
|
change_admin_password
|
185
185
|
gs = GrandStream.new
|
186
|
-
gs.
|
187
|
-
gs.make
|
188
|
-
|
189
|
-
assert_nil gs.
|
186
|
+
gs.parse_arguements(["add","192.168.1.25","John Doe","200","000B820B0A7C"])
|
187
|
+
assert_equal "Made config for extension 200", gs.parse_arguements(['make','192.168.1.25'])
|
188
|
+
|
189
|
+
assert_nil gs.parse_arguements(['update','192.168.1.25']) # nil means no error
|
190
190
|
|
191
191
|
end
|
192
192
|
|
@@ -194,10 +194,10 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
194
194
|
def test_update_incorrect_password
|
195
195
|
create_new_settings
|
196
196
|
gs = GrandStream.new
|
197
|
-
gs.
|
198
|
-
gs.make
|
197
|
+
gs.parse_arguements(["add","192.168.1.25","John Doe","200","000B820B0A7C"])
|
198
|
+
assert_equal "Made config for extension 200", gs.parse_arguements(['make','192.168.1.25'])
|
199
199
|
|
200
|
-
assert_equal "ERROR: Failed to send config", gs.
|
200
|
+
assert_equal "ERROR: Failed to send config", gs.parse_arguements(['update','192.168.1.25'])
|
201
201
|
|
202
202
|
end
|
203
203
|
|
@@ -215,24 +215,67 @@ class GrandstreamTest < Test::Unit::TestCase
|
|
215
215
|
|
216
216
|
# Create some users
|
217
217
|
userlist.each do |ip,user|
|
218
|
-
gs.
|
218
|
+
gs.parse_arguements(["add",ip,user,rand(300).to_s,"000B820B0A7C"])
|
219
219
|
end
|
220
220
|
|
221
221
|
# Make all of the files
|
222
|
-
gs.
|
223
|
-
|
224
|
-
assert_nil gs.update_all # nil means no error
|
222
|
+
assert_nil gs.parse_arguements(['make','all'])
|
223
|
+
assert_nil gs.parse_arguements(['update','all'])
|
225
224
|
|
226
225
|
end
|
227
226
|
|
228
|
-
|
229
227
|
#####
|
230
228
|
# Help sections
|
231
229
|
#####
|
232
230
|
def test_help
|
233
231
|
create_new_settings
|
234
232
|
gs = GrandStream.new
|
235
|
-
|
233
|
+
assert_equal help_text, gs.parse_arguements([])
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_help_new
|
237
|
+
create_new_settings
|
238
|
+
gs = GrandStream.new
|
239
|
+
assert_equal help_text_new, gs.parse_arguements(["help","new"])
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_help_add
|
243
|
+
create_new_settings
|
244
|
+
gs = GrandStream.new
|
245
|
+
|
246
|
+
assert_equal help_text_add, gs.parse_arguements(["help","add"])
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_help_make
|
250
|
+
create_new_settings
|
251
|
+
gs = GrandStream.new
|
252
|
+
|
253
|
+
assert_equal help_text_make, gs.parse_arguements(["help","make"])
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_help_update
|
257
|
+
create_new_settings
|
258
|
+
gs = GrandStream.new
|
259
|
+
|
260
|
+
assert_equal help_text_update, gs.parse_arguements(["help","update"])
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_help_reboot
|
264
|
+
create_new_settings
|
265
|
+
gs = GrandStream.new
|
266
|
+
|
267
|
+
assert_equal help_text_reboot, gs.parse_arguements(["help","reboot"])
|
268
|
+
end
|
269
|
+
|
270
|
+
def test_help_find
|
271
|
+
create_new_settings
|
272
|
+
gs = GrandStream.new
|
273
|
+
|
274
|
+
assert_equal help_text_find, gs.parse_arguements(["help","find"])
|
275
|
+
end
|
276
|
+
|
277
|
+
def help_text
|
278
|
+
help =<<EOHELP
|
236
279
|
Usage: COMMAND [options]
|
237
280
|
|
238
281
|
COMMANDS DESCRIPTION
|
@@ -244,13 +287,11 @@ reboot Reboots a phone
|
|
244
287
|
find Find the ip address in the configuration file
|
245
288
|
|
246
289
|
EOHELP
|
247
|
-
|
248
|
-
assert_equal help, gs.help
|
290
|
+
return help
|
249
291
|
end
|
250
292
|
|
251
|
-
|
252
|
-
|
253
|
-
gs = GrandStream.new
|
293
|
+
def help_text_new
|
294
|
+
|
254
295
|
help =<<EONEW
|
255
296
|
Usage: new
|
256
297
|
|
@@ -258,13 +299,12 @@ Goes through all the steps to setup a new phone:
|
|
258
299
|
"add", "make", "update", "reboot"
|
259
300
|
|
260
301
|
EONEW
|
261
|
-
|
262
|
-
|
302
|
+
|
303
|
+
return help
|
263
304
|
end
|
264
305
|
|
265
|
-
|
266
|
-
|
267
|
-
gs = GrandStream.new
|
306
|
+
|
307
|
+
def help_text_add
|
268
308
|
help =<<EOADD
|
269
309
|
Usage: add IP_ADDRESS
|
270
310
|
|
@@ -275,32 +315,31 @@ Ex:
|
|
275
315
|
|
276
316
|
EOADD
|
277
317
|
|
278
|
-
|
318
|
+
return help
|
279
319
|
end
|
280
320
|
|
281
|
-
def
|
282
|
-
create_new_settings
|
283
|
-
gs = GrandStream.new
|
321
|
+
def help_text_make
|
284
322
|
help =<<EOMAKE
|
285
323
|
Usage: make IP_ADDRESS
|
286
324
|
|
287
|
-
Creates the configuration file for the phone at IP_ADDRESS
|
325
|
+
Creates the configuration file for the phone at IP_ADDRESS. 'all' can be used
|
326
|
+
as the IP_ADDRESS to make configurations all of the systems.
|
288
327
|
|
289
328
|
Ex:
|
290
329
|
make 192.168.1.200
|
330
|
+
make all
|
291
331
|
|
292
332
|
EOMAKE
|
293
333
|
|
294
|
-
|
334
|
+
return help
|
295
335
|
end
|
296
|
-
|
297
|
-
def
|
298
|
-
create_new_settings
|
299
|
-
gs = GrandStream.new
|
336
|
+
|
337
|
+
def help_text_update
|
300
338
|
help =<<EOUPDATE
|
301
339
|
Usage: update IP_ADDRESS [CURRENT_ADDRESS] [ADMIN_PASSWORD]
|
302
340
|
|
303
|
-
Sends the updated configuration file for IP_ADDRESS to the phone.
|
341
|
+
Sends the updated configuration file for IP_ADDRESS to the phone. 'all' can be
|
342
|
+
used as the IP_ADDRESS to update all of the systems.
|
304
343
|
|
305
344
|
Optionally, a phone configuration can be sent to a phone that currently has
|
306
345
|
a different ip address by using CURRENT_ADDRESS
|
@@ -311,34 +350,35 @@ Ex:
|
|
311
350
|
update 192.168.1.200
|
312
351
|
update 192.168.1.200 192.168.1.10 <= Send '200's update to the phone at '10'
|
313
352
|
update 192.168.1.200 192.168.1.10 admin <= Also uses the factory password
|
353
|
+
update all
|
314
354
|
|
315
355
|
|
316
356
|
EOUPDATE
|
317
|
-
|
318
|
-
|
357
|
+
|
358
|
+
return help
|
319
359
|
end
|
320
360
|
|
321
|
-
def
|
322
|
-
create_new_settings
|
323
|
-
gs = GrandStream.new
|
361
|
+
def help_text_reboot
|
324
362
|
help =<<EOREBOOT
|
325
|
-
Usage: reboot
|
363
|
+
Usage: reboot IP_ADDRESS
|
326
364
|
|
327
|
-
Reboots the phone at IP_ADDRESS.
|
365
|
+
Reboots the phone at IP_ADDRESS. 'all' can be used as the IP_ADDRESS to reboot
|
366
|
+
all of the systems.
|
328
367
|
|
329
368
|
CAUTION: Some firmware will allow the phone to be rebooted while it is in use!
|
330
369
|
|
331
370
|
Ex:
|
332
371
|
reboot 192.168.1.200
|
372
|
+
reboot all
|
333
373
|
|
334
374
|
EOREBOOT
|
335
|
-
|
336
|
-
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
return help
|
337
379
|
end
|
338
380
|
|
339
|
-
def
|
340
|
-
create_new_settings
|
341
|
-
gs = GrandStream.new
|
381
|
+
def help_text_find
|
342
382
|
help =<<EOFIND
|
343
383
|
Usage: find
|
344
384
|
|
@@ -346,7 +386,7 @@ Searches the user.yml file to get the ipaddress of an extension.
|
|
346
386
|
|
347
387
|
EOFIND
|
348
388
|
|
349
|
-
|
389
|
+
return help
|
350
390
|
end
|
351
|
-
|
391
|
+
|
352
392
|
end
|
metadata
CHANGED
@@ -3,14 +3,14 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: gs_phone
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.4
|
7
|
+
date: 2007-05-09 00:00:00 -07:00
|
8
8
|
summary: Application to mange and configure a group of Grandstream Voip phones
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: edavis10@gmail.com
|
12
|
-
homepage: http://
|
13
|
-
rubyforge_project:
|
12
|
+
homepage: http://gs-phone.rubyforge.org
|
13
|
+
rubyforge_project: gs-phone
|
14
14
|
description: Application to mange and configure a group of Grandstream Voip phones
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
@@ -42,6 +42,9 @@ files:
|
|
42
42
|
- CHANGES.txt
|
43
43
|
- COPYING.txt
|
44
44
|
- TODO.txt
|
45
|
+
- MAINTAINERS.txt
|
46
|
+
- ROADMAP.txt
|
47
|
+
- INSTALL.txt
|
45
48
|
test_files:
|
46
49
|
- test/gs_phone_test.rb
|
47
50
|
rdoc_options: []
|
@@ -51,6 +54,9 @@ extra_rdoc_files:
|
|
51
54
|
- README.txt
|
52
55
|
- COPYING.txt
|
53
56
|
- TODO.txt
|
57
|
+
- MAINTAINERS.txt
|
58
|
+
- ROADMAP.txt
|
59
|
+
- INSTALL.txt
|
54
60
|
executables:
|
55
61
|
- gs_phone
|
56
62
|
extensions: []
|