ruby-agi 1.1.2 → 2.0.0
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/ChangeLog +0 -9
- data/DOWNLOAD +1 -1
- data/INSTALL +1 -6
- data/README +10 -7
- data/Release-Notes +18 -9
- data/lib/ruby-agi/asterisk_variable.rb +2 -2
- data/lib/ruby-agi/command.rb +40 -37
- data/lib/ruby-agi/error.rb +3 -0
- data/lib/ruby-agi/return_status.rb +31 -92
- data/lib/ruby-agi/rs/answer.rb +68 -0
- data/lib/ruby-agi/rs/channel_status.rb +127 -0
- data/lib/ruby-agi/rs/exec.rb +69 -0
- data/lib/ruby-agi/rs/get_variable.rb +76 -0
- data/lib/ruby-agi/rs/hangup.rb +76 -0
- data/lib/ruby-agi/rs/noop.rb +68 -0
- data/lib/ruby-agi/rs/receive_char.rb +112 -0
- data/lib/ruby-agi/rs/receive_text.rb +73 -0
- data/lib/ruby-agi/rs/record_file.rb +184 -0
- data/lib/ruby-agi/rs/result.rb +47 -0
- data/lib/ruby-agi/rs/return_status.rb +98 -0
- data/lib/ruby-agi/rs/say_digits.rb +85 -0
- data/lib/ruby-agi/rs/say_number.rb +88 -0
- data/lib/ruby-agi/rs/say_phonetic.rb +88 -0
- data/lib/ruby-agi/rs/say_time.rb +90 -0
- data/lib/ruby-agi/rs/send_image.rb +83 -0
- data/lib/ruby-agi/rs/send_text.rb +83 -0
- data/lib/ruby-agi/rs/set_auto_hangup.rb +69 -0
- data/lib/ruby-agi/rs/set_caller_id.rb +72 -0
- data/lib/ruby-agi/rs/set_context.rb +71 -0
- data/lib/ruby-agi/rs/set_extension.rb +72 -0
- data/lib/ruby-agi/rs/set_music.rb +71 -0
- data/lib/ruby-agi/rs/set_priority.rb +69 -0
- data/lib/ruby-agi/rs/set_variable.rb +76 -0
- data/lib/ruby-agi/rs/stream_file.rb +138 -0
- data/lib/ruby-agi/rs/tdd_mode.rb +95 -0
- data/lib/ruby-agi/rs/verbose.rb +73 -0
- data/lib/ruby-agi/rs/wait_for_digit.rb +90 -0
- data/lib/ruby-agi/rs/wait_for_digits.rb +88 -0
- data/test/unit.rb +37 -0
- metadata +36 -6
@@ -0,0 +1,69 @@
|
|
1
|
+
#
|
2
|
+
# File: set_auto_hangup.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# class to handle return status of Command#set_auto_hangup
|
27
|
+
# Cause the channel to automatically hangup at <time> seconds in the future.
|
28
|
+
# Of course it can be hungup before then as well.
|
29
|
+
# Setting to 0 will cause the autohangup feature to be disabled on this channel.
|
30
|
+
#
|
31
|
+
# Command Reference: SET AUTOHANGUP <time>
|
32
|
+
#
|
33
|
+
# 200 result=0
|
34
|
+
#
|
35
|
+
|
36
|
+
class ReturnStatus
|
37
|
+
end
|
38
|
+
|
39
|
+
class SetAutoHangup < ReturnStatus
|
40
|
+
|
41
|
+
def initialize(command, response)
|
42
|
+
super(command, response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def success?
|
46
|
+
if @is_success.nil?
|
47
|
+
if result == '0'
|
48
|
+
@is_success = true
|
49
|
+
else
|
50
|
+
@is_success = false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
return @is_success
|
55
|
+
end
|
56
|
+
|
57
|
+
def failure?
|
58
|
+
return (not success?)
|
59
|
+
end
|
60
|
+
|
61
|
+
def error?
|
62
|
+
return command_error?
|
63
|
+
end
|
64
|
+
|
65
|
+
def response
|
66
|
+
return message
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#
|
2
|
+
# File: set_caller_id.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# Changes the callerid of the current channel.
|
27
|
+
#
|
28
|
+
# <b>Parameters</b>
|
29
|
+
# - number : number to be set a callerid
|
30
|
+
#
|
31
|
+
# <b>Returns</b>
|
32
|
+
# - ReturnStatus (object)
|
33
|
+
#
|
34
|
+
# 200 result=1
|
35
|
+
#
|
36
|
+
# Command Reference: SET CALLERID <number>
|
37
|
+
#
|
38
|
+
|
39
|
+
class ReturnStatus
|
40
|
+
end
|
41
|
+
|
42
|
+
class SetCallerID < ReturnStatus
|
43
|
+
|
44
|
+
def initialize(command, response)
|
45
|
+
super(command, response)
|
46
|
+
end
|
47
|
+
|
48
|
+
def success?
|
49
|
+
if @is_success.nil?
|
50
|
+
if result == '1'
|
51
|
+
@is_success = true
|
52
|
+
else
|
53
|
+
@is_success = false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
return @is_success
|
58
|
+
end
|
59
|
+
|
60
|
+
def failure?
|
61
|
+
return (not failure?)
|
62
|
+
end
|
63
|
+
|
64
|
+
def error?
|
65
|
+
return command_error?
|
66
|
+
end
|
67
|
+
|
68
|
+
def response
|
69
|
+
return message
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
# File: set_context.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# Sets the context for continuation upon exiting the application.
|
27
|
+
#
|
28
|
+
# Command Reference: SET CONTEXT <desired context>
|
29
|
+
#
|
30
|
+
# - context : name of the context
|
31
|
+
#
|
32
|
+
# 200 result=0
|
33
|
+
# Note: no checking is done to verify that the context is valid.
|
34
|
+
# Specifying an invalid context will cause the call to drop
|
35
|
+
#
|
36
|
+
|
37
|
+
|
38
|
+
class ReturnStatus
|
39
|
+
end
|
40
|
+
|
41
|
+
class SetContext < ReturnStatus
|
42
|
+
|
43
|
+
def initialize(command, response)
|
44
|
+
super(command, response)
|
45
|
+
end
|
46
|
+
|
47
|
+
def success?
|
48
|
+
if @is_success.nil?
|
49
|
+
if result == '0'
|
50
|
+
@is_success = true
|
51
|
+
else
|
52
|
+
@is_success = false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
return @is_success
|
57
|
+
end
|
58
|
+
|
59
|
+
def failure?
|
60
|
+
return (not failure?)
|
61
|
+
end
|
62
|
+
|
63
|
+
def error?
|
64
|
+
return command_error?
|
65
|
+
end
|
66
|
+
|
67
|
+
def response
|
68
|
+
return message
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#
|
2
|
+
# File: set_extension.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# Changes the extension for continuation upon exiting the application.
|
27
|
+
#
|
28
|
+
# Command Reference: SET EXTENSION <new extension>
|
29
|
+
#
|
30
|
+
# - extension: name or number of extension to be set
|
31
|
+
#
|
32
|
+
# 200 result=0
|
33
|
+
# Note: no checking is done to verify that the extension extists.
|
34
|
+
# If the extension does not exist, the PBX will attempt to move to the "i" (invalid) extension.
|
35
|
+
# If the invalid "i" extension does not exist, the call will drop
|
36
|
+
#
|
37
|
+
|
38
|
+
|
39
|
+
class ReturnStatus
|
40
|
+
end
|
41
|
+
|
42
|
+
class SetExtension < ReturnStatus
|
43
|
+
|
44
|
+
def initialize(command, response)
|
45
|
+
super(command, response)
|
46
|
+
end
|
47
|
+
|
48
|
+
def success?
|
49
|
+
if @is_success.nil?
|
50
|
+
if result == '0'
|
51
|
+
@is_success = true
|
52
|
+
else
|
53
|
+
@is_success = false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
return @is_success
|
58
|
+
end
|
59
|
+
|
60
|
+
def failure?
|
61
|
+
return (not failure?)
|
62
|
+
end
|
63
|
+
|
64
|
+
def error?
|
65
|
+
return command_error?
|
66
|
+
end
|
67
|
+
|
68
|
+
def response
|
69
|
+
return message
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
# File: set_music.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# Enables/Disables the music on hold generator.
|
27
|
+
#
|
28
|
+
# Command Reference: SET MUSIC <on|off> <class>
|
29
|
+
#
|
30
|
+
# - mode : on or off
|
31
|
+
# - moh_class : name of the music on hold class
|
32
|
+
# 'default' for not provided or nil
|
33
|
+
#
|
34
|
+
# 200 result=0
|
35
|
+
#
|
36
|
+
|
37
|
+
|
38
|
+
class ReturnStatus
|
39
|
+
end
|
40
|
+
|
41
|
+
class SetMusic < ReturnStatus
|
42
|
+
|
43
|
+
def initialize(command, response)
|
44
|
+
super(command, response)
|
45
|
+
end
|
46
|
+
|
47
|
+
def success?
|
48
|
+
if @is_success.nil?
|
49
|
+
if result == '0'
|
50
|
+
@is_success = true
|
51
|
+
else
|
52
|
+
@is_success = false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
return @is_success
|
57
|
+
end
|
58
|
+
|
59
|
+
def failure?
|
60
|
+
return (not failure?)
|
61
|
+
end
|
62
|
+
|
63
|
+
def error?
|
64
|
+
return command_error?
|
65
|
+
end
|
66
|
+
|
67
|
+
def response
|
68
|
+
return message
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#
|
2
|
+
# File: set_priority.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# Changes the priority for continuation upon exiting the application.
|
27
|
+
#
|
28
|
+
# Command Reference: SET PRIORITY <num>
|
29
|
+
#
|
30
|
+
# - priority : number of priority
|
31
|
+
#
|
32
|
+
# 200 result=0
|
33
|
+
#
|
34
|
+
|
35
|
+
|
36
|
+
class ReturnStatus
|
37
|
+
end
|
38
|
+
|
39
|
+
class SetPriority < ReturnStatus
|
40
|
+
|
41
|
+
def initialize(command, response)
|
42
|
+
super(command, response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def success?
|
46
|
+
if @is_success.nil?
|
47
|
+
if result == '0'
|
48
|
+
@is_success = true
|
49
|
+
else
|
50
|
+
@is_success = false
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
return @is_success
|
55
|
+
end
|
56
|
+
|
57
|
+
def failure?
|
58
|
+
return (not failure?)
|
59
|
+
end
|
60
|
+
|
61
|
+
def error?
|
62
|
+
return command_error?
|
63
|
+
end
|
64
|
+
|
65
|
+
def response
|
66
|
+
return message
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# File: set_variable.rb
|
3
|
+
#
|
4
|
+
# ruby-agi: Ruby Language API for Asterisk
|
5
|
+
#
|
6
|
+
# Copyright (C) <2006> 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
|
+
require 'ruby-agi/rs/return_status'
|
24
|
+
|
25
|
+
#
|
26
|
+
# set variable: Sets a channel variable
|
27
|
+
# These variables live in the channel Asterisk creates
|
28
|
+
# when you pickup a phone and as such they are both local
|
29
|
+
# and temporary. Variables created in one channel can not
|
30
|
+
# be accessed by another channel. When you hang up the phone,
|
31
|
+
# the channel is deleted and any variables in that channel are deleted as well.
|
32
|
+
#
|
33
|
+
# Command Reference: SET VARIABLE <variablename> <value>
|
34
|
+
#
|
35
|
+
# - variablename : name of the variable
|
36
|
+
# - value : value to be set for the variable
|
37
|
+
#
|
38
|
+
#
|
39
|
+
# 200 result=1
|
40
|
+
#
|
41
|
+
|
42
|
+
|
43
|
+
class ReturnStatus
|
44
|
+
end
|
45
|
+
|
46
|
+
class SetVariable < ReturnStatus
|
47
|
+
|
48
|
+
def initialize(command, response)
|
49
|
+
super(command, response)
|
50
|
+
end
|
51
|
+
|
52
|
+
def success?
|
53
|
+
if @is_success.nil?
|
54
|
+
if result == '1'
|
55
|
+
@is_success = true
|
56
|
+
else
|
57
|
+
@is_success = false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
return @is_success
|
62
|
+
end
|
63
|
+
|
64
|
+
def failure?
|
65
|
+
return (not failure?)
|
66
|
+
end
|
67
|
+
|
68
|
+
def error?
|
69
|
+
return command_error?
|
70
|
+
end
|
71
|
+
|
72
|
+
def response
|
73
|
+
return message
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|