Class: Adhearsion::Asterisk::ConfigGenerator::Queues::QueueDefinition
Constant Summary
collapse
- DEFAULT_QUEUE_PROPERTIES =
{
:autofill => 'yes',
:eventwhencalled => 'vars',
:eventmemberstatus => 'yes',
:setinterfacevar => 'yes'
}
- SUPPORTED_RING_STRATEGIES =
[:ringall, :roundrobin, :leastrecent, :fewestcalls, :random, :rrmemory]
- DEFAULT_SOUND_FILES =
{
'queue-youarenext' => 'queue-youarenext',
'queue-thereare' => 'queue-thereare',
'queue-callswaiting' => 'queue-callswaiting',
'queue-holdtime' => 'queue-holdtime',
'queue-minutes' => 'queue-minutes',
'queue-seconds' => 'queue-seconds',
'queue-thankyou' => 'queue-thankyou',
'queue-lessthan' => 'queue-less-than',
'queue-reporthold' => 'queue-reporthold',
'periodic-announce' => 'queue-periodic-announce'
}
- SOUND_FILE_SYMBOL_INTERPRETATIONS =
{
:you_are_next => 'queue-youarenext',
:there_are => 'queue-thereare',
:calls_waiting => 'queue-callswaiting',
:hold_time => 'queue-holdtime',
:minutes => 'queue-minutes',
:seconds => 'queue-seconds',
:thank_you => 'queue-thankyou',
:less_than => 'queue-lessthan',
:report_hold => 'queue-reporthold',
:periodic_announcement => 'periodic-announce'
}
SECTION_TITLE
Instance Attribute Summary collapse
Instance Method Summary
collapse
create_sanitary_hash_from, #to_sanitary_hash, warning_message
Constructor Details
Returns a new instance of QueueDefinition.
86
87
88
89
90
91
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 86
def initialize(name)
@name = name
@members = []
@properties = DEFAULT_QUEUE_PROPERTIES.clone
@sound_files = DEFAULT_SOUND_FILES.clone
end
|
Instance Attribute Details
#members ⇒ Object
Returns the value of attribute members.
85
86
87
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 85
def members
@members
end
|
#name ⇒ Object
Returns the value of attribute name.
85
86
87
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 85
def name
@name
end
|
#properties ⇒ Object
Returns the value of attribute properties.
85
86
87
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 85
def properties
@properties
end
|
Instance Method Details
#announce_hold_time(seconds) ⇒ Object
165
166
167
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 165
def announce_hold_time(seconds)
one_of [true, false, :once], "announce-holdtime" => seconds
end
|
#announce_round_seconds(yes_no_or_once) ⇒ Object
169
170
171
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 169
def announce_round_seconds(yes_no_or_once)
int "announce-round-seconds" => yes_no_or_once
end
|
#autopause(yes_no) ⇒ Object
146
147
148
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 146
def autopause(yes_no)
boolean :autopause => yes_no
end
|
#delay_connection_by(seconds) ⇒ Object
Number of seconds to wait when an agent is to be bridged with a caller. Normally you’d want this to be zero.
202
203
204
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 202
def delay_connection_by(seconds)
int :memberdelay => seconds
end
|
#exit_to_context_on_digit_press(context_name) ⇒ Object
A context may be specified, in which if the user types a SINGLE digit extension while they are in the queue, they will be taken out of the queue and sent to that extension in this context. This context should obviously be a different context other than the one that normally forwards to Adhearsion (though the context that handles these digits should probably go out to Adhearsion too).
121
122
123
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 121
def exit_to_context_on_digit_press(context_name)
string :context => context_name
end
|
#join_empty(yes_no_or_strict) ⇒ Object
Ex: join_empty true Ex: join_empty :strict
184
185
186
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 184
def join_empty(yes_no_or_strict)
one_of [true, false, :strict], :joinempty => yes_no_or_strict
end
|
#leave_when_empty(yes_no) ⇒ Object
188
189
190
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 188
def leave_when_empty(yes_no)
boolean :leavewhenempty => yes_no
end
|
#maximum_length(number) ⇒ Object
150
151
152
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 150
def maximum_length(number)
int :maxlen => number
end
|
#member(driver) ⇒ Object
238
239
240
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 238
def member(driver)
members << (driver.kind_of?(String) && driver =~ %r'/' ? driver : "Agent/#{driver}")
end
|
173
174
175
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 173
def monitor_format(symbol)
one_of [:wav, :gsm, :wav49], 'monitor-format' => symbol
end
|
#monitor_type(symbol) ⇒ Object
177
178
179
180
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 177
def monitor_type(symbol)
criteria = {:monitor => "Monitor", :mix_monitor => "MixMonitor"}
one_of_and_translate criteria, 'monitor-type' => symbol
end
|
#music_class(moh_identifier) ⇒ Object
99
100
101
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 99
def music_class(moh_identifier)
string :musicclass => moh_identifier
end
|
#periodically_announce(sound_file, options = {}) ⇒ Object
158
159
160
161
162
163
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 158
def periodically_announce(sound_file, options={})
frequency = options.delete(:every) || 1.minute
string 'periodic-announce' => sound_file
int 'periodic-announce-frequency' => frequency
end
|
#play_on_connect(sound_file) ⇒ Object
103
104
105
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 103
def play_on_connect(sound_file)
string :announce => sound_file
end
|
#queue_status_announce_frequency(seconds) ⇒ Object
154
155
156
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 154
def queue_status_announce_frequency(seconds)
int "announce-frequency" => seconds
end
|
#report_hold_time(yes_no) ⇒ Object
192
193
194
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 192
def report_hold_time(yes_no)
boolean :reportholdtime => yes_no
end
|
#retry_after_waiting(seconds) ⇒ Object
Ex: retry_after_waiting 5.seconds
131
132
133
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 131
def retry_after_waiting(seconds)
int :retry => seconds
end
|
#ring_in_use(yes_no) ⇒ Object
196
197
198
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 196
def ring_in_use(yes_no)
boolean :ringinuse => yes_no
end
|
#ring_timeout(seconds) ⇒ Object
Ex: ring_timeout 15.seconds
126
127
128
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 126
def ring_timeout(seconds)
int :timeout => seconds
end
|
#service_level(seconds) ⇒ Object
111
112
113
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 111
def service_level(seconds)
int :servicelevel => seconds
end
|
#sound_files(hash_of_files) ⇒ Object
Give a Hash argument here to override the default sound files for this queue.
Usage:
queue.sound_files :you_are_next => 'queue-youarenext',
:there_are => 'queue-thereare',
:calls_waiting => 'queue-callswaiting',
:hold_time => 'queue-holdtime',
:minutes => 'queue-minutes',
:seconds => 'queue-seconds',
:thank_you => 'queue-thankyou',
:less_than => 'queue-less-than',
:report_hold => 'queue-reporthold',
:periodic_announcement => 'queue-periodic-announce'
Note: the Hash values are the defaults. You only need to specify the ones you wish to override.
#strategy(symbol) ⇒ Object
107
108
109
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 107
def strategy(symbol)
one_of SUPPORTED_RING_STRATEGIES, :strategy => symbol
end
|
#timeout_restart(yes_no) ⇒ Object
206
207
208
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 206
def timeout_restart(yes_no)
boolean :timeoutrestart => yes_no
end
|
#to_s ⇒ Object
93
94
95
96
97
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 93
def to_s
"[#{name}]\n" +
properties.merge(@sound_files).map { |key, value| "#{key}=#{value}" }.sort.join("\n") + "\n\n" +
members.map { |member| "member => #{member}" }.join("\n")
end
|
#weight(number) ⇒ Object
136
137
138
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 136
def weight(number)
int :weight => number
end
|
#wrapup_time(seconds) ⇒ Object
141
142
143
|
# File 'lib/adhearsion/asterisk/config_generator/queues.rb', line 141
def wrapup_time(seconds)
int :wrapuptime => seconds
end
|