60c4e292218d2174419496cf5ca0e11221731b00
[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 _0x77d3=['catch','getRealtimeQueues','inbound','map','get','paused','loggedIn','find','merge','pick','lodash','jayson/promise','client','http','available','waiting','busy','inUse','loggedInDb','notInUse','onHold','ringing','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result'];(function(_0x5b8ed9,_0x2c86ad){var _0x15a0a5=function(_0x128cfb){while(--_0x128cfb){_0x5b8ed9['push'](_0x5b8ed9['shift']());}};_0x15a0a5(++_0x2c86ad);}(_0x77d3,0xff));var _0x377d=function(_0x2c40bf,_0x5ce37a){_0x2c40bf=_0x2c40bf-0x0;var _0x31ab19=_0x77d3[_0x2c40bf];return _0x31ab19;};'use strict';var _=require(_0x377d('0x0'));var jayson=require(_0x377d('0x1'));var util=require('util');var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x377d('0x2')][_0x377d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x377d('0x4'),'loggedIn','paused',_0x377d('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x377d('0x6'),_0x377d('0x7'),'invalid',_0x377d('0x8'),_0x377d('0x9'),_0x377d('0xa'),_0x377d('0xb'),'ringInUse',_0x377d('0xc'),'unavailable',_0x377d('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x377d('0xe'),_0x377d('0xf'),_0x377d('0x10'),_0x377d('0x11'),_0x377d('0x12'),_0x377d('0x13'),_0x377d('0x14'),'startPredictive',_0x377d('0x15'),_0x377d('0x16'),_0x377d('0x17'),_0x377d('0x18'),_0x377d('0x19'),_0x377d('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x377d('0x1b'),_0x377d('0x1c'),'predictiveIntervalTotalCalls',_0x377d('0x1d'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x215a2e,_0x41bcd1){var _0x13dac4=_0x41bcd1===_0x377d('0x1e')?amiClient:routingClient;return _0x13dac4[_0x377d('0x1f')](_[_0x377d('0x20')](_0x41bcd1)+_0x377d('0x21'),_0x215a2e)[_0x377d('0x22')](function(_0x66d14d){if(_0x66d14d[_0x377d('0x23')])throw new Error(util[_0x377d('0x24')](_0x377d('0x25'),_0x41bcd1));return _0x66d14d[_0x377d('0x26')];})[_0x377d('0x27')](function(_0xc01be5){throw _0xc01be5;});}exports[_0x377d('0x28')]=getRealtimeQueues;function initializeQueues(_0x3073d1,_0xb33fd5,_0x546076,_0x6d15bc){var _0x321315=DEFAULT_QUEUE_ATTRIBUTES;if(_0x546076===_0x377d('0x1e')){if(_0x6d15bc===_0x377d('0x29')){_0x321315=_0x321315['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x6d15bc==='outbound'){_0x321315=_0x321315['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3073d1[_0x377d('0x2a')](function(_0x37f26d){var _0x31fdce=_0x37f26d[_0x377d('0x2b')]({'plain':!![]});_0x31fdce[_0x377d('0x2c')]=0x0;_0x31fdce['loggedInDb']=0x0;_0x31fdce[_0x377d('0x2d')]=0x0;_0x31fdce['available']=0x0;_0x31fdce[_0x377d('0x5')]=0x0;if(_0x546076===_0x377d('0x1e')){_0x31fdce[_0x377d('0xc')]=0x0;_0x31fdce['busy']=0x0;if(_0x6d15bc==='outbound'){_0x31fdce[_0x377d('0xe')]=0x0;_0x31fdce[_0x377d('0xf')]=0x0;}}var _0x58c061=_[_0x377d('0x2e')](_0xb33fd5,['id',_0x31fdce['id']]);if(_0x58c061){_[_0x377d('0x2f')](_0x31fdce,_[_0x377d('0x30')](_0x58c061,_0x321315));}return _0x31fdce;});}exports['initializeQueues']=initializeQueues;