Built motion from commit 64a6f4bc.|2.6.26
[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 _0x10db=['message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','format','result','catch','concat','outbound','map','get','loggedIn','find','merge','lodash','util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated'];(function(_0x77d026,_0x55bd7f){var _0x370212=function(_0x52164d){while(--_0x52164d){_0x77d026['push'](_0x77d026['shift']());}};_0x370212(++_0x55bd7f);}(_0x10db,0x13d));var _0xb10d=function(_0xc71bf6,_0x5d0ae4){_0xc71bf6=_0xc71bf6-0x0;var _0x1f7f1a=_0x10db[_0xc71bf6];return _0x1f7f1a;};'use strict';var _=require(_0xb10d('0x0'));var jayson=require('jayson/promise');var util=require(_0xb10d('0x1'));var amiClient=jayson[_0xb10d('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xb10d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xb10d('0x4'),'loggedIn',_0xb10d('0x5'),_0xb10d('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xb10d('0x7'),_0xb10d('0x8'),_0xb10d('0x9'),_0xb10d('0xa'),'notInUse',_0xb10d('0xb'),_0xb10d('0xc'),_0xb10d('0xd'),_0xb10d('0xe'),_0xb10d('0xf'),_0xb10d('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb10d('0x11'),_0xb10d('0x12'),_0xb10d('0x13'),_0xb10d('0x14'),_0xb10d('0x15'),_0xb10d('0x16'),'Trunk',_0xb10d('0x17'),_0xb10d('0x18'),_0xb10d('0x19'),_0xb10d('0x1a'),_0xb10d('0x1b'),'erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xb10d('0x1c'),_0xb10d('0x1d'),'predictiveIntervalTotalCalls',_0xb10d('0x1e'),_0xb10d('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0xb10d('0x20'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x115a34,_0x2727f0){var _0x298f56=_0x2727f0===_0xb10d('0x21')?amiClient:routingClient;return _0x298f56[_0xb10d('0x22')](_[_0xb10d('0x23')](_0x2727f0)+'Queues',_0x115a34)[_0xb10d('0x24')](function(_0x16e2c0){if(_0x16e2c0[_0xb10d('0x25')])throw new Error(util[_0xb10d('0x26')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x2727f0));return _0x16e2c0[_0xb10d('0x27')];})[_0xb10d('0x28')](function(_0x860f49){throw _0x860f49;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1845da,_0x5d5cdb,_0x20f0cf,_0x46e8cd){var _0xd25a07=DEFAULT_QUEUE_ATTRIBUTES;if(_0x20f0cf===_0xb10d('0x21')){if(_0x46e8cd==='inbound'){_0xd25a07=_0xd25a07[_0xb10d('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x46e8cd===_0xb10d('0x2a')){_0xd25a07=_0xd25a07[_0xb10d('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1845da[_0xb10d('0x2b')](function(_0x4d6bb6){var _0x51f3a4=_0x4d6bb6[_0xb10d('0x2c')]({'plain':!![]});_0x51f3a4['paused']=0x0;_0x51f3a4['loggedInDb']=0x0;_0x51f3a4[_0xb10d('0x2d')]=0x0;_0x51f3a4[_0xb10d('0x4')]=0x0;_0x51f3a4['waiting']=0x0;if(_0x20f0cf===_0xb10d('0x21')){_0x51f3a4['talking']=0x0;_0x51f3a4[_0xb10d('0x7')]=0x0;if(_0x46e8cd===_0xb10d('0x2a')){_0x51f3a4['pTalking']=0x0;_0x51f3a4[_0xb10d('0x12')]=0x0;}}var _0xc881a4=_[_0xb10d('0x2e')](_0x5d5cdb,['id',_0x51f3a4['id']]);if(_0xc881a4){_[_0xb10d('0x2f')](_0x51f3a4,_['pick'](_0xc881a4,_0xd25a07));}return _0x51f3a4;});}exports['initializeQueues']=initializeQueues;