Built motion from commit d1eab355.|2.6.28
[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 _0x598e=['erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','talking','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','ringInUse','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','erlangCalls','erlangCallToSecond'];(function(_0x5d6324,_0x4990e6){var _0x54fae4=function(_0x34cb5c){while(--_0x34cb5c){_0x5d6324['push'](_0x5d6324['shift']());}};_0x54fae4(++_0x4990e6);}(_0x598e,0x12b));var _0xe598=function(_0x19e6e5,_0x13352d){_0x19e6e5=_0x19e6e5-0x0;var _0x149c2f=_0x598e[_0x19e6e5];return _0x149c2f;};'use strict';var _=require(_0xe598('0x0'));var jayson=require(_0xe598('0x1'));var util=require(_0xe598('0x2'));var amiClient=jayson[_0xe598('0x3')][_0xe598('0x4')]({'port':0x232a});var routingClient=jayson[_0xe598('0x3')][_0xe598('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe598('0x5'),_0xe598('0x6'),_0xe598('0x7'),_0xe598('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xe598('0x9'),_0xe598('0xa'),'invalid',_0xe598('0xb'),'notInUse',_0xe598('0xc'),_0xe598('0xd'),_0xe598('0xe'),'talking','unavailable',_0xe598('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe598('0x10'),_0xe598('0x11'),_0xe598('0x12'),_0xe598('0x13'),_0xe598('0x14'),_0xe598('0x15'),'Trunk',_0xe598('0x16'),'startProgressive',_0xe598('0x17'),_0xe598('0x18'),'erlangAbandonmentRate',_0xe598('0x19'),_0xe598('0x1a'),'dialPredictiveIntervalMaxThreshold',_0xe598('0x1b'),'predictiveIntervalAvailable',_0xe598('0x1c'),_0xe598('0x1d'),_0xe598('0x1e'),_0xe598('0x1f'),_0xe598('0x20'),_0xe598('0x21')];function getRealtimeQueues(_0x42bb95,_0xbc1dd){var _0x671397=_0xbc1dd===_0xe598('0x22')?amiClient:routingClient;return _0x671397[_0xe598('0x23')](_[_0xe598('0x24')](_0xbc1dd)+_0xe598('0x25'),_0x42bb95)[_0xe598('0x26')](function(_0x32aefc){if(_0x32aefc[_0xe598('0x27')])throw new Error(util['format'](_0xe598('0x28'),_0xbc1dd));return _0x32aefc[_0xe598('0x29')];})[_0xe598('0x2a')](function(_0xdc504d){throw _0xdc504d;});}exports[_0xe598('0x2b')]=getRealtimeQueues;function initializeQueues(_0x4f40ea,_0x2a0037,_0x3913a8,_0xc97a47){var _0x3a540f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3913a8===_0xe598('0x22')){if(_0xc97a47===_0xe598('0x2c')){_0x3a540f=_0x3a540f[_0xe598('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0xc97a47==='outbound'){_0x3a540f=_0x3a540f[_0xe598('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4f40ea[_0xe598('0x2e')](function(_0x2dbcbe){var _0x5cc683=_0x2dbcbe[_0xe598('0x2f')]({'plain':!![]});_0x5cc683['paused']=0x0;_0x5cc683[_0xe598('0xb')]=0x0;_0x5cc683[_0xe598('0x6')]=0x0;_0x5cc683[_0xe598('0x5')]=0x0;_0x5cc683[_0xe598('0x8')]=0x0;if(_0x3913a8===_0xe598('0x22')){_0x5cc683[_0xe598('0x30')]=0x0;_0x5cc683[_0xe598('0x9')]=0x0;if(_0xc97a47===_0xe598('0x31')){_0x5cc683[_0xe598('0x10')]=0x0;_0x5cc683['originated']=0x0;}}var _0x4863c6=_[_0xe598('0x32')](_0x2a0037,['id',_0x5cc683['id']]);if(_0x4863c6){_[_0xe598('0x33')](_0x5cc683,_[_0xe598('0x34')](_0x4863c6,_0x3a540f));}return _0x5cc683;});}exports[_0xe598('0x35')]=initializeQueues;