Built motion from commit 9d0783e6.|2.6.13
[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 _0x0e0e=['unavailable','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','concat','outbound','map','get','loggedInDb','merge','pick','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking'];(function(_0x347851,_0x2e32a3){var _0x1eb7cc=function(_0xbcc989){while(--_0xbcc989){_0x347851['push'](_0x347851['shift']());}};_0x1eb7cc(++_0x2e32a3);}(_0x0e0e,0x8c));var _0xe0e0=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0x0e0e[_0x3f5f08];return _0x566dd9;};'use strict';var _=require('lodash');var jayson=require(_0xe0e0('0x0'));var util=require(_0xe0e0('0x1'));var amiClient=jayson[_0xe0e0('0x2')][_0xe0e0('0x3')]({'port':0x232a});var routingClient=jayson[_0xe0e0('0x2')][_0xe0e0('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe0e0('0x4'),_0xe0e0('0x5'),_0xe0e0('0x6'),_0xe0e0('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe0e0('0x8'),_0xe0e0('0x9'),_0xe0e0('0xa'),'loggedInDb',_0xe0e0('0xb'),_0xe0e0('0xc'),_0xe0e0('0xd'),_0xe0e0('0xe'),_0xe0e0('0xf'),_0xe0e0('0x10'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe0e0('0x11'),_0xe0e0('0x12'),_0xe0e0('0x13'),_0xe0e0('0x14'),_0xe0e0('0x15'),_0xe0e0('0x16'),_0xe0e0('0x17'),_0xe0e0('0x18'),'startProgressive',_0xe0e0('0x19'),'erlangCallToSecond',_0xe0e0('0x1a'),_0xe0e0('0x1b'),'dialPredictiveInterval',_0xe0e0('0x1c'),_0xe0e0('0x1d'),_0xe0e0('0x1e'),_0xe0e0('0x1f'),_0xe0e0('0x20'),'predictiveIntervalDroppedCallsTimeout',_0xe0e0('0x21'),_0xe0e0('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3f3e48,_0x28fcfa){var _0x46e864=_0x28fcfa===_0xe0e0('0x23')?amiClient:routingClient;return _0x46e864[_0xe0e0('0x24')](_[_0xe0e0('0x25')](_0x28fcfa)+'Queues',_0x3f3e48)[_0xe0e0('0x26')](function(_0x313d5f){if(_0x313d5f[_0xe0e0('0x27')])throw new Error(util[_0xe0e0('0x28')](_0xe0e0('0x29'),_0x28fcfa));return _0x313d5f['result'];})[_0xe0e0('0x2a')](function(_0x4769ab){throw _0x4769ab;});}exports[_0xe0e0('0x2b')]=getRealtimeQueues;function initializeQueues(_0x32603d,_0x3cc118,_0xc03ac4,_0x2466f6){var _0x27f54c=DEFAULT_QUEUE_ATTRIBUTES;if(_0xc03ac4===_0xe0e0('0x23')){if(_0x2466f6==='inbound'){_0x27f54c=_0x27f54c[_0xe0e0('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2466f6===_0xe0e0('0x2d')){_0x27f54c=_0x27f54c[_0xe0e0('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x32603d[_0xe0e0('0x2e')](function(_0xbc3dde){var _0xf4a6d0=_0xbc3dde[_0xe0e0('0x2f')]({'plain':!![]});_0xf4a6d0[_0xe0e0('0x6')]=0x0;_0xf4a6d0[_0xe0e0('0x30')]=0x0;_0xf4a6d0['loggedIn']=0x0;_0xf4a6d0[_0xe0e0('0x4')]=0x0;_0xf4a6d0[_0xe0e0('0x7')]=0x0;if(_0xc03ac4==='voice'){_0xf4a6d0['talking']=0x0;_0xf4a6d0[_0xe0e0('0x8')]=0x0;if(_0x2466f6==='outbound'){_0xf4a6d0['pTalking']=0x0;_0xf4a6d0[_0xe0e0('0x12')]=0x0;}}var _0x5a7721=_['find'](_0x3cc118,['id',_0xf4a6d0['id']]);if(_0x5a7721){_[_0xe0e0('0x31')](_0xf4a6d0,_[_0xe0e0('0x32')](_0x5a7721,_0x27f54c));}return _0xf4a6d0;});}exports[_0xe0e0('0x33')]=initializeQueues;