Built motion from commit 953226e6.|2.6.32
[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 _0x6d49=['format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','concat','outbound','map','available','talking','pTalking','find','pick','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error'];(function(_0x405c74,_0x26cf4d){var _0x51b8de=function(_0x285556){while(--_0x285556){_0x405c74['push'](_0x405c74['shift']());}};_0x51b8de(++_0x26cf4d);}(_0x6d49,0xdc));var _0x96d4=function(_0x2ec729,_0x5adf4b){_0x2ec729=_0x2ec729-0x0;var _0x4a03af=_0x6d49[_0x2ec729];return _0x4a03af;};'use strict';var _=require(_0x96d4('0x0'));var jayson=require(_0x96d4('0x1'));var util=require(_0x96d4('0x2'));var amiClient=jayson[_0x96d4('0x3')][_0x96d4('0x4')]({'port':0x232a});var routingClient=jayson[_0x96d4('0x3')][_0x96d4('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x96d4('0x5'),_0x96d4('0x6'),_0x96d4('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x96d4('0x8'),_0x96d4('0x9'),_0x96d4('0xa'),_0x96d4('0xb'),_0x96d4('0xc'),_0x96d4('0xd'),_0x96d4('0xe'),'ringInUse','talking','unavailable',_0x96d4('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x96d4('0x10'),_0x96d4('0x11'),_0x96d4('0x12'),_0x96d4('0x13'),_0x96d4('0x14'),_0x96d4('0x15'),_0x96d4('0x16'),_0x96d4('0x17'),_0x96d4('0x18'),'erlangCallToSecond',_0x96d4('0x19'),_0x96d4('0x1a'),_0x96d4('0x1b'),_0x96d4('0x1c'),_0x96d4('0x1d'),_0x96d4('0x1e'),_0x96d4('0x1f'),'predictiveIntervalAnsweredCalls',_0x96d4('0x20'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x96d4('0x21')];function getRealtimeQueues(_0x423a81,_0x363451){var _0x4c4b6a=_0x363451===_0x96d4('0x22')?amiClient:routingClient;return _0x4c4b6a[_0x96d4('0x23')](_[_0x96d4('0x24')](_0x363451)+_0x96d4('0x25'),_0x423a81)[_0x96d4('0x26')](function(_0xc4f428){if(_0xc4f428[_0x96d4('0x27')])throw new Error(util[_0x96d4('0x28')](_0x96d4('0x29'),_0x363451));return _0xc4f428[_0x96d4('0x2a')];})['catch'](function(_0x2436b4){throw _0x2436b4;});}exports[_0x96d4('0x2b')]=getRealtimeQueues;function initializeQueues(_0x155a90,_0x329cb8,_0x3bdd56,_0x2d3b4c){var _0x24f47d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3bdd56==='voice'){if(_0x2d3b4c==='inbound'){_0x24f47d=_0x24f47d[_0x96d4('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d3b4c===_0x96d4('0x2d')){_0x24f47d=_0x24f47d[_0x96d4('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x155a90[_0x96d4('0x2e')](function(_0x5859f5){var _0x526231=_0x5859f5['get']({'plain':!![]});_0x526231['paused']=0x0;_0x526231[_0x96d4('0xb')]=0x0;_0x526231['loggedIn']=0x0;_0x526231[_0x96d4('0x2f')]=0x0;_0x526231[_0x96d4('0x7')]=0x0;if(_0x3bdd56===_0x96d4('0x22')){_0x526231[_0x96d4('0x30')]=0x0;_0x526231[_0x96d4('0x8')]=0x0;if(_0x2d3b4c===_0x96d4('0x2d')){_0x526231[_0x96d4('0x31')]=0x0;_0x526231[_0x96d4('0x10')]=0x0;}}var _0x3b8e0d=_[_0x96d4('0x32')](_0x329cb8,['id',_0x526231['id']]);if(_0x3b8e0d){_['merge'](_0x526231,_[_0x96d4('0x33')](_0x3b8e0d,_0x24f47d));}return _0x526231;});}exports['initializeQueues']=initializeQueues;