summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/asterisk-xip/files/uci
diff options
context:
space:
mode:
authorMichael Geddes <openwrt@frog.wheelycreek.net>2009-01-27 02:28:35 +0000
committerMichael Geddes <openwrt@frog.wheelycreek.net>2009-01-27 02:28:35 +0000
commit61146aee6ce9ee00aee80fbe3f87acf277066131 (patch)
tree643052785e3a7a1b3bfa9fe7ab4d6a41486960b8 /contrib/package/asterisk-xip/files/uci
parentf0fef5eb5a49a385a3ffc2c52d43a1e0230ec10c (diff)
Support for Call queues
Diffstat (limited to 'contrib/package/asterisk-xip/files/uci')
-rw-r--r--contrib/package/asterisk-xip/files/uci/queueconf133
-rw-r--r--contrib/package/asterisk-xip/files/uci/queueconf.txt30
2 files changed, 163 insertions, 0 deletions
diff --git a/contrib/package/asterisk-xip/files/uci/queueconf b/contrib/package/asterisk-xip/files/uci/queueconf
new file mode 100644
index 0000000000..2ac8296d60
--- /dev/null
+++ b/contrib/package/asterisk-xip/files/uci/queueconf
@@ -0,0 +1,133 @@
+#!/bin/bash
+# Queues.conf
+
+ast_add_conf queue
+
+init_queueconf() {
+ ast_add_reload queue
+
+ ast_enable_type callqueue
+ ast_enable_type callqueuegeneral
+}
+
+create_queueconf() {
+ # Construct the file
+ file=${DEST_DIR}/queues.conf
+ get_checksum queue_conf $file
+ local isempty=1
+ logdebug 0 "Generating Queues.conf: ${callqueue_contexts}"
+ if [ -z "${callqueue_contexts}" ] ; then
+ isempty=2
+ rm -f $file
+ else
+ logdebug 0 "General section"
+ echo "${asteriskuci_gen}[general]" > "$file"
+ [ -z "${callqueue_gen_autofill}" ] && callqueue_gen_autofill=yes
+ for i in ${callqueuegeneral_list} ; do
+ local opt=${i//-/}
+ eval "local val=\"\${callqueue_gen_${opt}}\""
+ [ -z "${val}" ] || echo "${i}=${val}" >> "$file"
+ done
+
+ logdebug 0 "Add queues"
+ for i in ${callqueue_contexts} ; do
+ eval "local queuename=\${callqueue_opt_${i}_name}"
+ logdebug 0 "Add queue ${queuename}"
+ echo "${N}[${queuename}]" >> "$file"
+ local queueopts=
+ local has_moh=0
+ for j in ${callqueue_list} ; do
+ local opt=${j//-/}
+ eval "local val=\"\${callqueue_opt_${i}_${opt}}\""
+ if [ ! -z "${val}" ]; then
+ echo "${j}=${val}" >> "$file"
+ case "${opt}" in
+ musicclass) has_moh=1
+ esac
+ fi
+ done
+
+ eval "local memberlist=\"\${callqueue_opt_${i}_members}\""
+ for j in ${memberlist} ; do
+ echo "member => ${j}" >> "$file"
+ done
+
+ [ "${has_moh}" = 0 ] && queueopts=${queueopts}r
+ eval "local queuetimeout=\"\${callqueue_opt_${i}_queuetimeout}\""
+ if [ "${queuetimeout-0}" = 0 ] ; then
+ queuetimeout=
+ else
+ queueopts=${queueopts}n
+ fi
+
+ # Now add call dialplan
+ if check_add_context "${i}" ; then
+ append_dialplan_context "${i}" "exten = ${match_all_s},1,Queue(${queuename}|${queueopts}|||${queuetimeout})"
+ #TODO Add voicemail? fallthrough option?
+ fi
+
+ done
+ fi
+
+ check_checksum "$queue_conf" "$file" || ast_queue_restart=$isempty
+}
+
+reload_queue() astcmd "module reload app_queue.so"
+unload_queue() astcmd "module unload app_queue.so"
+
+
+callqueuegeneral_list="persistentmembers autofill monitor-type"
+valid_callqueuegeneral() {
+ is_in_list $1 ${callqueuegeneral_list//-/}
+ return $?
+}
+
+handle_callqueue_general() {
+ option_cb() {
+ if valid_callqueuegeneral "$1" ; then
+ eval "callqueue_gen_$1=\"\${2}\""
+ else
+ [ "${1:0:1}" = "_" ] || logerror "Invalid callqueuegeneral option: $1"
+ fi
+ }
+}
+
+callqueue_list="musicclass announce strategy context timeout wrapuptime \
+autofill maxlen announce-holdtime announce-frequency periodic-announce-frequency ringinuse"
+
+valid_callqueue() {
+ is_in_list $1 ${callqueue_list//-/} queuetimeout
+ return $?
+}
+
+handle_callqueue() {
+ cur_context="$1"
+ callqueue_opt_name="$1" # Name in queue.conf
+ [ -z "${callqueue_contexts}" ] && enable_module app_queue
+ append "callqueue_contexts" "$1" " "
+
+ option_cb() {
+ case "$1" in
+ name) eval "callqueue_opt_${cur_context}_name=\"\$2\"" ;;
+ member|member_ITEM*)
+ local member_type=
+ local member_ext=
+ if ! split_targettype member_type member_ext "${2}" ; then
+ logerror "No extension type specified for queue ${cur_context} member ${2}"
+ else
+ append callqueue_opt_${cur_context}_members "${member_type}/${member_ext}" " "
+ fi
+ ;;
+ member_LENGTH) ;;
+ _*) ;; # ignore
+ *)
+ if valid_callqueue "$1" ; then
+ eval "callqueue_opt_${cur_context}_$1=\"\${2}\""
+ else
+ logerror "Invalid callqueue option: $1"
+ fi ;;
+ esac
+ }
+}
+
+
diff --git a/contrib/package/asterisk-xip/files/uci/queueconf.txt b/contrib/package/asterisk-xip/files/uci/queueconf.txt
new file mode 100644
index 0000000000..9bc39f3847
--- /dev/null
+++ b/contrib/package/asterisk-xip/files/uci/queueconf.txt
@@ -0,0 +1,30 @@
+callqueuegeneral
+persistentmembers = yes
+autofill = yes - Probably set this on.
+monitortype = MixMonitor
+
+callqueue {context}
+ name - queue name (default to same as context)
+ queuetimeout - Timeout of the queue
+ member (list) - list of members.
+ musicclass - Class of moh to use (or blank for ringing)
+ announce = queue-markq (announce to agent)
+ strategy -
+ ringall - ring all available channels until one answers (default)
+ roundrobin - take turns ringing each available interface
+ leastrecent - ring interface which was least recently called by this queue
+ fewestcalls - ring the one with fewest completed calls from this queue
+ random - ring random interface
+ rrmemory - round robin with memory, remember where we left off last ring pass
+
+ context = qoutcon (single digit numbers)
+ timeout = 15 - Ringing timeout
+ wrapuptime=15 - time allowed after hangup of call
+ autofill=yes - Probably set this on.
+ maxlen = 0 - Maximum queue length (0 for unlimited)
+ announceholdtime = yes|no|once ; Should we include estimated hold time in position announcements?
+ announcefrequency - How often to announce queue position and/or estimated
+ ;periodicannounce-frequency=60
+ ; ringinuse = no ; ring if known to be in use
+
+ ;member => Zap/1