5229d221648c1ad194b115e717f0afe7d99b25ea
[motion2.git] / server / services / ami / model / voiceQueueSummary.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 _0x8832=['invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','SIP/','incall','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToOutboundQueue','some','outboundAbandonedCallsDay','available','loggedIn','ringing','talking','waiting','answered','loggedInDb','originated','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumDuration','name','strategy','abandoned','busy','inUse'];(function(_0x212e7,_0x472ed6){var _0x184f79=function(_0x22c2ae){while(--_0x22c2ae){_0x212e7['push'](_0x212e7['shift']());}};_0x184f79(++_0x472ed6);}(_0x8832,0x1f4));var _0x2883=function(_0x459ef3,_0x558157){_0x459ef3=_0x459ef3-0x0;var _0x1fe520=_0x8832[_0x459ef3];return _0x1fe520;};'use strict';var INBOUND_COUNTERS=[_0x2883('0x0'),_0x2883('0x1'),'loggedInDb','paused',_0x2883('0x2'),_0x2883('0x3'),_0x2883('0x4')];var OUTBOUND_COUNTERS=['available',_0x2883('0x5'),'inUse',_0x2883('0x1'),_0x2883('0x6'),_0x2883('0x7'),'outboundAbandonedCallsDay',_0x2883('0x8'),'outboundBlacklistCallsDay',_0x2883('0x9'),_0x2883('0xa'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0x2883('0xb'),_0x2883('0xc'),_0x2883('0xd'),_0x2883('0xe'),_0x2883('0xf'),'talking','sumBillable',_0x2883('0x10'),'total','waiting'];function VoiceQueueSummary(_0x5a7e86){this['id']=_0x5a7e86['id'];this[_0x2883('0x11')]=_0x5a7e86['name'];this[_0x2883('0x12')]=_0x5a7e86[_0x2883('0x12')];this[_0x2883('0x13')]=_0x5a7e86[_0x2883('0x13')]||0x0;this[_0x2883('0x5')]=_0x5a7e86[_0x2883('0x5')]||0x0;this['available']=_0x5a7e86['available']||0x0;this[_0x2883('0x14')]=_0x5a7e86[_0x2883('0x14')]||0x0;this['inUse']=_0x5a7e86[_0x2883('0x15')]||0x0;this[_0x2883('0x16')]=_0x5a7e86[_0x2883('0x16')]||0x0;this[_0x2883('0x1')]=_0x5a7e86[_0x2883('0x1')]||0x0;this[_0x2883('0x6')]=_0x5a7e86[_0x2883('0x6')]||0x0;this[_0x2883('0x17')]=_0x5a7e86['onHold']||0x0;this[_0x2883('0x18')]=_0x5a7e86[_0x2883('0x18')]||0x0;this[_0x2883('0xe')]=_0x5a7e86[_0x2883('0xe')]||0x0;this[_0x2883('0x2')]=_0x5a7e86[_0x2883('0x2')]||0x0;this[_0x2883('0x19')]=_0x5a7e86[_0x2883('0x19')];this[_0x2883('0x1a')]=_0x5a7e86['sumBillable'];this[_0x2883('0x10')]=_0x5a7e86[_0x2883('0x10')];this[_0x2883('0x1b')]=_0x5a7e86['sumHoldTime']||0x0;this[_0x2883('0x3')]=_0x5a7e86['talking']||0x0;this[_0x2883('0x1c')]=_0x5a7e86[_0x2883('0x1c')]||0x0;this[_0x2883('0x1d')]=_0x5a7e86['type'];this[_0x2883('0x1e')]=_0x5a7e86[_0x2883('0x1e')]||0x0;this['unknown']=_0x5a7e86[_0x2883('0x1f')]||0x0;this['unmanaged']=_0x5a7e86[_0x2883('0x20')]||0x0;this['waiting']=_0x5a7e86['waiting']||0x0;if(_0x5a7e86['type']===_0x2883('0x21')){this['pTalking']=_0x5a7e86['pTalking']||0x0;this[_0x2883('0x22')]=_0x5a7e86['dialActive'];this[_0x2883('0x23')]=_0x5a7e86[_0x2883('0x23')];this[_0x2883('0x24')]=_0x5a7e86[_0x2883('0x24')];this[_0x2883('0x25')]=_0x5a7e86[_0x2883('0x25')];this['dialOriginateTimeout']=_0x5a7e86[_0x2883('0x26')];this[_0x2883('0x27')]=_0x5a7e86['dialPrefix'];this[_0x2883('0x28')]=_0x5a7e86[_0x2883('0x28')];this[_0x2883('0x29')]=_0x5a7e86[_0x2883('0x29')];this['outboundAnswerCallsDay']=_0x5a7e86['outboundAnswerCallsDay'];this[_0x2883('0x2a')]=_0x5a7e86['outboundBlacklistCallsDay'];this[_0x2883('0x9')]=_0x5a7e86[_0x2883('0x9')];this[_0x2883('0xa')]=_0x5a7e86['outboundCongestionCallsDay'];this[_0x2883('0x2b')]=_0x5a7e86[_0x2883('0x2b')];this[_0x2883('0x2c')]=_0x5a7e86['outboundDropCallsDayCallersExit'];this[_0x2883('0x2d')]=_0x5a7e86[_0x2883('0x2d')];this[_0x2883('0x2e')]=_0x5a7e86['outboundNoAnswerCallsDay'];this[_0x2883('0x2f')]=_0x5a7e86['outboundNoSuchCallsDay'];this[_0x2883('0x30')]=_0x5a7e86[_0x2883('0x30')];this[_0x2883('0xb')]=_0x5a7e86[_0x2883('0xb')];this[_0x2883('0xc')]=_0x5a7e86['outboundRejectCallsDay'];this[_0x2883('0xd')]=_0x5a7e86[_0x2883('0xd')];this[_0x2883('0x31')]=_0x5a7e86['predictiveIntervalAnsweredCalls'];this[_0x2883('0x32')]=_0x5a7e86['predictiveIntervalAvgHoldtime'];this[_0x2883('0x33')]=_0x5a7e86[_0x2883('0x33')];this[_0x2883('0x34')]=_0x5a7e86[_0x2883('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x5a7e86[_0x2883('0x35')];this[_0x2883('0x36')]=_0x5a7e86[_0x2883('0x36')];this[_0x2883('0x37')]=_0x5a7e86[_0x2883('0x37')];this['predictiveIntervalHitRate']=_0x5a7e86[_0x2883('0x38')];this[_0x2883('0x39')]=_0x5a7e86[_0x2883('0x39')];this[_0x2883('0x3a')]=_0x5a7e86[_0x2883('0x3a')];this[_0x2883('0x3b')]=_0x5a7e86[_0x2883('0x3b')];this['predictiveIntervalTotalCalls']=_0x5a7e86[_0x2883('0x3c')];this[_0x2883('0x7')]=_0x5a7e86[_0x2883('0x7')];this['erlangCalls']=_0x5a7e86[_0x2883('0x3d')];this[_0x2883('0x3e')]=_0x5a7e86[_0x2883('0x3e')];this[_0x2883('0x3f')]=_0x5a7e86[_0x2883('0x3f')];this[_0x2883('0x40')]=_0x5a7e86[_0x2883('0x40')];this[_0x2883('0x41')]=_0x5a7e86['startPredictive'];this['startProgressive']=_0x5a7e86[_0x2883('0x42')];this[_0x2883('0x43')]=_0x5a7e86['message'];this[_0x2883('0x44')]=_0x5a7e86['statusMessage'];}if(_0x5a7e86['Trunk']){this[_0x2883('0x45')]={'id':_0x5a7e86[_0x2883('0x45')]['id'],'name':_0x5a7e86[_0x2883('0x45')][_0x2883('0x11')],'active':_0x5a7e86[_0x2883('0x45')][_0x2883('0x46')],'callerid':_0x5a7e86['Trunk']['callerid']};}}VoiceQueueSummary[_0x2883('0x47')][_0x2883('0x48')]=function(_0x300969,_0x1aa54f,_0x53c581,_0x18e690){this['loggedInDb']=0x0;this['talking']=0x0;this[_0x2883('0xe')]=0x0;this[_0x2883('0x1f')]=0x0;this['notInUse']=0x0;this[_0x2883('0x15')]=0x0;this[_0x2883('0x14')]=0x0;this[_0x2883('0x16')]=0x0;this[_0x2883('0x1e')]=0x0;this[_0x2883('0x2')]=0x0;this['ringInUse']=0x0;this[_0x2883('0x17')]=0x0;if(_0x53c581){if(_0x53c581['available']){this[_0x2883('0x0')]=Number(_0x53c581['available']);}if(_0x53c581[_0x2883('0x49')]){this['loggedIn']=Number(_0x53c581[_0x2883('0x49')]);}if(_0x53c581[_0x2883('0x4a')]){this['waiting']=Number(_0x53c581[_0x2883('0x4a')]);}}for(var _0x4937dc=0x0;_0x4937dc<_0x300969['length'];_0x4937dc++){var _0x270d5a=_0x1aa54f[_0x2883('0x4b')+_0x300969[_0x4937dc]['name']];if(_0x270d5a&&_0x270d5a['online']){this['loggedInDb']+=0x1;}if(_0x300969[_0x4937dc][_0x2883('0x4c')]==='1'){this['talking']+=0x1;}if(_0x300969[_0x4937dc][_0x2883('0xe')]==='1'&&!['2','7','8']['includes'](_0x300969[_0x4937dc][_0x2883('0x4d')])){this[_0x2883('0xe')]+=0x1;}switch(_0x300969[_0x4937dc][_0x2883('0x4d')]){case'0':this[_0x2883('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x2883('0x16')]+=0x1;break;case'5':this[_0x2883('0x1e')]+=0x1;break;case'6':this[_0x2883('0x2')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x2883('0x17')]+=0x1;break;}}if(this[_0x2883('0x23')]===_0x2883('0x4e')){var _0x2e64c1=Object[_0x2883('0x4f')](_0x18e690);for(var _0xc2a4af=0x0;_0xc2a4af<_0x2e64c1['length'];_0xc2a4af++){var _0x35f388=_0x2e64c1[_0xc2a4af];var _0x578a1c=_0x18e690[_0x35f388];if(_0x578a1c[_0x2883('0x50')]===this[_0x2883('0x11')]&&_0x578a1c[_0x2883('0x1d')]===_0x2883('0x51')&&_0x578a1c[_0x2883('0x52')]===_0x2883('0x53')){this[_0x2883('0x3')]+=0x1;}}if(this[_0x2883('0x3')]>this['inUse']){this['talking']=this[_0x2883('0x15')];}this[_0x2883('0xf')]=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x52d0ab){var _0x2321c0=![];if(_0x52d0ab){_0x2321c0=INBOUND_COUNTERS['some'](function(_0x4d18e3){return this[_0x4d18e3]!==_0x52d0ab[_0x4d18e3];},this);}return _0x2321c0;};VoiceQueueSummary[_0x2883('0x47')][_0x2883('0x54')]=function(_0x4f7161){var _0x54da49=![];var _0x18c6e1=![];var _0x527360=![];if(_0x4f7161){_0x54da49=this[_0x2883('0x23')]!==_0x4f7161[_0x2883('0x23')]||this[_0x2883('0x22')]!==_0x4f7161[_0x2883('0x22')]||this['message']!==_0x4f7161['message']||this[_0x2883('0x44')]!==_0x4f7161['statusMessage'];_0x18c6e1=OUTBOUND_COUNTERS[_0x2883('0x55')](function(_0x3923bb){return this[_0x3923bb]!==_0x4f7161[_0x3923bb];},this);if(this[_0x2883('0x45')]&&_0x4f7161[_0x2883('0x45')]){_0x527360=this[_0x2883('0x45')]['name']!==_0x4f7161[_0x2883('0x45')][_0x2883('0x11')]||this[_0x2883('0x45')][_0x2883('0x46')]!==_0x4f7161[_0x2883('0x45')][_0x2883('0x46')];}}return _0x54da49||_0x18c6e1||_0x527360;};VoiceQueueSummary[_0x2883('0x47')]['updateReportFromOutboundQueue']=function(_0x4eb8ce){this['answered']=_0x4eb8ce[_0x2883('0x5')];this['message']=_0x4eb8ce['message'];this[_0x2883('0x44')]=_0x4eb8ce[_0x2883('0x44')];this[_0x2883('0x7')]=_0x4eb8ce[_0x2883('0x7')];this[_0x2883('0x56')]=_0x4eb8ce[_0x2883('0x56')];this[_0x2883('0x8')]=_0x4eb8ce[_0x2883('0x8')];this[_0x2883('0x2a')]=_0x4eb8ce[_0x2883('0x2a')];this[_0x2883('0x9')]=_0x4eb8ce[_0x2883('0x9')];this[_0x2883('0xa')]=_0x4eb8ce['outboundCongestionCallsDay'];this[_0x2883('0x2e')]=_0x4eb8ce[_0x2883('0x2e')];this[_0x2883('0x2f')]=_0x4eb8ce[_0x2883('0x2f')];this[_0x2883('0xb')]=_0x4eb8ce[_0x2883('0xb')];this['outboundRejectCallsDay']=_0x4eb8ce[_0x2883('0xc')];this[_0x2883('0xd')]=_0x4eb8ce[_0x2883('0xd')];this[_0x2883('0x1a')]=_0x4eb8ce[_0x2883('0x1a')];this['sumDuration']=_0x4eb8ce[_0x2883('0x10')];this['total']=_0x4eb8ce['total'];if(this[_0x2883('0x23')]==='preview'){this[_0x2883('0xf')]=_0x4eb8ce[_0x2883('0xf')];}};module['exports']=VoiceQueueSummary;