9f27c700c2ee6455533f88d7a345fa058482e636
[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 _0x482a=['catch','getRealtimeQueues','inbound','concat','outbound','get','find','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x482a,0x139));var _0xa482=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x482a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa482('0x0'));var jayson=require(_0xa482('0x1'));var util=require(_0xa482('0x2'));var amiClient=jayson[_0xa482('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xa482('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xa482('0x5'),_0xa482('0x6'),_0xa482('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xa482('0x8'),'inUse',_0xa482('0x9'),_0xa482('0xa'),_0xa482('0xb'),_0xa482('0xc'),_0xa482('0xd'),_0xa482('0xe'),_0xa482('0xf'),_0xa482('0x10'),_0xa482('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa482('0x12'),_0xa482('0x13'),'message','statusMessage','dialActive',_0xa482('0x14'),_0xa482('0x15'),'startPredictive',_0xa482('0x16'),_0xa482('0x17'),_0xa482('0x18'),_0xa482('0x19'),_0xa482('0x1a'),'dialPredictiveInterval',_0xa482('0x1b'),_0xa482('0x1c'),'predictiveIntervalAvailable',_0xa482('0x1d'),_0xa482('0x1e'),_0xa482('0x1f'),_0xa482('0x20'),_0xa482('0x21'),_0xa482('0x22')];function getRealtimeQueues(_0x177cd7,_0x3124cb){var _0x5d613a=_0x3124cb===_0xa482('0x23')?amiClient:routingClient;return _0x5d613a[_0xa482('0x24')](_[_0xa482('0x25')](_0x3124cb)+_0xa482('0x26'),_0x177cd7)[_0xa482('0x27')](function(_0x2aeb83){if(_0x2aeb83[_0xa482('0x28')])throw new Error(util[_0xa482('0x29')](_0xa482('0x2a'),_0x3124cb));return _0x2aeb83[_0xa482('0x2b')];})[_0xa482('0x2c')](function(_0x35ba13){throw _0x35ba13;});}exports[_0xa482('0x2d')]=getRealtimeQueues;function initializeQueues(_0x26e14d,_0x48439a,_0x221b05,_0x261869){var _0x300630=DEFAULT_QUEUE_ATTRIBUTES;if(_0x221b05===_0xa482('0x23')){if(_0x261869===_0xa482('0x2e')){_0x300630=_0x300630[_0xa482('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x261869===_0xa482('0x30')){_0x300630=_0x300630['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26e14d['map'](function(_0x4ab119){var _0xca6e9d=_0x4ab119[_0xa482('0x31')]({'plain':!![]});_0xca6e9d[_0xa482('0x6')]=0x0;_0xca6e9d[_0xa482('0xa')]=0x0;_0xca6e9d[_0xa482('0x5')]=0x0;_0xca6e9d['available']=0x0;_0xca6e9d[_0xa482('0x7')]=0x0;if(_0x221b05===_0xa482('0x23')){_0xca6e9d[_0xa482('0xf')]=0x0;_0xca6e9d['busy']=0x0;if(_0x261869===_0xa482('0x30')){_0xca6e9d[_0xa482('0x12')]=0x0;_0xca6e9d[_0xa482('0x13')]=0x0;}}var _0x20b9ff=_[_0xa482('0x32')](_0x48439a,['id',_0xca6e9d['id']]);if(_0x20b9ff){_['merge'](_0xca6e9d,_['pick'](_0x20b9ff,_0x300630));}return _0xca6e9d;});}exports['initializeQueues']=initializeQueues;