Built motion from commit 8356fca3.|2.6.19
[motion2.git] / server / components / realtime / queues.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x298e=['startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','get','loggedIn','outbound','pTalking','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','talking','unavailable','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice'];(function(_0x221888,_0x1d2891){var _0x18bc6c=function(_0x485060){while(--_0x485060){_0x221888['push'](_0x221888['shift']());}};_0x18bc6c(++_0x1d2891);}(_0x298e,0x1ef));var _0xe298=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x298e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe298('0x0'));var jayson=require(_0xe298('0x1'));var util=require(_0xe298('0x2'));var amiClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232a});var routingClient=jayson[_0xe298('0x3')][_0xe298('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe298('0x5'),'loggedIn',_0xe298('0x6'),_0xe298('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe298('0x8'),_0xe298('0x9'),'invalid',_0xe298('0xa'),'notInUse',_0xe298('0xb'),_0xe298('0xc'),'ringInUse',_0xe298('0xd'),_0xe298('0xe'),_0xe298('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0xe298('0x10'),_0xe298('0x11'),_0xe298('0x12'),_0xe298('0x13'),_0xe298('0x14'),_0xe298('0x15'),'erlangCalls','erlangCallToSecond',_0xe298('0x16'),_0xe298('0x17'),_0xe298('0x18'),_0xe298('0x19'),_0xe298('0x1a'),_0xe298('0x1b'),_0xe298('0x1c'),_0xe298('0x1d'),_0xe298('0x1e'),_0xe298('0x1f'),_0xe298('0x20'),_0xe298('0x21')];function getRealtimeQueues(_0x4aa75e,_0x35b313){var _0xf24fc0=_0x35b313===_0xe298('0x22')?amiClient:routingClient;return _0xf24fc0['request'](_[_0xe298('0x23')](_0x35b313)+_0xe298('0x24'),_0x4aa75e)[_0xe298('0x25')](function(_0x5ed73d){if(_0x5ed73d['error'])throw new Error(util[_0xe298('0x26')](_0xe298('0x27'),_0x35b313));return _0x5ed73d[_0xe298('0x28')];})[_0xe298('0x29')](function(_0x212e4a){throw _0x212e4a;});}exports[_0xe298('0x2a')]=getRealtimeQueues;function initializeQueues(_0x33f9c9,_0x34169f,_0x4006e1,_0x2dfca3){var _0x1a056f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4006e1===_0xe298('0x22')){if(_0x2dfca3===_0xe298('0x2b')){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2dfca3==='outbound'){_0x1a056f=_0x1a056f[_0xe298('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x33f9c9['map'](function(_0x169c2e){var _0xf63556=_0x169c2e[_0xe298('0x2d')]({'plain':!![]});_0xf63556['paused']=0x0;_0xf63556[_0xe298('0xa')]=0x0;_0xf63556[_0xe298('0x2e')]=0x0;_0xf63556['available']=0x0;_0xf63556[_0xe298('0x7')]=0x0;if(_0x4006e1===_0xe298('0x22')){_0xf63556[_0xe298('0xd')]=0x0;_0xf63556[_0xe298('0x8')]=0x0;if(_0x2dfca3===_0xe298('0x2f')){_0xf63556[_0xe298('0x30')]=0x0;_0xf63556[_0xe298('0x31')]=0x0;}}var _0x15389a=_['find'](_0x34169f,['id',_0xf63556['id']]);if(_0x15389a){_[_0xe298('0x32')](_0xf63556,_[_0xe298('0x33')](_0x15389a,_0x1a056f));}return _0xf63556;});}exports[_0xe298('0x34')]=initializeQueues;