96bc1f7dfb2260c9284f70400cce8d9f5b1b3d09
[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 _0xcc19=['jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive','Trunk','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','voice','inbound','concat','outbound','map','get','originated','find','merge','pick','initializeQueues','lodash'];(function(_0x269d1b,_0x5baebe){var _0x58df11=function(_0x5eb5c0){while(--_0x5eb5c0){_0x269d1b['push'](_0x269d1b['shift']());}};_0x58df11(++_0x5baebe);}(_0xcc19,0x1e5));var _0x9cc1=function(_0xfa260b,_0xd2d0d){_0xfa260b=_0xfa260b-0x0;var _0x48fb84=_0xcc19[_0xfa260b];return _0x48fb84;};'use strict';var _=require(_0x9cc1('0x0'));var jayson=require(_0x9cc1('0x1'));var util=require(_0x9cc1('0x2'));var amiClient=jayson[_0x9cc1('0x3')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x9cc1('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9cc1('0x5'),_0x9cc1('0x6'),_0x9cc1('0x7'),_0x9cc1('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x9cc1('0x9'),_0x9cc1('0xa'),_0x9cc1('0xb'),_0x9cc1('0xc'),'notInUse',_0x9cc1('0xd'),_0x9cc1('0xe'),_0x9cc1('0xf'),_0x9cc1('0x10'),_0x9cc1('0x11'),_0x9cc1('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9cc1('0x13'),'originated',_0x9cc1('0x14'),_0x9cc1('0x15'),_0x9cc1('0x16'),'dialMethod',_0x9cc1('0x17'),'startPredictive',_0x9cc1('0x18'),_0x9cc1('0x19'),'erlangCallToSecond','erlangAbandonmentRate',_0x9cc1('0x1a'),_0x9cc1('0x1b'),_0x9cc1('0x1c'),_0x9cc1('0x1d'),'predictiveIntervalAvailable',_0x9cc1('0x1e'),'predictiveIntervalAnsweredCalls',_0x9cc1('0x1f'),_0x9cc1('0x20'),_0x9cc1('0x21'),_0x9cc1('0x22')];function getRealtimeQueues(_0x51e931,_0x366375){var _0x401ae8=_0x366375==='voice'?amiClient:routingClient;return _0x401ae8[_0x9cc1('0x23')](_[_0x9cc1('0x24')](_0x366375)+_0x9cc1('0x25'),_0x51e931)[_0x9cc1('0x26')](function(_0x18e1c5){if(_0x18e1c5['error'])throw new Error(util[_0x9cc1('0x27')](_0x9cc1('0x28'),_0x366375));return _0x18e1c5[_0x9cc1('0x29')];})['catch'](function(_0x3792f3){throw _0x3792f3;});}exports[_0x9cc1('0x2a')]=getRealtimeQueues;function initializeQueues(_0x35563f,_0xb4ee5,_0x3f84c3,_0x7dacb1){var _0x4e8566=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3f84c3===_0x9cc1('0x2b')){if(_0x7dacb1===_0x9cc1('0x2c')){_0x4e8566=_0x4e8566[_0x9cc1('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x7dacb1===_0x9cc1('0x2e')){_0x4e8566=_0x4e8566[_0x9cc1('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x35563f[_0x9cc1('0x2f')](function(_0xc3aecf){var _0x1af5e4=_0xc3aecf[_0x9cc1('0x30')]({'plain':!![]});_0x1af5e4[_0x9cc1('0x7')]=0x0;_0x1af5e4['loggedInDb']=0x0;_0x1af5e4['loggedIn']=0x0;_0x1af5e4[_0x9cc1('0x5')]=0x0;_0x1af5e4['waiting']=0x0;if(_0x3f84c3===_0x9cc1('0x2b')){_0x1af5e4[_0x9cc1('0x10')]=0x0;_0x1af5e4[_0x9cc1('0x9')]=0x0;if(_0x7dacb1===_0x9cc1('0x2e')){_0x1af5e4[_0x9cc1('0x13')]=0x0;_0x1af5e4[_0x9cc1('0x31')]=0x0;}}var _0x1041d2=_[_0x9cc1('0x32')](_0xb4ee5,['id',_0x1af5e4['id']]);if(_0x1041d2){_[_0x9cc1('0x33')](_0x1af5e4,_[_0x9cc1('0x34')](_0x1041d2,_0x4e8566));}return _0x1af5e4;});}exports[_0x9cc1('0x35')]=initializeQueues;