cd06a966865d6c3e02d41f4e760f3fa9973294e6
[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 _0xcc81=['then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','concat','outbound','map','get','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase'];(function(_0x16efae,_0x2d1d8b){var _0x49f0d9=function(_0x53a9dd){while(--_0x53a9dd){_0x16efae['push'](_0x16efae['shift']());}};_0x49f0d9(++_0x2d1d8b);}(_0xcc81,0x14d));var _0x1cc8=function(_0x4a18f0,_0x903c50){_0x4a18f0=_0x4a18f0-0x0;var _0x158316=_0xcc81[_0x4a18f0];return _0x158316;};'use strict';var _=require(_0x1cc8('0x0'));var jayson=require(_0x1cc8('0x1'));var util=require(_0x1cc8('0x2'));var amiClient=jayson[_0x1cc8('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x1cc8('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1cc8('0x5'),_0x1cc8('0x6'),_0x1cc8('0x7'),_0x1cc8('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x1cc8('0x9'),_0x1cc8('0xa'),_0x1cc8('0xb'),_0x1cc8('0xc'),_0x1cc8('0xd'),_0x1cc8('0xe'),'ringing','ringInUse',_0x1cc8('0xf'),_0x1cc8('0x10'),_0x1cc8('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1cc8('0x12'),'originated',_0x1cc8('0x13'),_0x1cc8('0x14'),_0x1cc8('0x15'),_0x1cc8('0x16'),'Trunk',_0x1cc8('0x17'),_0x1cc8('0x18'),_0x1cc8('0x19'),_0x1cc8('0x1a'),'erlangAbandonmentRate',_0x1cc8('0x1b'),_0x1cc8('0x1c'),'dialPredictiveIntervalMaxThreshold',_0x1cc8('0x1d'),_0x1cc8('0x1e'),_0x1cc8('0x1f'),_0x1cc8('0x20'),'predictiveIntervalDroppedCallsTimeout',_0x1cc8('0x21'),_0x1cc8('0x22'),_0x1cc8('0x23')];function getRealtimeQueues(_0x5529c4,_0x576d10){var _0x5d8113=_0x576d10===_0x1cc8('0x24')?amiClient:routingClient;return _0x5d8113['request'](_[_0x1cc8('0x25')](_0x576d10)+'Queues',_0x5529c4)[_0x1cc8('0x26')](function(_0x3680df){if(_0x3680df[_0x1cc8('0x27')])throw new Error(util[_0x1cc8('0x28')](_0x1cc8('0x29'),_0x576d10));return _0x3680df['result'];})[_0x1cc8('0x2a')](function(_0x21a14b){throw _0x21a14b;});}exports[_0x1cc8('0x2b')]=getRealtimeQueues;function initializeQueues(_0x590a87,_0x4c6a4b,_0x3f9309,_0x32bc60){var _0x591c9b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f9309===_0x1cc8('0x24')){if(_0x32bc60===_0x1cc8('0x2c')){_0x591c9b=_0x591c9b[_0x1cc8('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x32bc60===_0x1cc8('0x2e')){_0x591c9b=_0x591c9b[_0x1cc8('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x590a87[_0x1cc8('0x2f')](function(_0x3158a0){var _0x4821ae=_0x3158a0[_0x1cc8('0x30')]({'plain':!![]});_0x4821ae[_0x1cc8('0x7')]=0x0;_0x4821ae[_0x1cc8('0xc')]=0x0;_0x4821ae[_0x1cc8('0x6')]=0x0;_0x4821ae[_0x1cc8('0x5')]=0x0;_0x4821ae[_0x1cc8('0x8')]=0x0;if(_0x3f9309===_0x1cc8('0x24')){_0x4821ae[_0x1cc8('0xf')]=0x0;_0x4821ae[_0x1cc8('0x9')]=0x0;if(_0x32bc60==='outbound'){_0x4821ae[_0x1cc8('0x12')]=0x0;_0x4821ae[_0x1cc8('0x31')]=0x0;}}var _0x2fc18d=_['find'](_0x4c6a4b,['id',_0x4821ae['id']]);if(_0x2fc18d){_[_0x1cc8('0x32')](_0x4821ae,_[_0x1cc8('0x33')](_0x2fc18d,_0x591c9b));}return _0x4821ae;});}exports[_0x1cc8('0x34')]=initializeQueues;