Built motion from commit e02f907f.|2.6.14
[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 _0xdd78=['message','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','result','catch','voice','outbound','concat','map','get','find','merge','pick','jayson/promise','util','http','client','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','onHold','ringInUse','talking','unavailable','unknown','originated'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xdd78,0x157));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var jayson=require(_0x8dd7('0x0'));var util=require(_0x8dd7('0x1'));var amiClient=jayson['client'][_0x8dd7('0x2')]({'port':0x232a});var routingClient=jayson[_0x8dd7('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8dd7('0x4'),_0x8dd7('0x5'),'paused',_0x8dd7('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x8dd7('0x7'),_0x8dd7('0x8'),_0x8dd7('0x9'),_0x8dd7('0xa'),'notInUse',_0x8dd7('0xb'),'ringing',_0x8dd7('0xc'),_0x8dd7('0xd'),_0x8dd7('0xe'),_0x8dd7('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x8dd7('0x10'),_0x8dd7('0x11'),'statusMessage','dialActive',_0x8dd7('0x12'),_0x8dd7('0x13'),_0x8dd7('0x14'),_0x8dd7('0x15'),_0x8dd7('0x16'),_0x8dd7('0x17'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x8dd7('0x18'),_0x8dd7('0x19'),_0x8dd7('0x1a'),'predictiveIntervalDroppedCallsTimeout',_0x8dd7('0x1b'),_0x8dd7('0x1c'),_0x8dd7('0x1d')];function getRealtimeQueues(_0x1a3b2b,_0xe21a3){var _0x4acdfb=_0xe21a3==='voice'?amiClient:routingClient;return _0x4acdfb[_0x8dd7('0x1e')](_[_0x8dd7('0x1f')](_0xe21a3)+_0x8dd7('0x20'),_0x1a3b2b)['then'](function(_0x595b5b){if(_0x595b5b[_0x8dd7('0x21')])throw new Error(util[_0x8dd7('0x22')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xe21a3));return _0x595b5b[_0x8dd7('0x23')];})[_0x8dd7('0x24')](function(_0x2999a9){throw _0x2999a9;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x8a5af0,_0x340937,_0x526c24,_0x121995){var _0x42c02f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x526c24===_0x8dd7('0x25')){if(_0x121995==='inbound'){_0x42c02f=_0x42c02f['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x121995===_0x8dd7('0x26')){_0x42c02f=_0x42c02f[_0x8dd7('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x8a5af0[_0x8dd7('0x28')](function(_0x3bf43f){var _0x27b3b5=_0x3bf43f[_0x8dd7('0x29')]({'plain':!![]});_0x27b3b5['paused']=0x0;_0x27b3b5[_0x8dd7('0xa')]=0x0;_0x27b3b5['loggedIn']=0x0;_0x27b3b5[_0x8dd7('0x4')]=0x0;_0x27b3b5[_0x8dd7('0x6')]=0x0;if(_0x526c24===_0x8dd7('0x25')){_0x27b3b5[_0x8dd7('0xd')]=0x0;_0x27b3b5[_0x8dd7('0x7')]=0x0;if(_0x121995===_0x8dd7('0x26')){_0x27b3b5['pTalking']=0x0;_0x27b3b5[_0x8dd7('0x10')]=0x0;}}var _0xf2bfa4=_[_0x8dd7('0x2a')](_0x340937,['id',_0x27b3b5['id']]);if(_0xf2bfa4){_[_0x8dd7('0x2b')](_0x27b3b5,_[_0x8dd7('0x2c')](_0xf2bfa4,_0x42c02f));}return _0x27b3b5;});}exports['initializeQueues']=initializeQueues;