Built motion from commit 53172ac8.|2.6.30
[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 _0xe1b2=['result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','paused','busy','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe1b2,0x80));var _0x2e1b=function(_0x5b95df,_0x59dcc5){_0x5b95df=_0x5b95df-0x0;var _0x50df95=_0xe1b2[_0x5b95df];return _0x50df95;};'use strict';var _=require(_0x2e1b('0x0'));var jayson=require(_0x2e1b('0x1'));var util=require(_0x2e1b('0x2'));var amiClient=jayson[_0x2e1b('0x3')][_0x2e1b('0x4')]({'port':0x232a});var routingClient=jayson[_0x2e1b('0x3')][_0x2e1b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x2e1b('0x5'),_0x2e1b('0x6'),'paused',_0x2e1b('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x2e1b('0x8'),_0x2e1b('0x9'),'loggedInDb',_0x2e1b('0xa'),_0x2e1b('0xb'),_0x2e1b('0xc'),_0x2e1b('0xd'),_0x2e1b('0xe'),_0x2e1b('0xf'),_0x2e1b('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x2e1b('0x11'),_0x2e1b('0x12'),'message','statusMessage',_0x2e1b('0x13'),_0x2e1b('0x14'),_0x2e1b('0x15'),_0x2e1b('0x16'),_0x2e1b('0x17'),_0x2e1b('0x18'),_0x2e1b('0x19'),_0x2e1b('0x1a'),_0x2e1b('0x1b'),_0x2e1b('0x1c'),_0x2e1b('0x1d'),_0x2e1b('0x1e'),_0x2e1b('0x1f'),_0x2e1b('0x20'),_0x2e1b('0x21'),'predictiveIntervalDroppedCallsTimeout',_0x2e1b('0x22'),_0x2e1b('0x23'),_0x2e1b('0x24')];function getRealtimeQueues(_0x37dfc7,_0x43604a){var _0x349294=_0x43604a===_0x2e1b('0x25')?amiClient:routingClient;return _0x349294[_0x2e1b('0x26')](_[_0x2e1b('0x27')](_0x43604a)+_0x2e1b('0x28'),_0x37dfc7)[_0x2e1b('0x29')](function(_0x305e51){if(_0x305e51[_0x2e1b('0x2a')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x43604a));return _0x305e51[_0x2e1b('0x2b')];})[_0x2e1b('0x2c')](function(_0x356965){throw _0x356965;});}exports[_0x2e1b('0x2d')]=getRealtimeQueues;function initializeQueues(_0x745dbf,_0x11d6ec,_0x26ee3c,_0x635e24){var _0x18cb8a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x26ee3c===_0x2e1b('0x25')){if(_0x635e24===_0x2e1b('0x2e')){_0x18cb8a=_0x18cb8a[_0x2e1b('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x635e24===_0x2e1b('0x30')){_0x18cb8a=_0x18cb8a['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x745dbf[_0x2e1b('0x31')](function(_0x34ec83){var _0x335004=_0x34ec83[_0x2e1b('0x32')]({'plain':!![]});_0x335004[_0x2e1b('0x33')]=0x0;_0x335004['loggedInDb']=0x0;_0x335004['loggedIn']=0x0;_0x335004[_0x2e1b('0x5')]=0x0;_0x335004['waiting']=0x0;if(_0x26ee3c===_0x2e1b('0x25')){_0x335004['talking']=0x0;_0x335004[_0x2e1b('0x34')]=0x0;if(_0x635e24==='outbound'){_0x335004['pTalking']=0x0;_0x335004['originated']=0x0;}}var _0x13a274=_[_0x2e1b('0x35')](_0x11d6ec,['id',_0x335004['id']]);if(_0x13a274){_[_0x2e1b('0x36')](_0x335004,_[_0x2e1b('0x37')](_0x13a274,_0x18cb8a));}return _0x335004;});}exports[_0x2e1b('0x38')]=initializeQueues;