├── static └── .gitkeep ├── .eslintignore ├── .travis.yml ├── .codecov.yml ├── screenshot.png ├── src ├── assets │ └── logo.png ├── store │ ├── caller-state.js │ ├── index.js │ ├── class.amiserver.js │ ├── class.caller.js │ ├── mutation-types.js │ ├── getters.js │ ├── class.queue.js │ ├── class.member.js │ ├── actions.js │ └── mutations.js ├── main.js ├── filters.js ├── websock │ └── index.js ├── components │ ├── AmiServers.vue │ ├── MenuPanel.vue │ ├── TopStats.vue │ ├── QueueData.vue │ └── QueuesList.vue └── App.vue ├── test ├── unit │ ├── .eslintrc │ ├── index.js │ ├── karma.conf.js │ └── specs │ │ ├── fixtures │ │ ├── AmiServers.js │ │ ├── MenuPanel.js │ │ ├── QueueData.js │ │ ├── QueueList.js │ │ └── TopStats.js │ │ ├── AmiServers.spec.js │ │ ├── MenuPanel.spec.js │ │ ├── TopStats.spec.js │ │ ├── QueuesList.spec.js │ │ └── QueueData.spec.js └── e2e │ ├── specs │ └── test.js │ ├── custom-assertions │ └── elementCount.js │ ├── runner.js │ └── nightwatch.conf.js ├── config ├── prod.env.js ├── test.env.js ├── dev.env.js └── index.js ├── .editorconfig ├── .postcssrc.js ├── .gitignore ├── index.html ├── .babelrc ├── .eslintrc.js ├── README.md ├── package.json └── COPYING /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "8" 4 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | token: 09971104-b84b-4d9a-b612-e3d00db8d549 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staskobzar/amiws_queue/HEAD/screenshot.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/staskobzar/amiws_queue/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /src/store/caller-state.js: -------------------------------------------------------------------------------- 1 | export const UNKNOWN = 0 2 | export const JOINED = 1 3 | export const ANSWERED = 2 4 | export const ABANDONED = 3 5 | -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"', 4 | VER: '"1.0.0"', 5 | WS_URL: process.env.WS_URL || '"ws://0.0.0.0:8000"', 6 | } 7 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | test/unit/coverage 8 | test/e2e/reports 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Asterisk Queues Realtime Dashboard 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import Vuetify from 'vuetify' 5 | 6 | import 'vuetify/dist/vuetify.min.css' 7 | import App from './App' 8 | import WebSock from './websock' 9 | import store from './store' 10 | import './filters' 11 | 12 | Vue.config.productionTip = false 13 | 14 | Vue.use(Vuetify) 15 | Vue.use(WebSock, store) 16 | 17 | /* eslint-disable no-new */ 18 | new Vue({ 19 | el: '#app', 20 | template: '', 21 | store, 22 | components: { App } 23 | }) 24 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | import getters from './getters.js' 5 | import mutations from './mutations.js' 6 | import actions from './actions.js' 7 | 8 | Vue.use(Vuex) 9 | 10 | const state = { 11 | ws_connected: true, 12 | showError: false, 13 | errorResponse: '', 14 | servers: [], 15 | queues: [], 16 | selectedQueue: '', 17 | selectedServers: [], 18 | dragMember: null, 19 | qnameFilter: '', 20 | pagination: { 21 | perPage: 9, 22 | currentPage: 1 23 | } 24 | } 25 | 26 | export default new Vuex.Store({ 27 | state, 28 | actions, 29 | mutations, 30 | getters 31 | }) 32 | -------------------------------------------------------------------------------- /test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | 'rules': { 20 | // allow paren-less arrow functions 21 | 'arrow-parens': 0, 22 | // allow async-await 23 | 'generator-star-spacing': 0, 24 | // allow debugger during development 25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/filters.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | /** 3 | * Convert seconds to human readable format HH:MM:SS 4 | */ 5 | Vue.filter('formatTime', (val) => { 6 | return [ 7 | Math.floor(val / 3600), // hours 8 | Math.floor(val / 60) % 60, // minutes 9 | val % 60 // seconds 10 | ].map(e => e >= 10 ? `${e}` : `0${e}`).join(':') 11 | }) 12 | 13 | Vue.filter('formatFromUnixtime', (val) => { 14 | if (+val <= 0) { 15 | return 'N/A' 16 | } 17 | const t = new Date(val * 1000) 18 | const pad = (num) => num < 10 ? `0${num}` : `${num}` 19 | const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()] 20 | const [hh, mm, ss] = [t.getHours(), t.getMinutes(), t.getSeconds()] 21 | const date = `${y}-${pad(m + 1)}-${pad(d)}` 22 | const time = `${pad(hh)}:${pad(mm)}:${pad(ss)}` 23 | return `${date} ${time}` 24 | }) 25 | -------------------------------------------------------------------------------- /src/store/class.amiserver.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | id = null 3 | name = null 4 | ssl = false 5 | reloaded = null 6 | started = null 7 | 8 | constructor (msg) { 9 | this.id = msg.server_id 10 | this.name = msg.server_name 11 | this.ssl = msg.ssl 12 | this.reloaded = this._reloadedDate(msg.data) 13 | this.started = this._startedDate(msg.data) 14 | } 15 | 16 | matchId (id) { 17 | return id === this.id 18 | } 19 | 20 | update (msg) { 21 | this.reloaded = this._reloadedDate(msg.data) 22 | this.started = this._startedDate(msg.data) 23 | } 24 | 25 | _reloadedDate (data) { 26 | return new Date(`${data.CoreReloadDate} ${data.CoreReloadTime}`) 27 | } 28 | 29 | _startedDate (data) { 30 | return new Date(`${data.CoreStartupDate} ${data.CoreStartupTime}`) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src', true, /^\.\/(?!(main(\.js)?|websock.*|logger(\.js)?|App(\.vue)?)$)/) 13 | // console.log(srcContext.keys()) 14 | srcContext.keys().forEach(srcContext) 15 | 16 | /* 17 | * make Vuetify app element to avoid warnings 18 | */ 19 | var app = document.createElement('div') 20 | app.setAttribute('data-app', true) 21 | document.body.appendChild(app) 22 | // -- done 23 | -------------------------------------------------------------------------------- /src/store/class.caller.js: -------------------------------------------------------------------------------- 1 | import * as cstate from './caller-state' 2 | 3 | export default class { 4 | position = null 5 | status = null 6 | chan = null 7 | uid = null 8 | clidNum = null 9 | clidName = null 10 | lineNum = null 11 | lineName = null 12 | wait = 0 13 | incall = false 14 | _waitInterval = null 15 | answerTime = 0 16 | 17 | constructor (msg) { 18 | const data = msg.data 19 | this.position = +data.Position 20 | this.status = data.Event === 'Join' ? cstate.JOINED : cstate.ANSWERED 21 | this.chan = data.Channel 22 | this.uid = data.Uniqueid 23 | this.clidNum = data.CallerIDNum 24 | this.clidName = data.CallerIDName 25 | this.lineNum = data.ConnectedLineNum 26 | this.lineName = data.ConnectedLineName 27 | if (data.Wait) this.wait = +data.Wait 28 | this._waitInterval = setInterval(() => this.wait++, 1000) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../build/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'json', subdir: '.'}, 30 | { type: 'text-summary' } 31 | ] 32 | } 33 | }) 34 | } 35 | -------------------------------------------------------------------------------- /test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | server.ready.then(() => { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/store/mutation-types.js: -------------------------------------------------------------------------------- 1 | export const WS_CONNECTED = 'WS_CONNECTED' 2 | 3 | export const ERROR_MSG = 'ERROR_MSG' 4 | 5 | export const NEW_AMI_SERVER = 'NEW_AMI_SERVER' 6 | export const CLEAR_AMISRV_LIST = 'CLEAR_AMISRV_LIST' 7 | 8 | export const ADD_QUEUE = 'ADD_QUEUE' 9 | export const UPDATE_QUEUE_SUMMARY = 'UPDATE_QUEUE_SUMMARY' 10 | 11 | export const ADD_QUEUE_MEMBER = 'ADD_QUEUE_MEMBER' 12 | export const REMOVE_QUEUE_MEMBER = 'REMOVE_QUEUE_MEMBER' 13 | export const PAUSE_QUEUE_MEMBER = 'PAUSE_QUEUE_MEMBER' 14 | export const UPDATE_QUEUE_MEMBER_PAUSE = 'UPDATE_QUEUE_MEMBER_PAUSE' 15 | export const UPDATE_QUEUE_MEMBER_STATUS = 'UPDATE_QUEUE_MEMBER_STATUS' 16 | export const QUEUE_MEMBER_CONNECTED = 'QUEUE_MEMBER_CONNECTED' 17 | export const QUEUE_MEMBER_COMPLETE = 'QUEUE_MEMBER_COMPLETE' 18 | export const MEMBER_DRAG_START = 'MEMBER_DRAG_START' 19 | export const MEMBER_DRAG_STOP = 'MEMBER_DRAG_STOP' 20 | export const QUEUE_ADD_MEMBER = 'QUEUE_ADD_MEMBER' 21 | export const QUEUE_REMOVE_MEMBER = 'QUEUE_REMOVE_MEMBER' 22 | 23 | export const ADD_QUEUE_CALLER = 'ADD_QUEUE_CALLER' 24 | export const LEAVE_QUEUE_CALLER = 'LEAVE_QUEUE_CALLER' 25 | export const ABANDON_QUEUE_CALLER = 'ABANDON_QUEUE_CALLER' 26 | export const CLEAR_QUEUES_LIST = 'CLEAR_QUEUES_LIST' 27 | export const SET_SELECTED_QUEUE = 'SET_SELECTED_QUEUE' 28 | -------------------------------------------------------------------------------- /src/websock/index.js: -------------------------------------------------------------------------------- 1 | const WS = {} 2 | WS.sock = null 3 | WS.store = null 4 | 5 | WS.install = function (Vue, store) { 6 | this.sock = new WebSocket(process.env.WS_URL) 7 | this.store = store 8 | 9 | this.sock.onopen = () => { 10 | store.commit('WS_CONNECTED', true) 11 | /* 12 | * We need Action: Queue here because it helps to load realtime 13 | * queues. Otherwise, Asterisk will not get realtime queues after 14 | * restart with Action: QueueStatus only. 15 | */ 16 | this.sock.send(JSON.stringify({ Action: 'Queues' })) 17 | this.sock.send(JSON.stringify({ Action: 'CoreStatus' })) 18 | this.sock.send(JSON.stringify({ Action: 'QueueStatus' })) 19 | } 20 | 21 | this.sock.onmessage = (ev) => { 22 | this.store.dispatch('newMessage', ev.data) 23 | } 24 | 25 | this.sock.onclose = (ev) => { 26 | store.commit('WS_CONNECTED', false) 27 | setTimeout(() => { WS.install(Vue, this.store) }, 3000) 28 | } 29 | 30 | this.sock.onerror = (err) => { 31 | store.commit('ERROR_MSG', `Socket encountered error: ${err.message}. Closing socket`) 32 | this.sock.close() 33 | } 34 | 35 | // public method 36 | Vue.websockSend = (jsonMsg) => { 37 | this.sock.send(jsonMsg) 38 | } 39 | 40 | // instance methods 41 | Vue.prototype.$wsSend = function (msg) {} 42 | } 43 | 44 | export default WS 45 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict' 3 | // Template version: 1.1.3 4 | // see http://vuejs-templates.github.io/webpack for documentation. 5 | 6 | const path = require('path') 7 | 8 | module.exports = { 9 | build: { 10 | env: require('./prod.env'), 11 | index: path.resolve(__dirname, '../dist/index.html'), 12 | assetsRoot: path.resolve(__dirname, '../dist'), 13 | assetsSubDirectory: 'static', 14 | assetsPublicPath: '/', 15 | productionSourceMap: true, 16 | // Gzip off by default as many popular static hosts such as 17 | // Surge or Netlify already gzip all static assets for you. 18 | // Before setting to `true`, make sure to: 19 | // npm install --save-dev compression-webpack-plugin 20 | productionGzip: false, 21 | productionGzipExtensions: ['js', 'css'], 22 | // Run the build command with an extra argument to 23 | // View the bundle analyzer report after build finishes: 24 | // `npm run build --report` 25 | // Set to `true` or `false` to always turn it on or off 26 | bundleAnalyzerReport: process.env.npm_config_report 27 | }, 28 | dev: { 29 | env: require('./dev.env'), 30 | port: process.env.PORT || 8080, 31 | autoOpenBrowser: true, 32 | assetsSubDirectory: 'static', 33 | assetsPublicPath: '/', 34 | proxyTable: {}, 35 | // CSS Sourcemaps off by default because relative paths are "buggy" 36 | // with this option, according to the CSS-Loader README 37 | // (https://github.com/webpack/css-loader#sourcemaps) 38 | // In our experience, they generally work as expected, 39 | // just be aware of this issue when enabling this option. 40 | cssSourceMap: false 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/unit/specs/fixtures/AmiServers.js: -------------------------------------------------------------------------------- 1 | const Fixture = {} 2 | Fixture.oneServer = [ 3 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}` 4 | ] 5 | 6 | Fixture.threeServers = [ 7 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 8 | `{ "type": 4, "server_id": 2, "server_name": "asterisk02.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-02","CoreStartupTime": "12:43:57","CoreReloadDate": "2017-11-03","CoreReloadTime": "19:43:57","CoreCurrentCalls": "0"}}`, 9 | `{ "type": 4, "server_id": 3, "server_name": "asterisk03.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-12-02","CoreStartupTime": "12:43:57","CoreReloadDate": "2017-12-03","CoreReloadTime": "19:43:57","CoreCurrentCalls": "0"}}` 10 | ] 11 | 12 | Fixture.oneSrvWithTwoQueues = [ 13 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 14 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 15 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesDep","Max": "8","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 16 | ] 17 | 18 | export default Fixture 19 | -------------------------------------------------------------------------------- /test/unit/specs/fixtures/MenuPanel.js: -------------------------------------------------------------------------------- 1 | const Fixture = {} 2 | 3 | Fixture.sixQueues = [ 4 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 5 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 6 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesDep","Max": "8","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 7 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 8 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "Reception","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 9 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "HRDep","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 10 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "Shipping","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 11 | ] 12 | 13 | export default Fixture 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # amiws_queue 2 | [![Build Status](https://travis-ci.org/staskobzar/amiws_queue.svg?branch=master)](https://travis-ci.org/staskobzar/amiws_queue) 3 | [![codecov](https://codecov.io/gh/staskobzar/amiws_queue/branch/master/graph/badge.svg)](https://codecov.io/gh/staskobzar/amiws_queue) 4 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/8333ddee50b14cccbc8f56828ccc816a)](https://www.codacy.com/app/staskobzar/amiws_queue?utm_source=github.com&utm_medium=referral&utm_content=staskobzar/amiws_queue&utm_campaign=Badge_Grade) 5 | ![GPL](https://img.shields.io/badge/license-GPL_3-green.svg "License") 6 | 7 | >[!WARNING] 8 | >This project is outdated and I do not have time to support it so you can use it on your own risk. 9 | >vuejs used in the project is very old and probably will not work with new node versions 10 | 11 | > Asterisk Queues Realtime Manager 12 | 13 | Web realtime dashboard for Asterisk Queues. It is using another project, [amiws](https://github.com/staskobzar/amiws), as a Back-End for AMI traffic to web-socket conversion. More [screenshots here](https://staskobzar.blogspot.ca/2017/12/asterisk-queues-realtime-dashboard-with.html). 14 | 15 | ![amiws_queue screenshot](https://github.com/staskobzar/amiws_queue/blob/master/screenshot.png) 16 | 17 | ## Build Setup 18 | 19 | Refere to [amiws](https://github.com/staskobzar/amiws) documentation to learn how to install and setup Back-End. 20 | 21 | This project uses VueJS with webpack and it requires NodeJS. Setup and build it as following: 22 | ```bash 23 | git clone https://github.com/staskobzar/amiws_queue.git 24 | cd amiws_queue 25 | npm install 26 | WS_URL="'ws://10.20.30.01:8000'" npm run build 27 | ``` 28 | 29 | Use an IP and port of the server where amiws is running when defining shell variable ```WS_URL```. 30 | Note, when defining WS_URL usage of double and single quotes : _"'ws://IPADDR:PORT'"_. 31 | 32 | After successful build files are stored in "dist" folder. Simply copy files from "dist" folder to the server with "amiws" Back-End, 33 | to the folder defined in parameter "web_root" of "amiws" config file. 34 | 35 | ## Asterisk configuration 36 | 37 | This dashboard was tested with Asterisk 11 and 13. Should work with other versions too (AMI v2 and before). 38 | Asterisk queues additional events MUST be enabled per queue. 39 | 40 | In configuration file (Asterisk version older 12): 41 | ``` 42 | eventmemberstatus = yes 43 | eventwhencalled = yes 44 | ``` 45 | 46 | When using realtime with DB this values must equal "1": ``` eventmemberstatus = 1, eventwhencalled = 1 ``` 47 | 48 | -------------------------------------------------------------------------------- /src/components/AmiServers.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 80 | 81 | 82 | 85 | -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | export default { 2 | wsDisconnected: state => !state.ws_connected, 3 | showError: state => state.showError, 4 | getErrorResponse: state => state.errorResponse, 5 | getDragMember: state => state.dragMember, 6 | getAmiServers: state => state.servers, 7 | getAllQueues: state => state.queues, 8 | getSelectedServers: state => state.selectedServers, 9 | getQueueServerName: (state, getters) => (queue) => { 10 | return state.servers.find(s => s.id === queue.sid).name 11 | }, 12 | getQueuesFiltered: state => { 13 | const filter = state.qnameFilter.toLowerCase() 14 | const queues = state.queues.filter(q => state.selectedServers.includes(q.sid)) 15 | if (filter) { 16 | const re = new RegExp(filter, 'i') 17 | return queues.filter(q => q.name.match(re)) 18 | } else { 19 | return queues 20 | } 21 | }, 22 | getQueues: (state, getters) => { 23 | const per = state.pagination.perPage 24 | const page = state.pagination.currentPage 25 | return getters.getQueuesFiltered.slice((page - 1) * per, // begin 26 | page * per) // end 27 | }, 28 | getQueuesPerServer: (state, getters) => (sid) => { 29 | return state.queues.filter(q => q.sid === sid).length 30 | }, 31 | getTotalActiveCalls: (state, getters) => { 32 | return getters.getQueuesFiltered.map(e => e.members.filter(m => m.incall).length) 33 | .reduce((t, m) => t + m, 0) 34 | }, 35 | getTotalWaitingCalls: (state, getters) => { 36 | return getters.getQueuesFiltered.map(e => e.callers.length) 37 | .reduce((t, m) => t + m, 0) 38 | }, 39 | getTotalCompletedCalls: (state, getters) => { 40 | return getters.getQueuesFiltered.reduce((t, q) => t + q.completed, 0) 41 | }, 42 | getTotalAbandonedCalls: (state, getters) => { 43 | return getters.getQueuesFiltered.reduce((t, q) => t + q.abandoned, 0) 44 | }, 45 | getTotalPausedMembers: (state, getters) => { 46 | return getters.getQueuesFiltered.map(e => e.members.filter(m => m.paused).length) 47 | .reduce((t, m) => t + m, 0) 48 | }, 49 | getTotalUnpausedMembers: (state, getters) => { 50 | return getters.getQueuesFiltered.map(e => e.members.filter(m => !m.paused).length) 51 | .reduce((t, m) => t + m, 0) 52 | }, 53 | getSelectedMembers: state => { 54 | const queue = state.queues.find(q => q.name === state.selectedQueue) 55 | if (queue) { 56 | return queue.members 57 | } 58 | }, 59 | getSelectedCallers: state => { 60 | const queue = state.queues.find(q => q.name === state.selectedQueue) 61 | if (queue) { 62 | return queue.callers.sort((c1, c2) => c1.position > c2.position) 63 | } 64 | }, 65 | getSelectedQueue: state => state.selectedQueue, 66 | 67 | getQnameFilter: state => state.qnameFilter, 68 | getPerPage: state => state.pagination.perPage, 69 | getCurPage: state => state.pagination.currentPage 70 | } 71 | -------------------------------------------------------------------------------- /src/store/class.queue.js: -------------------------------------------------------------------------------- 1 | import Member from './class.member' 2 | import Caller from './class.caller' 3 | 4 | export default class { 5 | sid = null 6 | name = null 7 | max = 0 8 | strategy = null 9 | holdtime = 0 10 | talktime = 0 11 | completed = 0 12 | abandoned = 0 13 | SL = null 14 | SLPerf = null 15 | weight = 0 16 | members = [] 17 | callers = [] 18 | 19 | constructor (msg) { 20 | const data = msg.data 21 | this.sid = msg.server_id 22 | this.name = data.Queue 23 | this.max = +data.Max 24 | this.strategy = data.Strategy 25 | this.holdtime = +data.Holdtime 26 | this.talktime = +data.TalkTime 27 | this.completed = +data.Completed 28 | this.abandoned = +data.Abandoned 29 | this.SL = +data.ServiceLevel 30 | this.SLPerf = +data.ServicelevelPerf 31 | this.weight = +data.Weight 32 | } 33 | 34 | update (msg) { 35 | const data = msg.data 36 | this.holdtime = +data.Holdtime 37 | this.talktime = +data.TalkTime 38 | this.completed = +data.Completed 39 | this.adandoned = +data.Abandoned 40 | this.SL = +data.ServiceLevel 41 | this.SLPerf = +data.ServicelevelPerf 42 | this.weight = +data.Weight 43 | } 44 | 45 | match (msg) { 46 | return (msg.server_id === this.sid && msg.data.Queue === this.name) 47 | } 48 | 49 | findMember (iface) { 50 | return this.members.find(m => m.interface === iface) 51 | } 52 | 53 | _memberIndex (data) { 54 | const iface = data.StateInterface || data.Location 55 | const index = this.members.findIndex(m => m.name === data.MemberName && m.interface === iface) 56 | return index === -1 ? null : index 57 | } 58 | 59 | removeMember (msg) { 60 | const idx = this._memberIndex(msg.data) 61 | if (idx !== null) { 62 | this.members.splice(idx, 1) 63 | } 64 | } 65 | 66 | addMember (msg) { 67 | const member = this.findMember(msg.data.StateInterface) || this.findMember(msg.data.Location) 68 | if (member) { 69 | member.update(msg.data) 70 | } else { 71 | this.members.push(new Member(msg)) 72 | } 73 | } 74 | 75 | updateMember (msg) { 76 | const iface = msg.data.Interface || msg.data.StateInterface || msg.data.Member || msg.data.AgentCalled || msg.data.Location 77 | const member = this.findMember(iface) 78 | if (member) { 79 | member.update(msg.data) 80 | } 81 | } 82 | 83 | findCaller (data) { 84 | return this.callers.find(c => c.chan === data.Channel && c.uid === data.Uniqueid) 85 | } 86 | 87 | addCaller (msg) { 88 | this.callers.push(new Caller(msg)) 89 | } 90 | 91 | callerLeavesQueue (msg) { 92 | const data = msg.data 93 | const idx = this.callers.findIndex(c => c.chan === data.Channel) 94 | if (idx !== -1) { 95 | this.callers.splice(idx, 1) 96 | } 97 | // update position for other callers 98 | this.callers.forEach(c => c.position--) 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /test/unit/specs/AmiServers.spec.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import { mount, createLocalVue } from 'vue-test-utils' 3 | import Vuex from 'vuex' 4 | import Vuetify from 'vuetify' 5 | import AmiServers from '@/components/AmiServers' 6 | import * as mtype from '@/store/mutation-types' 7 | import store from '@/store' 8 | import Fixtures from './fixtures/AmiServers' 9 | 10 | const localVue = createLocalVue() 11 | 12 | localVue.use(Vuex) 13 | localVue.use(Vuetify) 14 | 15 | describe('AmiServers', () => { 16 | beforeEach(() => { 17 | store.commit(mtype.CLEAR_AMISRV_LIST) 18 | }) 19 | 20 | it('init with empty servers list', () => { 21 | const comp = mount(AmiServers, {store, localVue}) 22 | expect(comp.contains('.ami-server')).to.equal(false) 23 | }) 24 | 25 | it('creates one new server from AMI message', () => { 26 | Fixtures.oneServer.forEach(msg => store.dispatch('newMessage', msg)) 27 | const comp = mount(AmiServers, {store, localVue}) 28 | expect(comp.contains('.ami-server')).to.equal(true) 29 | expect(comp.findAll('.ami-server').length).to.equal(1) 30 | }) 31 | 32 | it('creates thee new servers from AMI messages', () => { 33 | Fixtures.threeServers.forEach(msg => store.dispatch('newMessage', msg)) 34 | const comp = mount(AmiServers, {store, localVue}) 35 | expect(comp.findAll('.ami-server').length).to.equal(3) 36 | }) 37 | 38 | it('update existing server', () => { 39 | Fixtures.oneServer.forEach(msg => store.dispatch('newMessage', msg)) 40 | Fixtures.oneServer.forEach(msg => store.dispatch('newMessage', msg)) 41 | const comp = mount(AmiServers, {store, localVue}) 42 | expect(comp.findAll('.ami-server').length).to.equal(1) 43 | }) 44 | 45 | it('create server with two queues which belongs to the server', () => { 46 | Fixtures.oneSrvWithTwoQueues.forEach(msg => store.dispatch('newMessage', msg)) 47 | const comp = mount(AmiServers, {store, localVue}) 48 | expect(comp.findAll('.ami-server').length).to.equal(1) 49 | expect(comp.findAll('.ami-server .queues-num').at(0).text().trim()) 50 | .to.equal('2') 51 | }) 52 | 53 | it('disables AMI server in list', () => { 54 | Fixtures.threeServers.forEach(msg => store.dispatch('newMessage', msg)) 55 | const comp = mount(AmiServers, {store, localVue}) 56 | expect(store.state.selectedServers.length).to.equal(3) 57 | comp.find('.disable-server .input-group--selection-controls__ripple--active').trigger('click') 58 | expect(store.state.selectedServers.length).to.equal(2) 59 | }) 60 | 61 | it('can not disable single AMI server in list', () => { 62 | Fixtures.oneServer.forEach(msg => store.dispatch('newMessage', msg)) 63 | const comp = mount(AmiServers, {store, localVue}) 64 | expect(store.state.selectedServers.length).to.equal(1) 65 | comp.find('.disable-server .input-group--selection-controls__ripple--active').trigger('click') 66 | expect(store.state.selectedServers.length).to.equal(1) 67 | expect(comp.vm.notify).to.equal(true) 68 | }) 69 | }) 70 | -------------------------------------------------------------------------------- /src/store/class.member.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | name = null 3 | interface = null 4 | membership = null 5 | penalty = 0 6 | callsTaken = 0 7 | lastCall = null 8 | status = null 9 | ringing = false 10 | paused = false 11 | pausedReason = null 12 | lastHoldtime = 0 13 | lastTalktime = 0 14 | incall = false 15 | incallTime = 0 16 | chan = null 17 | callerNum = null 18 | callerName = null 19 | _incallInterval = null 20 | 21 | constructor (msg) { 22 | const data = msg.data 23 | this.name = data.Name || data.MemberName 24 | this.interface = data.Location || data.Interface || data.StateInterface 25 | this.membership = data.Membership 26 | this.penalty = +data.Penalty 27 | this.callsTaken = +data.CallsTaken 28 | this.lastCall = data.LastCall 29 | this.status = +data.Status 30 | this.incall = (+data.InCall) === 1 31 | if (data.IsInCall) this.incall = +(data.IsInCall) === 1 32 | this.paused = (+data.Paused) === 1 33 | this.pausedReason = data.PausedReason 34 | } 35 | 36 | _setMemberInCall (isInCall) { 37 | if (!this._incallInterval && isInCall) { 38 | this._incallInterval = setInterval(() => this.incallTime++, 1000) 39 | } 40 | if (this._incallInterval && this.incall && !isInCall) { 41 | clearInterval(this._incallInterval) 42 | this.incallTime = 0 43 | this.chan = null 44 | this._incallInterval = null 45 | this.callerNum = null 46 | this.callerName = null 47 | } 48 | this.incall = isInCall 49 | } 50 | 51 | update (data) { 52 | if (data.Name) this.name = data.Name 53 | if (data.MemberName) this.name = data.MemberName 54 | if (data.Location) this.interface = data.Location 55 | if (data.Location) this.interface = data.Location 56 | else if (data.Interface) this.interface = data.Interface 57 | else if (data.StateInterface) this.interface = data.StateInterface 58 | if (data.Membership) this.membership = data.Membership 59 | if (data.Penalty) this.penalty = +data.Penalty 60 | if (data.CallsTaken) this.callsTaken = +data.CallsTaken 61 | if (data.LastCall) this.lastCall = +data.LastCall 62 | if (data.Status) this.status = +data.Status 63 | if (data.Paused) this.paused = (+data.Paused) === 1 64 | if (data.PausedReason) this.pausedReason = data.PausedReason 65 | if (data.HoldTime) this.lastHoldtime = +data.HoldTime 66 | if (data.TalkTime) this.lastTalktime = +data.TalkTime 67 | if (data.Channel && data.Event !== 'AgentConnect') this.chan = data.Channel 68 | 69 | if (data.ChannelCalling) this.chan = data.ChannelCalling 70 | if (data.InCall !== undefined) this._setMemberInCall((+data.InCall) === 1) 71 | 72 | this.ringing = this.status === 2 73 | if (data.Event === 'AgentRingNoAnswer') { 74 | this.ringing = false 75 | this.chan = null 76 | this._setMemberInCall(false) 77 | } 78 | if (data.Event === 'AgentCalled') { 79 | this.ringing = true 80 | this.callerNum = data.CallerIDNum 81 | this.callerName = data.CallerIDName 82 | } 83 | } 84 | 85 | match (name) { 86 | return this.name === name 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /test/unit/specs/MenuPanel.spec.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import { mount, createLocalVue } from 'vue-test-utils' 3 | import Vuex from 'vuex' 4 | import Vuetify from 'vuetify' 5 | import sinon from 'sinon' 6 | 7 | import * as mtype from '@/store/mutation-types' 8 | import store from '@/store' 9 | import Fixtures from './fixtures/MenuPanel' 10 | import MenuPanel from '@/components/MenuPanel' 11 | 12 | const localVue = createLocalVue() 13 | 14 | localVue.use(Vuex) 15 | localVue.use(Vuetify) 16 | 17 | describe('MenuPanel', () => { 18 | beforeEach(() => { 19 | store.commit(mtype.CLEAR_QUEUES_LIST) 20 | store.commit(mtype.CLEAR_AMISRV_LIST) 21 | }) 22 | 23 | it('show only one pagination when less queues then perPage param', () => { 24 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 25 | const comp = mount(MenuPanel, { store, localVue }) 26 | expect(comp.findAll('.pagination__item').length).to.equal(1) 27 | }) 28 | 29 | it('show pagination when more quese then per page param', () => { 30 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 31 | store.dispatch('setPerPage', 2) 32 | const comp = mount(MenuPanel, { store, localVue }) 33 | expect(comp.findAll('.pagination__item').length).to.equal(3) 34 | }) 35 | 36 | it('confirm box on click pause all agents', done => { 37 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 38 | const comp = mount(MenuPanel, { store, localVue }) 39 | comp.find('#btn-pause-all-agents').trigger('click') 40 | localVue.nextTick(() => { 41 | expect(comp.find('.modal-title').text().trim()) 42 | .to.equal('Confirm pause all agents') 43 | expect(comp.find('.modal-body').text().trim()) 44 | .to.equal(comp.vm.confirm.body) 45 | done() 46 | }) 47 | }) 48 | 49 | it('confirm box on click activate all agents', done => { 50 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 51 | const comp = mount(MenuPanel, { store, localVue }) 52 | comp.find('#btn-activate-all-agents').trigger('click') 53 | localVue.nextTick(() => { 54 | expect(comp.find('.modal-title').text().trim()) 55 | .to.equal('Confirm un-pause all agents') 56 | expect(comp.find('.modal-body').text().trim()) 57 | .to.equal(comp.vm.confirm.body) 58 | done() 59 | }) 60 | }) 61 | 62 | it('when confirm all agents pause, call vuex action pauseAllAgents', () => { 63 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 64 | const comp = mount(MenuPanel, { store, localVue }) 65 | comp.vm.pauseAllAgents = sinon.stub() 66 | comp.vm.doPause() 67 | expect(comp.vm.pauseAllAgents.callCount).to.equal(6) 68 | }) 69 | 70 | it('update store when current page is changed with pagination', () => { 71 | const comp = mount(MenuPanel, { store, localVue }) 72 | comp.vm.currentPage = 3 73 | expect(store.state.pagination.currentPage).to.equal(3) 74 | }) 75 | 76 | it('set current page to "1" when filter changed', () => { 77 | const comp = mount(MenuPanel, { store, localVue }) 78 | comp.vm.currentPage = 3 79 | expect(store.state.pagination.currentPage).to.equal(3) 80 | comp.vm.qnameFilter = 'sales' 81 | expect(store.state.pagination.currentPage).to.equal(1) 82 | expect(store.state.qnameFilter).to.equal('sales') 83 | }) 84 | }) 85 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amiws_queue", 3 | "version": "1.0.0", 4 | "description": "Asterisk Queues Realtime Manager", 5 | "author": "Stas Kobzar ", 6 | "private": true, 7 | "scripts": { 8 | "report-coverage": "codecov", 9 | "codecov": "codecov -t 09971104-b84b-4d9a-b612-e3d00db8d549", 10 | "dev": "node build/dev-server.js", 11 | "start": "npm run dev", 12 | "build": "node build/build.js", 13 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --auto-watch", 14 | "e2e": "node test/e2e/runner.js", 15 | "test": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", 16 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" 17 | }, 18 | "dependencies": { 19 | "vue": "^2.5.17", 20 | "vue-awesome": "^2.3.8", 21 | "vue-notification": "^1.3.13", 22 | "vue-snotify": "^3.2.1", 23 | "vuetify": "^0.17.7", 24 | "vuex": "^3.0.1" 25 | }, 26 | "devDependencies": { 27 | "autoprefixer": "^7.2.6", 28 | "babel-core": "^6.26.3", 29 | "babel-eslint": "^7.2.3", 30 | "babel-loader": "^7.1.5", 31 | "babel-plugin-istanbul": "^4.1.6", 32 | "babel-plugin-transform-runtime": "^6.22.0", 33 | "babel-polyfill": "^6.26.0", 34 | "babel-preset-env": "^1.7.0", 35 | "babel-preset-stage-2": "^6.22.0", 36 | "babel-register": "^6.22.0", 37 | "chai": "^4.2.0", 38 | "chalk": "^2.4.1", 39 | "chromedriver": "^2.42.0", 40 | "connect-history-api-fallback": "^1.5.0", 41 | "copy-webpack-plugin": "^4.5.2", 42 | "cross-env": "^5.2.0", 43 | "cross-spawn": "^5.0.1", 44 | "css-loader": "^0.28.11", 45 | "eslint": "^3.19.0", 46 | "eslint-config-standard": "^10.2.1", 47 | "eslint-friendly-formatter": "^3.0.0", 48 | "eslint-loader": "^1.7.1", 49 | "eslint-plugin-html": "^3.0.0", 50 | "eslint-plugin-import": "^2.14.0", 51 | "eslint-plugin-node": "^5.2.0", 52 | "eslint-plugin-promise": "^3.8.0", 53 | "eslint-plugin-standard": "^3.1.0", 54 | "eventsource-polyfill": "^0.9.6", 55 | "express": "^4.16.3", 56 | "extract-text-webpack-plugin": "^3.0.0", 57 | "file-loader": "^1.1.11", 58 | "friendly-errors-webpack-plugin": "^1.7.0", 59 | "html-webpack-plugin": "^2.30.1", 60 | "http-proxy-middleware": "^0.19.0", 61 | "inject-loader": "^3.0.0", 62 | "karma": "^3.0.0", 63 | "karma-coverage": "^1.1.2", 64 | "karma-mocha": "^1.3.0", 65 | "karma-phantomjs-launcher": "^1.0.2", 66 | "karma-phantomjs-shim": "^1.4.0", 67 | "karma-sinon-chai": "^1.3.4", 68 | "karma-sourcemap-loader": "^0.3.7", 69 | "karma-spec-reporter": "0.0.31", 70 | "karma-webpack": "^3.0.5", 71 | "mocha": "^5.2.0", 72 | "nightwatch": "^1.0.11", 73 | "opn": "^5.4.0", 74 | "optimize-css-assets-webpack-plugin": "^3.2.0", 75 | "ora": "^1.4.0", 76 | "phantomjs-prebuilt": "^2.1.16", 77 | "portfinder": "^1.0.17", 78 | "rimraf": "^2.6.0", 79 | "selenium-server": "^3.14.0", 80 | "semver": "^5.5.1", 81 | "shelljs": "^0.7.6", 82 | "sinon": "^4.5.0", 83 | "sinon-chai": "^2.8.0", 84 | "url-loader": "^1.1.1", 85 | "vue-loader": "^13.7.3", 86 | "vue-style-loader": "^3.1.2", 87 | "vue-template-compiler": "^2.5.17", 88 | "vue-test-utils": "^1.0.0-beta.11", 89 | "webpack": "^3.12.0", 90 | "webpack-bundle-analyzer": "^2.13.1", 91 | "webpack-dev-middleware": "^1.12.2", 92 | "webpack-hot-middleware": "^2.24.2", 93 | "webpack-merge": "^4.1.4" 94 | }, 95 | "engines": { 96 | "node": ">= 4.0.0", 97 | "npm": ">= 3.0.0" 98 | }, 99 | "browserslist": [ 100 | "> 1%", 101 | "last 2 versions", 102 | "not ie <= 8" 103 | ] 104 | } 105 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 123 | 124 | 127 | -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- 1 | import * as mtype from './mutation-types' 2 | 3 | export default { 4 | newMessage ({ commit }, rawMsg) { 5 | const msg = JSON.parse(rawMsg) 6 | // Response 7 | if (msg.type === 4) { 8 | // AMI server CoreStatus response 9 | if (msg.data.CoreStartupDate) { 10 | // create or update server 11 | commit(mtype.NEW_AMI_SERVER, { msg }) 12 | } else if (msg.data.Response === 'Error') { 13 | commit(mtype.ERROR_MSG, msg.data.Message) 14 | } 15 | } else if (msg.type === 3) { 16 | // event 17 | switch (msg.data.Event) { 18 | case 'AgentCalled': 19 | case 'AgentRingNoAnswer': 20 | commit(mtype.UPDATE_QUEUE_MEMBER_STATUS, { msg }) 21 | break 22 | case 'QueueParams': 23 | commit(mtype.ADD_QUEUE, { msg }) 24 | break 25 | case 'QueueMember': 26 | case 'QueueMemberAdded': 27 | commit(mtype.ADD_QUEUE_MEMBER, { msg }) 28 | break 29 | case 'QueueMemberRemoved': 30 | commit(mtype.REMOVE_QUEUE_MEMBER, { msg }) 31 | break 32 | case 'QueueEntry': 33 | case 'Join': 34 | case 'QueueCallerJoin': 35 | commit(mtype.ADD_QUEUE_CALLER, { msg }) 36 | break 37 | case 'QueueCallerLeave': 38 | case 'Leave': 39 | commit(mtype.LEAVE_QUEUE_CALLER, { msg }) 40 | break 41 | case 'QueueCallerAbandon': 42 | commit(mtype.ABANDON_QUEUE_CALLER, { msg }) 43 | break 44 | case 'QueueSummary': 45 | commit(mtype.UPDATE_QUEUE_SUMMARY, { msg }) 46 | break 47 | case 'QueueMemberPause': 48 | case 'QueueMemberPaused': 49 | commit(mtype.UPDATE_QUEUE_MEMBER_PAUSE, { msg }) 50 | break 51 | case 'QueueMemberStatus': 52 | commit(mtype.UPDATE_QUEUE_MEMBER_STATUS, { msg }) 53 | break 54 | case 'AgentConnect': 55 | commit(mtype.QUEUE_MEMBER_CONNECTED, { msg }) 56 | break 57 | case 'AgentComplete': 58 | commit(mtype.QUEUE_MEMBER_COMPLETE, { msg }) 59 | break 60 | default: 61 | // console.info(`Unknown Event: ${msg.data.Event}`) 62 | break 63 | } 64 | } 65 | }, 66 | selectedQueue ({ commit }, queueName) { 67 | commit(mtype.SET_SELECTED_QUEUE, { queueName }) 68 | }, 69 | setSelectedServers ({ commit, state }, ids) { 70 | state.selectedServers = ids 71 | }, 72 | pauseAllAgents ({ commit, state }, {name, sid, pause}) { 73 | const queue = state.queues.find(q => q.sid === sid && q.name === name) 74 | if (queue) { 75 | queue.members.forEach(m => { 76 | commit(mtype.PAUSE_QUEUE_MEMBER, { queue: queue.name, memberInf: m.interface, sid: queue.sid, pause: pause }) 77 | }) 78 | } 79 | }, 80 | pauseAgentInSelectedQueue ({ commit, state }, {member, pause}) { 81 | const queue = state.queues.find(q => q.name === state.selectedQueue) 82 | if (queue) { 83 | commit(mtype.PAUSE_QUEUE_MEMBER, { queue: queue.name, memberInf: member.interface, sid: queue.sid, pause: pause }) 84 | } 85 | }, 86 | removeAgentFromQueue ({ commit, state }, {iface, qname}) { 87 | const queue = state.queues.find(q => q.name === qname) 88 | if (queue) { 89 | commit(mtype.QUEUE_REMOVE_MEMBER, { queue: qname, memberInf: iface, sid: queue.sid }) 90 | } 91 | }, 92 | setQueuesFilter ({ commit, state }, filter) { 93 | state.qnameFilter = filter 94 | }, 95 | setPerPage ({ commit, state }, perPage) { 96 | state.pagination.perPage = perPage 97 | }, 98 | setCurPage ({ commit, state }, page) { 99 | state.pagination.currentPage = page 100 | }, 101 | memberDragStart ({ commit, state }, member) { 102 | state.dragMember = member 103 | }, 104 | memberDragStop ({ commit, state }) { 105 | state.dragMember = null 106 | }, 107 | hideError ({ commit, state }, status) { 108 | state.showError = status 109 | }, 110 | addQueueMember ({ commit, state }, { queue, member }) { 111 | commit(mtype.QUEUE_ADD_MEMBER, { queue, member }) 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/store/mutations.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import AmiServer from './class.amiserver' 3 | import Queue from './class.queue' 4 | import * as mtype from './mutation-types' 5 | 6 | export default { 7 | [mtype.WS_CONNECTED] (state, status) { 8 | state.ws_connected = status 9 | }, 10 | 11 | [mtype.ERROR_MSG] (state, message) { 12 | state.errorResponse = message 13 | state.showError = true 14 | }, 15 | 16 | [mtype.CLEAR_AMISRV_LIST] (state) { 17 | state.servers.splice(0) 18 | state.selectedServers = [] 19 | }, 20 | 21 | [mtype.CLEAR_QUEUES_LIST] (state) { 22 | state.queues.splice(0) 23 | }, 24 | 25 | [mtype.NEW_AMI_SERVER] (state, { msg }) { 26 | const srv = state.servers.find(srv => srv.matchId(msg.server_id)) 27 | if (srv) { 28 | srv.update(msg) 29 | } else { 30 | state.servers.push(new AmiServer(msg)) 31 | state.selectedServers.push(msg.server_id) 32 | } 33 | }, 34 | 35 | [mtype.ADD_QUEUE] (state, { msg }) { 36 | let queue = state.queues.find(q => q.match(msg)) 37 | if (queue) { 38 | queue.update(msg) 39 | } else { 40 | state.queues.push(new Queue(msg)) 41 | } 42 | }, 43 | 44 | [mtype.UPDATE_QUEUE_SUMMARY] (state, { msg }) { 45 | const data = msg.data 46 | const queue = state.queues.find(q => q.match(msg)) 47 | if (queue) { 48 | queue.holdtime = +data.HoldTime 49 | queue.talktime = +data.TalkTime 50 | } 51 | }, 52 | 53 | [mtype.ADD_QUEUE_MEMBER] (state, { msg }) { 54 | const queue = state.queues.find(q => q.match(msg)) 55 | if (queue) { 56 | queue.addMember(msg) 57 | } 58 | }, 59 | 60 | [mtype.REMOVE_QUEUE_MEMBER] (state, { msg }) { 61 | const queue = state.queues.find(q => q.match(msg)) 62 | if (queue) { 63 | queue.removeMember(msg) 64 | } 65 | }, 66 | 67 | [mtype.UPDATE_QUEUE_MEMBER_STATUS] (state, { msg }) { 68 | const queue = state.queues.find(q => q.match(msg)) 69 | if (queue) { 70 | queue.updateMember(msg) 71 | } 72 | }, 73 | 74 | [mtype.QUEUE_MEMBER_CONNECTED] (state, { msg }) { 75 | const queue = state.queues.find(q => q.match(msg)) 76 | if (queue) { 77 | msg.data.InCall = 1 78 | queue.updateMember(msg) 79 | } 80 | }, 81 | 82 | [mtype.QUEUE_MEMBER_COMPLETE] (state, { msg }) { 83 | const queue = state.queues.find(q => q.match(msg)) 84 | if (queue) { 85 | msg.data.InCall = 0 86 | queue.completed++ 87 | queue.updateMember(msg) 88 | } 89 | }, 90 | 91 | [mtype.UPDATE_QUEUE_MEMBER_PAUSE] (state, { msg }) { 92 | const queue = state.queues.find(q => q.match(msg)) 93 | if (queue) { 94 | queue.updateMember(msg) 95 | } 96 | }, 97 | 98 | [mtype.QUEUE_REMOVE_MEMBER] (state, { queue, memberInf, sid }) { 99 | Vue.websockSend(JSON.stringify({ 100 | Action: 'QueueRemove', 101 | Interface: memberInf, 102 | Queue: queue, 103 | AMIServerID: sid 104 | })) 105 | }, 106 | 107 | [mtype.PAUSE_QUEUE_MEMBER] (state, { queue, memberInf, sid, pause }) { 108 | Vue.websockSend(JSON.stringify({ 109 | Action: 'QueuePause', 110 | Interface: memberInf, 111 | Paused: pause ? 'true' : 'false', 112 | Queue: queue, 113 | AMIServerID: sid 114 | })) 115 | }, 116 | 117 | [mtype.QUEUE_ADD_MEMBER] (state, { queue, member }) { 118 | Vue.websockSend(JSON.stringify({ 119 | Action: 'QueueAdd', 120 | AMIServerID: queue.sid, 121 | Queue: queue.name, 122 | Interface: member.interface, 123 | Penalty: member.penalty, 124 | Paused: member.paused, 125 | MemberName: member.name 126 | })) 127 | }, 128 | 129 | [mtype.ADD_QUEUE_CALLER] (state, { msg }) { 130 | const queue = state.queues.find(q => q.match(msg)) 131 | if (queue) { 132 | queue.addCaller(msg) 133 | } 134 | }, 135 | 136 | [mtype.LEAVE_QUEUE_CALLER] (state, { msg }) { 137 | const queue = state.queues.find(q => q.match(msg)) 138 | if (queue) { 139 | queue.callerLeavesQueue(msg) 140 | } 141 | }, 142 | 143 | [mtype.ABANDON_QUEUE_CALLER] (state, { msg }) { 144 | const queue = state.queues.find(q => q.match(msg)) 145 | if (queue) { 146 | queue.abandoned++ 147 | } 148 | }, 149 | 150 | [mtype.SET_SELECTED_QUEUE] (state, { queueName }) { 151 | state.selectedQueue = queueName 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /src/components/MenuPanel.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 126 | 127 | 131 | -------------------------------------------------------------------------------- /test/unit/specs/fixtures/QueueData.js: -------------------------------------------------------------------------------- 1 | const Fixture = {} 2 | 3 | Fixture.oneEmptyQueue = [ 4 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 5 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 6 | ] 7 | 8 | Fixture.oneQueueWithOneMemeberNoCallers = [ 9 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 10 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 11 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1004@sc360.modulis.clusterpbx.ca","Location": "Local/1004@from-queue/n","StateInterface": "Local/1004@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "1","PausedReason": ""}}` 12 | ] 13 | 14 | Fixture.callerCallsQueue = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "AgentCalled","Privilege": "agent,all","Queue": "TechSupport","AgentCalled": "Local/1004@from-queue/n","AgentName": "1004@sc360.modulis.clusterpbx.ca","ChannelCalling": "SIP/router01-0000006a","DestinationChannel": "Local/1004@from-queue-00000036;1","CallerIDNum": "1005","CallerIDName": "Uno Trezzo","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Context": "default","Extension": "MYQUEUE_9","Priority": "9","Uniqueid": "1513348988.214"}}` 15 | 16 | Fixture.oneQueueWithOneMemeberOneCaller = [ 17 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 18 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 19 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1004@sc360.modulis.clusterpbx.ca","Location": "Local/1004@from-queue/n","StateInterface": "Local/1004@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "1","Paused": "1","PausedReason": ""}}`, 20 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "1","Channel": "SIP/router01-0013ab9e","Uniqueid": "1509489741.3343730","CallerIDNum": "14383918247","CallerIDName": "14383918247","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "549"}}` 21 | ] 22 | 23 | Fixture.queueMemberStatus = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMemberStatus","Privilege": "agent,all","Queue": "TechSupport","Location": "Local/1004@from-queue/n","MemberName": "1004@sc360.modulis.clusterpbx.ca","StateInterface": "Local/1004@from-queue/n","Membership": "realtime","Penalty": "2","CallsTaken": "4","LastCall": "1510904138","Status": "3","Paused": "0"}}` 24 | 25 | Fixture.agentConnect = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "AgentConnect","Privilege": "agent,all","Queue": "TechSupport","Uniqueid": "1510674700.8","Channel": "Local/1004@from-queue-00000001;1","Member": "Local/1004@from-queue/n","MemberName": "1004@sc360.modulis.clusterpbx.ca","HoldTime": "2","BridgedChannel": "1510674701.9","RingTime": "2"}}` 26 | 27 | Fixture.agentComplete = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "AgentComplete","Privilege": "agent,all","Queue": "TechSupport","Uniqueid": "1510674700.8","Channel": "Local/1004@from-queue-00000001;1","Member": "Local/1004@from-queue/n","MemberName": "1004@sc360.modulis.clusterpbx.ca","HoldTime": "20","TalkTime": "120","Reason": "caller"}}` 28 | 29 | Fixture.responseError = `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Error","Message": "Member not dynamic"}}` 30 | 31 | export default Fixture 32 | -------------------------------------------------------------------------------- /src/components/TopStats.vue: -------------------------------------------------------------------------------- 1 | 91 | 92 | 124 | 125 | 126 | 138 | -------------------------------------------------------------------------------- /test/unit/specs/TopStats.spec.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import { mount, createLocalVue } from 'vue-test-utils' 3 | import Vue from 'vue' 4 | import Vuex from 'vuex' 5 | import TopStats from '@/components/TopStats' 6 | import * as mtype from '@/store/mutation-types' 7 | import store from '@/store' 8 | import Fixtures from './fixtures/TopStats' 9 | 10 | const localVue = createLocalVue() 11 | 12 | localVue.use(Vuex) 13 | Vue.websockSend = sinon.stub() 14 | 15 | describe('TopStats', () => { 16 | beforeEach(() => { 17 | store.dispatch('setQueuesFilter', '') 18 | store.commit(mtype.CLEAR_QUEUES_LIST) 19 | store.commit(mtype.CLEAR_AMISRV_LIST) 20 | }) 21 | 22 | it('has 3 main cards', () => { 23 | const comp = mount(TopStats, { store, localVue }) 24 | expect(comp.findAll('.stats-card').length).to.equal(3) 25 | }) 26 | 27 | it('show acive calls from one queue', () => { 28 | Fixtures.oneQueue.forEach(msg => store.dispatch('newMessage', msg)) 29 | const comp = mount(TopStats, { store, localVue }) 30 | expect(comp.contains('.active-calls')).to.equal(true) 31 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 32 | .to.equal('4') 33 | }) 34 | 35 | it('show waiting calls from one queue', () => { 36 | Fixtures.newCallersJoins.forEach(msg => store.dispatch('newMessage', msg)) 37 | const comp = mount(TopStats, { store, localVue }) 38 | expect(comp.contains('.active-calls')).to.equal(true) 39 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 40 | .to.equal('2') 41 | }) 42 | 43 | it('show Abandoned/Answered calls from one queue', () => { 44 | Fixtures.oneQueue.forEach(msg => store.dispatch('newMessage', msg)) 45 | const comp = mount(TopStats, { store, localVue }) 46 | expect(comp.contains('.calls-processed')).to.equal(true) 47 | expect(comp.findAll('.calls-processed .calls-completed').at(0).text().trim()) 48 | .to.equal('231') 49 | expect(comp.findAll('.calls-processed .calls-abandoned').at(0).text().trim()) 50 | .to.equal('120') 51 | }) 52 | 53 | it('show paused/unpaused agents for one queue', () => { 54 | Fixtures.oneQueueWithThreeMembers.forEach(msg => store.dispatch('newMessage', msg)) 55 | const comp = mount(TopStats, { store, localVue }) 56 | expect(comp.contains('.members')).to.equal(true) 57 | expect(comp.findAll('.members .total').at(0).text().trim()) 58 | .to.equal('3') 59 | expect(comp.findAll('.members .paused').at(0).text().trim()) 60 | .to.equal('1') 61 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 62 | .to.equal('2') 63 | }) 64 | 65 | it('show paused/unpaused agents for one queue and update member status', () => { 66 | Fixtures.oneQueueWithThreeMembersUpdate.forEach(msg => store.dispatch('newMessage', msg)) 67 | const comp = mount(TopStats, { store, localVue }) 68 | expect(comp.contains('.members')).to.equal(true) 69 | expect(comp.findAll('.members .total').at(0).text().trim()) 70 | .to.equal('3') 71 | expect(comp.findAll('.members .paused').at(0).text().trim()) 72 | .to.equal('2') 73 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 74 | .to.equal('1') 75 | }) 76 | 77 | it('add new member to queue', done => { 78 | Fixtures.oneQueueWithThreeMembers.forEach(msg => store.dispatch('newMessage', msg)) 79 | const comp = mount(TopStats, { store, localVue }) 80 | expect(comp.contains('.members')).to.equal(true) 81 | expect(comp.findAll('.members .total').at(0).text().trim()) 82 | .to.equal('3') 83 | expect(comp.findAll('.members .paused').at(0).text().trim()) 84 | .to.equal('1') 85 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 86 | .to.equal('2') 87 | store.dispatch('newMessage', Fixtures.addMember) 88 | localVue.nextTick(() => { 89 | expect(comp.findAll('.members .total').at(0).text().trim()) 90 | .to.equal('4') 91 | expect(comp.findAll('.members .paused').at(0).text().trim()) 92 | .to.equal('1') 93 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 94 | .to.equal('3') 95 | done() 96 | }) 97 | }) 98 | 99 | it('remove member from queue', done => { 100 | Fixtures.oneQueueWithThreeMembers.forEach(msg => store.dispatch('newMessage', msg)) 101 | const comp = mount(TopStats, { store, localVue }) 102 | expect(comp.contains('.members')).to.equal(true) 103 | expect(comp.findAll('.members .total').at(0).text().trim()) 104 | .to.equal('3') 105 | expect(comp.findAll('.members .paused').at(0).text().trim()) 106 | .to.equal('1') 107 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 108 | .to.equal('2') 109 | store.dispatch('newMessage', Fixtures.removeMember) 110 | localVue.nextTick(() => { 111 | expect(comp.findAll('.members .total').at(0).text().trim()) 112 | .to.equal('2') 113 | expect(comp.findAll('.members .paused').at(0).text().trim()) 114 | .to.equal('1') 115 | expect(comp.findAll('.members .unpaused').at(0).text().trim()) 116 | .to.equal('1') 117 | done() 118 | }) 119 | }) 120 | 121 | it('updates "Waiting" when caller joins the queue and then leaves', done => { 122 | Fixtures.newCallersJoins.forEach(msg => store.dispatch('newMessage', msg)) 123 | const comp = mount(TopStats, { store, localVue }) 124 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 125 | .to.equal('2') 126 | store.dispatch('newMessage', Fixtures.callerLeaves) 127 | localVue.nextTick(() => { 128 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 129 | .to.equal('1') 130 | done() 131 | }) 132 | }) 133 | 134 | it('updates "Waiting" when caller joins the queue and then leaves with QueueCallerLeave', done => { 135 | Fixtures.newCallersJoins.forEach(msg => store.dispatch('newMessage', msg)) 136 | const comp = mount(TopStats, { store, localVue }) 137 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 138 | .to.equal('2') 139 | store.dispatch('newMessage', Fixtures.queueCallerLeave) 140 | localVue.nextTick(() => { 141 | expect(comp.findAll('.active-calls .calls-wait').at(0).text().trim()) 142 | .to.equal('1') 143 | done() 144 | }) 145 | }) 146 | 147 | it('updates queue abandoned calls', done => { 148 | Fixtures.oneQueue.forEach(msg => store.dispatch('newMessage', msg)) 149 | const comp = mount(TopStats, { store, localVue }) 150 | expect(comp.findAll('.calls-processed .calls-abandoned').at(0).text().trim()) 151 | .to.equal('120') 152 | store.dispatch('newMessage', Fixtures.callerAbandoned) 153 | localVue.nextTick(() => { 154 | expect(comp.findAll('.calls-processed .calls-abandoned').at(0).text().trim()) 155 | .to.equal('121') 156 | done() 157 | }) 158 | }) 159 | }) 160 | -------------------------------------------------------------------------------- /test/unit/specs/QueuesList.spec.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import { mount, createLocalVue } from 'vue-test-utils' 3 | import Vuex from 'vuex' 4 | import Vuetify from 'vuetify' 5 | import sinon from 'sinon' 6 | 7 | import * as mtype from '@/store/mutation-types' 8 | import store from '@/store' 9 | import Fixtures from './fixtures/QueueList' 10 | import QueuesList from '@/components/QueuesList' 11 | 12 | const localVue = createLocalVue() 13 | 14 | localVue.use(Vuex) 15 | localVue.use(Vuetify) 16 | 17 | describe('QueuesList', () => { 18 | beforeEach(() => { 19 | store.commit(mtype.CLEAR_AMISRV_LIST) 20 | store.commit(mtype.CLEAR_QUEUES_LIST) 21 | store.dispatch('setPerPage', 10) 22 | store.dispatch('setCurPage', 1) 23 | store.dispatch('setQueuesFilter', '') 24 | store.state.loading = 0 25 | }) 26 | 27 | it('init with empty queues list', () => { 28 | const comp = mount(QueuesList, { store, localVue }) 29 | expect(comp.contains('.queue-card')).to.equal(false) 30 | }) 31 | 32 | it('create one queue from AMI message', () => { 33 | Fixtures.oneEmptyQueue.forEach(msg => store.dispatch('newMessage', msg)) 34 | const comp = mount(QueuesList, { store, localVue }) 35 | expect(comp.contains('.queue-card')).to.equal(true) 36 | expect(comp.findAll('.queue-card').length).to.equal(1) 37 | }) 38 | 39 | it('create two queues from AMI messages', () => { 40 | Fixtures.twoEmptyQueues.forEach(msg => store.dispatch('newMessage', msg)) 41 | const comp = mount(QueuesList, { store, localVue }) 42 | expect(comp.contains('.queue-card')).to.equal(true) 43 | expect(comp.findAll('.queue-card').length).to.equal(2) 44 | }) 45 | 46 | it('create queue with two members and three callers', () => { 47 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 48 | const comp = mount(QueuesList, { store, localVue }) 49 | expect(comp.contains('.queue-card')).to.equal(true) 50 | expect(comp.find('.queue-card .members').text().trim()).to.equal('2') 51 | expect(comp.find('.queue-card .callers').text().trim()).to.equal('3') 52 | }) 53 | 54 | it('create queue with one paused and one unpaused members ', () => { 55 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 56 | const comp = mount(QueuesList, { store, localVue }) 57 | expect(comp.contains('.queue-card')).to.equal(true) 58 | expect(comp.find('.members-paused').text().trim()).to.equal('1') 59 | expect(comp.find('.members-unpaused').text().trim()).to.equal('1') 60 | }) 61 | 62 | it('create queue with one waiting', () => { 63 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 64 | store.dispatch('newMessage', Fixtures.joinCaller) 65 | const comp = mount(QueuesList, { store, localVue }) 66 | expect(comp.contains('.queue-card')).to.equal(true) 67 | expect(comp.find('.queue-card .callers-waiting').text().trim()).to.equal('1') 68 | }) 69 | 70 | it('update queue stats on summary message packet', done => { 71 | Fixtures.oneEmptyQueue.forEach(msg => store.dispatch('newMessage', msg)) 72 | const comp = mount(QueuesList, { store, localVue }) 73 | expect(comp.contains('.queue-card')).to.equal(true) 74 | expect(comp.find('.queue-card .holdtime').text().trim()).to.equal('00:00:10') 75 | expect(comp.find('.queue-card .talktime').text().trim()).to.equal('00:01:40') 76 | store.dispatch('newMessage', Fixtures.queueSummaryResp) 77 | localVue.nextTick(() => { 78 | expect(comp.find('.queue-card .holdtime').text().trim()).to.equal('00:05:45') 79 | expect(comp.find('.queue-card .talktime').text().trim()).to.equal('00:16:27') 80 | done() 81 | }) 82 | }) 83 | 84 | it('update queue members status pause/unpause', done => { 85 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 86 | const comp = mount(QueuesList, { store, localVue }) 87 | expect(comp.contains('.queue-card')).to.equal(true) 88 | expect(comp.find('.queue-card .members-paused').text().trim()).to.equal('1') 89 | expect(comp.find('.queue-card .members-unpaused').text().trim()).to.equal('1') 90 | store.dispatch('newMessage', Fixtures.unpauseMemeber) 91 | localVue.nextTick(() => { 92 | expect(comp.find('.queue-card .members-paused').text().trim()).to.equal('2') 93 | done() 94 | }) 95 | }) 96 | 97 | it('with pagination perPage equals "3" will display page with three queues', () => { 98 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 99 | store.dispatch('setPerPage', 3) 100 | const comp = mount(QueuesList, { store, localVue }) 101 | expect(comp.contains('.queue-card')).to.equal(true) 102 | expect(comp.findAll('.queue-card').length).to.equal(3) 103 | }) 104 | 105 | it('with pagination current page is updates, show next page', () => { 106 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 107 | store.dispatch('setPerPage', 3) 108 | store.dispatch('setCurPage', 2) 109 | const comp = mount(QueuesList, { store, localVue }) 110 | expect(comp.contains('.queue-card')).to.equal(true) 111 | expect(comp.findAll('.queue-card').length).to.equal(3) 112 | expect(comp.findAll('.queue-card .card-header').at(0).text().trim()) 113 | .to.equal('Reception') 114 | }) 115 | 116 | it('filter queues list by queue name case insensitive', () => { 117 | Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg)) 118 | store.dispatch('setQueuesFilter', 'sales') 119 | const comp = mount(QueuesList, { store, localVue }) 120 | expect(comp.contains('.queue-card')).to.equal(true) 121 | expect(comp.findAll('.queue-card').length).to.equal(2) 122 | }) 123 | 124 | it('set all members paused for selected queue', () => { 125 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 126 | store.dispatch('setQueuesFilter', 'TechSupport') 127 | const comp = mount(QueuesList, { store, localVue }) 128 | comp.vm.pauseAllAgents = sinon.stub() 129 | comp.vm.pauseAll() 130 | expect(comp.vm.pauseAllAgents.callCount).to.equal(1) 131 | }) 132 | 133 | it('can not drag member to its queue', () => { 134 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 135 | store.dispatch('setQueuesFilter', 'TechSupport') 136 | const comp = mount(QueuesList, { store, localVue }) 137 | const q = store.state.queues[0] 138 | comp.vm.dragDrop(q) 139 | expect(comp.vm.notify).to.equal(false) 140 | }) 141 | 142 | it('drag member from one queue to another', () => { 143 | Fixtures.oneQueueWithTwoMembersThreeCallers.forEach(msg => store.dispatch('newMessage', msg)) 144 | Fixtures.twoQueuesAndUpdateQueue.forEach(msg => store.dispatch('newMessage', msg)) 145 | store.dispatch('setQueuesFilter', 'TechSupport') 146 | const comp = mount(QueuesList, { store, localVue }) 147 | const q = store.state.queues 148 | store.dispatch('memberDragStart', q[0].members[0]) 149 | comp.vm.addQueueMember = sinon.stub() 150 | comp.vm.dragDrop(q[1]) 151 | expect(comp.vm.addQueueMember.called).to.equal(true) 152 | expect(comp.vm.notify).to.equal(true) 153 | }) 154 | }) 155 | -------------------------------------------------------------------------------- /test/unit/specs/QueueData.spec.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import { mount, createLocalVue } from 'vue-test-utils' 3 | import Vuex from 'vuex' 4 | import Vuetify from 'vuetify' 5 | 6 | import QueueData from '@/components/QueueData' 7 | import * as mtype from '@/store/mutation-types' 8 | import store from '@/store' 9 | import Fixtures from './fixtures/QueueData' 10 | 11 | const localVue = createLocalVue() 12 | 13 | localVue.use(Vuex) 14 | localVue.use(Vuetify) 15 | 16 | describe('QueueData', () => { 17 | beforeEach(() => { 18 | store.commit(mtype.CLEAR_QUEUES_LIST) 19 | store.commit(mtype.SET_SELECTED_QUEUE, '') 20 | }) 21 | 22 | it('shows message when not selected', () => { 23 | const comp = mount(QueueData, { store, localVue }) 24 | expect(comp.contains('.members')).to.equal(false) 25 | expect(comp.contains('.callers')).to.equal(false) 26 | expect(comp.contains('.block-header')).to.equal(false) 27 | }) 28 | 29 | it('change store state when close button clicked', done => { 30 | Fixtures.oneEmptyQueue.forEach(msg => store.dispatch('newMessage', msg)) 31 | store.dispatch('selectedQueue', 'TechSupport') 32 | const comp = mount(QueueData, { store, localVue }) 33 | expect(store.state.selectedQueue).to.equal('TechSupport') 34 | expect(comp.contains('.btn-close-panel')).to.equal(true) 35 | comp.find('.btn-close-panel').trigger('click') 36 | localVue.nextTick(() => { 37 | expect(store.state.selectedQueue).to.equal('') 38 | done() 39 | }) 40 | }) 41 | 42 | it('has root elements', () => { 43 | Fixtures.oneEmptyQueue.forEach(msg => store.dispatch('newMessage', msg)) 44 | store.dispatch('selectedQueue', 'TechSupport') 45 | const comp = mount(QueueData, { store, localVue }) 46 | expect(comp.contains('.members')).to.equal(true) 47 | expect(comp.contains('.callers')).to.equal(true) 48 | }) 49 | 50 | it('handles queue with no callers and no members', () => { 51 | Fixtures.oneEmptyQueue.forEach(msg => store.dispatch('newMessage', msg)) 52 | const comp = mount(QueueData, { store, localVue }) 53 | expect(comp.contains('.member-card')).to.equal(false) 54 | expect(comp.contains('.caller-card')).to.equal(false) 55 | }) 56 | 57 | it('handles queue with one member and no callers', () => { 58 | Fixtures.oneQueueWithOneMemeberNoCallers.forEach(msg => store.dispatch('newMessage', msg)) 59 | store.dispatch('selectedQueue', 'TechSupport') 60 | const comp = mount(QueueData, { store, localVue }) 61 | expect(comp.findAll('.member-card').length).to.equal(1) 62 | expect(comp.findAll('.caller-card').length).to.equal(0) 63 | }) 64 | 65 | it('handles queue with one member and one caller', () => { 66 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 67 | store.dispatch('selectedQueue', 'TechSupport') 68 | const comp = mount(QueueData, { store, localVue }) 69 | expect(comp.findAll('.member-card').length).to.equal(1) 70 | expect(comp.findAll('.caller-card').length).to.equal(1) 71 | }) 72 | 73 | it('updates queue member status', () => { 74 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 75 | store.dispatch('newMessage', Fixtures.queueMemberStatus) 76 | const member = store.state.queues[0].members[0] 77 | expect(member.paused).to.equal(false) 78 | expect(member.status).to.equal(3) 79 | expect(member.callsTaken).to.equal(4) 80 | expect(member.penalty).to.equal(2) 81 | }) 82 | 83 | it('update queue member on AgentConnect', () => { 84 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 85 | store.dispatch('newMessage', Fixtures.agentConnect) 86 | const member = store.state.queues[0].members[0] 87 | expect(member.lastHoldtime).to.equal(2) 88 | expect(member.incall).to.equal(true) 89 | }) 90 | 91 | it('update queue member on AgentComplete', () => { 92 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 93 | store.dispatch('newMessage', Fixtures.agentComplete) 94 | const member = store.state.queues[0].members[0] 95 | expect(member.lastHoldtime).to.equal(20) 96 | expect(member.lastTalktime).to.equal(120) 97 | expect(member.incall).to.equal(false) 98 | }) 99 | 100 | it('test last call taken date/time format', () => { 101 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 102 | store.dispatch('selectedQueue', 'TechSupport') 103 | store.dispatch('newMessage', Fixtures.queueMemberStatus) 104 | // fix date for Travis CI timezone 105 | const d = new Date(1510904138000) 106 | const h = d.getHours() 107 | const p = h > 9 ? '' : '0' 108 | const comp = mount(QueueData, { store, localVue }) 109 | expect(comp.find('.last-call-taken').text().trim()).to.equal(`2017-11-17 ${p}${h}:35:38`) 110 | }) 111 | 112 | it('pause/unpause agent in list', () => { 113 | Fixtures.oneQueueWithOneMemeberOneCaller.forEach(msg => store.dispatch('newMessage', msg)) 114 | store.dispatch('selectedQueue', 'TechSupport') 115 | const comp = mount(QueueData, { store, localVue }) 116 | comp.vm.pauseAgentToggle = sinon.stub() 117 | comp.find('.btn-agent-toggle').trigger('click') 118 | expect(comp.vm.pauseAgentToggle.called).to.equal(true) 119 | }) 120 | 121 | it('toggle agent paused/active', () => { 122 | Fixtures.oneQueueWithOneMemeberNoCallers.forEach(msg => store.dispatch('newMessage', msg)) 123 | store.dispatch('selectedQueue', 'TechSupport') 124 | const comp = mount(QueueData, { store, localVue }) 125 | comp.vm.pauseAgentInSelectedQueue = sinon.stub() 126 | comp.find('.btn-agent-toggle').trigger('click') 127 | expect(comp.vm.pauseAgentInSelectedQueue.called).to.equal(true) 128 | expect(comp.vm.notify).to.equal(true) 129 | expect(comp.vm.notifyText).to.equal('Activate agent 1004@sc360.modulis.clusterpbx.ca') 130 | }) 131 | 132 | it('removes agent from queue dialog', () => { 133 | Fixtures.oneQueueWithOneMemeberNoCallers.forEach(msg => store.dispatch('newMessage', msg)) 134 | store.dispatch('selectedQueue', 'TechSupport') 135 | const comp = mount(QueueData, { store, localVue }) 136 | comp.find('.btn-agent-remove').trigger('click') 137 | expect(comp.vm.dlgBody).to.equal('Remove agent 1004@sc360.modulis.clusterpbx.ca?') 138 | expect(comp.vm.memberToRemove).to.equal('Local/1004@from-queue/n') 139 | }) 140 | 141 | it('set member ringing when caller calls queue', () => { 142 | Fixtures.oneQueueWithOneMemeberNoCallers.forEach(msg => store.dispatch('newMessage', msg)) 143 | expect(store.state.queues[0].members[0].ringing).to.equal(false) 144 | store.dispatch('newMessage', Fixtures.callerCallsQueue) 145 | expect(store.state.queues[0].members[0].ringing).to.equal(true) 146 | }) 147 | 148 | it('triggers error notify on Response message', () => { 149 | expect(store.state.showError).to.equal(false) 150 | store.dispatch('newMessage', Fixtures.responseError) 151 | expect(store.state.showError).to.equal(true) 152 | expect(store.state.errorResponse).to.equal('Member not dynamic') 153 | }) 154 | 155 | it('removes agent from queue dialog', () => { 156 | Fixtures.oneQueueWithOneMemeberNoCallers.forEach(msg => store.dispatch('newMessage', msg)) 157 | store.dispatch('selectedQueue', 'TechSupport') 158 | const comp = mount(QueueData, { store, localVue }) 159 | comp.vm.removeAgentFromQueue = sinon.stub() 160 | comp.find('.btn-agent-remove').trigger('click') 161 | comp.find('.btn-confirm-remove').trigger('click') 162 | expect(comp.vm.removeAgentFromQueue.called).to.equal(true) 163 | expect(comp.vm.notifyText).to.equal('Removing agent Local/1004@from-queue/n from queue TechSupport') 164 | expect(comp.vm.notify).to.equal(true) 165 | }) 166 | }) 167 | -------------------------------------------------------------------------------- /test/unit/specs/fixtures/QueueList.js: -------------------------------------------------------------------------------- 1 | const Fixture = {} 2 | 3 | Fixture.oneEmptyQueue = [ 4 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 5 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "10","TalkTime": "100","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 6 | ] 7 | 8 | Fixture.queueSummaryResp = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueSummary","Queue": "TechSupport","LoggedIn": "1","Available": "1","Callers": "0","HoldTime": "345","TalkTime": "987","LongestHoldTime": "0"}}` 9 | 10 | Fixture.twoEmptyQueues = [ 11 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 12 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 13 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesDep","Max": "8","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 14 | ] 15 | 16 | Fixture.twoQueuesAndUpdateQueue = [ 17 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 18 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 19 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesDep","Max": "8","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 20 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 21 | ] 22 | 23 | Fixture.oneQueueWithTwoMembersThreeCallers = [ 24 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 25 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "5","Holdtime": "0","TalkTime": "0","Completed": "231","Abandoned": "120","ServiceLevel": "3.43","ServicelevelPerf": "0.0","Weight": "0"}}`, 26 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "1","Channel": "SIP/router01-0013ab9e","Uniqueid": "1509489741.3343730","CallerIDNum": "14383918247","CallerIDName": "14383918247","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "549"}}`, 27 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "2","Channel": "SIP/router01-0013ac19","Uniqueid": "1509489893.3344025","CallerIDNum": "14383958755","CallerIDName": "14383958755","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "396"}}`, 28 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "3","Channel": "SIP/router01-0013ac94","Uniqueid": "1509490108.3344364","CallerIDNum": "14384914339","CallerIDName": "14384914339","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "182"}}`, 29 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1004@sc360.modulis.clusterpbx.ca","Location": "Local/1004@from-queue/n","StateInterface": "Local/1004@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "1","PausedReason": ""}}`, 30 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1005@sc360.modulis.clusterpbx.ca","Location": "Local/1005@from-queue/n","StateInterface": "Local/1005@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "0","PausedReason": ""}}` 31 | ] 32 | 33 | Fixture.joinCaller = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "Join","Privilege": "call,all","Channel": "SIP/router01-00000050","CallerIDNum": "1000","CallerIDName": "Eric Gingras","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Queue": "TechSupport","Position": "4","Count": "3","Uniqueid": "1510322646.118"}}` 34 | 35 | Fixture.unpauseMemeber = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMemberPause","Privilege": "agent,all","MemberName": "1005@sc360.modulis.clusterpbx.ca","Interface": "Local/1005@from-queue/n","Membership": "static","Queue": "TechSupport","StateInterface": "Local/1005@from-queue/n","Penalty": "0","CallsTaken": "4","InCall": "0","LastCall": "1510365542","Status": "1","Ringinuse": "1","Paused": "1","PausedReason": ""}}` 36 | 37 | Fixture.sixQueues = [ 38 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 39 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 40 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesDep","Max": "8","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 41 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "SalesSupport","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 42 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "Reception","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 43 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "HRDep","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}`, 44 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "Shipping","Max": "0","Strategy": "ringall","Calls": "0","Holdtime": "0","TalkTime": "0","Completed": "0","Abandoned": "0","ServiceLevel": "0","ServicelevelPerf": "0.0","Weight": "0"}}` 45 | ] 46 | 47 | Fixture.startQueuesList = `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","EventList": "start","Message": "Queue status will follow"}}` 48 | 49 | Fixture.finishQueueList = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueStatusComplete","EventList": "Complete","ListItems": "351"}}` 50 | 51 | export default Fixture 52 | -------------------------------------------------------------------------------- /test/unit/specs/fixtures/TopStats.js: -------------------------------------------------------------------------------- 1 | const Fixture = {} 2 | 3 | // ======================================== 4 | Fixture.oneQueue = [ 5 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 6 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "5","Holdtime": "0","TalkTime": "0","Completed": "231","Abandoned": "120","ServiceLevel": "3.43","ServicelevelPerf": "0.0","Weight": "0"}}`, 7 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "1","Channel": "SIP/router01-0013ab9e","Uniqueid": "1509489741.3343730","CallerIDNum": "14383918247","CallerIDName": "14383918247","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "549"}}`, 8 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "2","Channel": "SIP/router01-0013ac19","Uniqueid": "1509489893.3344025","CallerIDNum": "14383958755","CallerIDName": "14383958755","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "396"}}`, 9 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "3","Channel": "SIP/router01-0013ac94","Uniqueid": "1509490108.3344364","CallerIDNum": "14384914339","CallerIDName": "14384914339","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "182"}}`, 10 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueEntry","Queue": "TechSupport","Position": "4","Channel": "SIP/router01-0013acae","Uniqueid": "1509490200.3344434","CallerIDNum": "14383964496","CallerIDName": "14383964496","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Wait": "90"}}` 11 | ] 12 | 13 | Fixture.callerAbandoned = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueCallerAbandon","Privilege": "agent,all","Queue": "TechSupport","Uniqueid": "1509490200.3344434","Position": "1","OriginalPosition": "1","HoldTime": "54"}}` 14 | // ======================================== 15 | 16 | // ======================================== 17 | Fixture.newCallersJoins = [ 18 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 19 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "5","Holdtime": "0","TalkTime": "0","Completed": "231","Abandoned": "120","ServiceLevel": "3.43","ServicelevelPerf": "0.0","Weight": "0"}}`, 20 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "Join","Privilege": "call,all","Channel": "SIP/router01-00000039","CallerIDNum": "1000","CallerIDName": "Eric Gin","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Queue": "TechSupport","Position": "1","Count": "1","Uniqueid": "1510084369.69"}}`, 21 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "Join","Privilege": "call,all","Channel": "SIP/router01-0000003a","CallerIDNum": "1000","CallerIDName": "John Bar","ConnectedLineNum": "unknown","ConnectedLineName": "unknown","Queue": "TechSupport","Position": "2","Count": "2","Uniqueid": "1510084379.43"}}` 22 | ] 23 | 24 | Fixture.callerLeaves = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "Leave","Privilege": "call,all","Channel": "SIP/router01-0000003a","Queue": "TechSupport","Count": "1","Position": "2","Uniqueid": "1510084379.43"}}` 25 | Fixture.queueCallerLeave = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueCallerLeave","Privilege": "agent,all","Channel": "SIP/router01-0000003a","ChannelState": "4","ChannelStateDesc": "Ring","CallerIDNum": "5555","CallerIDName": "","ConnectedLineNum": "","ConnectedLineName": "","Language": "en","AccountCode": "","Context": "local-users","Exten": "sales","Priority": "2","Uniqueid": "1510084379.43","Linkedid": "1510613519.66","Queue": "TechSupport","Count": "0","Position": "1"}}` 26 | // ======================================== 27 | 28 | // ======================================== 29 | Fixture.oneQueueWithThreeMembers = [ 30 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 31 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "5","Holdtime": "0","TalkTime": "0","Completed": "231","Abandoned": "120","ServiceLevel": "3.43","ServicelevelPerf": "0.0","Weight": "0"}}`, 32 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1004@sc360.modulis.clusterpbx.ca","Location": "Local/1004@from-queue/n","StateInterface": "Local/1004@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "1","PausedReason": ""}}`, 33 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1005@sc360.modulis.clusterpbx.ca","Location": "Local/1005@from-queue/n","StateInterface": "Local/1005@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "0","PausedReason": ""}}`, 34 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1006@sc360.modulis.clusterpbx.ca","Location": "Local/1006@from-queue/n","StateInterface": "Local/1006@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "0","PausedReason": ""}}` 35 | ] 36 | 37 | Fixture.addMember = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMemberAdded","Privilege": "agent,all","MemberName": "5555@sc360.modulis.clusterpbx.ca","Interface": "Local/1800@from-queue/n","Membership": "dynamic","Queue": "TechSupport","StateInterface": "Local/1800@from-queue/n","Penalty": "0","CallsTaken": "0","InCall": "0","LastCall": "0","Status": "4","Ringinuse": "1","Paused": "0","PausedReason": ""}}` 38 | Fixture.removeMember = `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMemberRemoved","Privilege": "agent,all","MemberName": "1006@sc360.modulis.clusterpbx.ca","Interface": "Local/1006@from-queue/n","Membership": "dynamic","Queue": "TechSupport","StateInterface": "Local/1006@from-queue/n","Penalty": "0","CallsTaken": "0","InCall": "0","LastCall": "0","Status": "4","Ringinuse": "1","Paused": "0","PausedReason": ""}}` 39 | // ======================================== 40 | 41 | Fixture.oneQueueWithThreeMembersUpdate = [ 42 | `{ "type": 4, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Response": "Success","CoreStartupDate": "2017-11-01","CoreStartupTime": "18:43:57","CoreReloadDate": "2017-11-01","CoreReloadTime": "18:43:57","CoreCurrentCalls": "0"}}`, 43 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueParams","Queue": "TechSupport","Max": "0","Strategy": "ringall","Calls": "5","Holdtime": "0","TalkTime": "0","Completed": "231","Abandoned": "120","ServiceLevel": "3.43","ServicelevelPerf": "0.0","Weight": "0"}}`, 44 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1004@sc360.modulis.clusterpbx.ca","Location": "Local/1004@from-queue/n","StateInterface": "Local/1004@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "1","PausedReason": ""}}`, 45 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1005@sc360.modulis.clusterpbx.ca","Location": "Local/1005@from-queue/n","StateInterface": "Local/1005@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "0","PausedReason": ""}}`, 46 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1006@sc360.modulis.clusterpbx.ca","Location": "Local/1006@from-queue/n","StateInterface": "Local/1006@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "0","PausedReason": ""}}`, 47 | `{ "type": 3, "server_id": 1, "server_name": "asterisk01.local", "ssl": false, "data": {"Event": "QueueMember","Queue": "TechSupport","Name": "1006@sc360.modulis.clusterpbx.ca","Location": "Local/1006@from-queue/n","StateInterface": "Local/1006@from-queue/n","Membership": "static","Penalty": "0","CallsTaken": "0","LastCall": "0","InCall": "0","Status": "4","Paused": "1","PausedReason": ""}}` 48 | ] 49 | 50 | export default Fixture 51 | -------------------------------------------------------------------------------- /src/components/QueueData.vue: -------------------------------------------------------------------------------- 1 | 174 | 175 | 226 | 227 | 228 | 231 | -------------------------------------------------------------------------------- /src/components/QueuesList.vue: -------------------------------------------------------------------------------- 1 | 151 | 152 | 227 | 228 | 229 | 233 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------