658d3310b99ace60acb93f4442ad1c4b79917a84
[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 _0x6bdc=['total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToOutboundQueue','active','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','sumDuration'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x4b15a3,_0x53c5f4){_0x4b15a3=_0x4b15a3-0x0;var _0x3c5758=_0x6bdc[_0x4b15a3];return _0x3c5758;};'use strict';var INBOUND_COUNTERS=[_0xc6bd('0x0'),_0xc6bd('0x1'),_0xc6bd('0x2'),_0xc6bd('0x3'),_0xc6bd('0x4'),_0xc6bd('0x5'),_0xc6bd('0x6')];var OUTBOUND_COUNTERS=[_0xc6bd('0x0'),_0xc6bd('0x7'),_0xc6bd('0x8'),'loggedIn',_0xc6bd('0x2'),_0xc6bd('0x9'),_0xc6bd('0xa'),_0xc6bd('0xb'),_0xc6bd('0xc'),_0xc6bd('0xd'),'outboundCongestionCallsDay',_0xc6bd('0xe'),_0xc6bd('0xf'),_0xc6bd('0x10'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xc6bd('0x3'),'pTalking',_0xc6bd('0x5'),'sumBillable',_0xc6bd('0x11'),_0xc6bd('0x12'),_0xc6bd('0x6')];function VoiceQueueSummary(_0x1a37fd){this['id']=_0x1a37fd['id'];this[_0xc6bd('0x13')]=_0x1a37fd[_0xc6bd('0x13')];this[_0xc6bd('0x14')]=_0x1a37fd[_0xc6bd('0x14')];this[_0xc6bd('0x15')]=_0x1a37fd[_0xc6bd('0x15')]||0x0;this[_0xc6bd('0x7')]=_0x1a37fd[_0xc6bd('0x7')]||0x0;this[_0xc6bd('0x0')]=_0x1a37fd[_0xc6bd('0x0')]||0x0;this['busy']=_0x1a37fd[_0xc6bd('0x16')]||0x0;this['inUse']=_0x1a37fd['inUse']||0x0;this[_0xc6bd('0x17')]=_0x1a37fd[_0xc6bd('0x17')]||0x0;this[_0xc6bd('0x1')]=_0x1a37fd[_0xc6bd('0x1')]||0x0;this[_0xc6bd('0x2')]=_0x1a37fd['loggedInDb']||0x0;this['onHold']=_0x1a37fd[_0xc6bd('0x18')]||0x0;this['notInUse']=_0x1a37fd[_0xc6bd('0x19')]||0x0;this[_0xc6bd('0x3')]=_0x1a37fd[_0xc6bd('0x3')]||0x0;this['ringing']=_0x1a37fd[_0xc6bd('0x4')]||0x0;this[_0xc6bd('0x1a')]=_0x1a37fd[_0xc6bd('0x1a')];this[_0xc6bd('0x1b')]=_0x1a37fd[_0xc6bd('0x1b')];this[_0xc6bd('0x11')]=_0x1a37fd[_0xc6bd('0x11')];this[_0xc6bd('0x1c')]=_0x1a37fd['sumHoldTime']||0x0;this[_0xc6bd('0x5')]=_0x1a37fd['talking']||0x0;this['total']=_0x1a37fd['total']||0x0;this[_0xc6bd('0x1d')]=_0x1a37fd[_0xc6bd('0x1d')];this[_0xc6bd('0x1e')]=_0x1a37fd[_0xc6bd('0x1e')]||0x0;this[_0xc6bd('0x1f')]=_0x1a37fd['unknown']||0x0;this[_0xc6bd('0x20')]=_0x1a37fd['unmanaged']||0x0;this['waiting']=_0x1a37fd[_0xc6bd('0x6')]||0x0;if(_0x1a37fd[_0xc6bd('0x1d')]===_0xc6bd('0x21')){this[_0xc6bd('0x22')]=_0x1a37fd[_0xc6bd('0x22')]||0x0;this[_0xc6bd('0x23')]=_0x1a37fd[_0xc6bd('0x23')];this[_0xc6bd('0x24')]=_0x1a37fd['dialMethod'];this[_0xc6bd('0x25')]=_0x1a37fd[_0xc6bd('0x25')];this[_0xc6bd('0x26')]=_0x1a37fd[_0xc6bd('0x26')];this[_0xc6bd('0x27')]=_0x1a37fd[_0xc6bd('0x27')];this[_0xc6bd('0x28')]=_0x1a37fd[_0xc6bd('0x28')];this[_0xc6bd('0x29')]=_0x1a37fd[_0xc6bd('0x29')];this['outboundAnswerAgiCallsDay']=_0x1a37fd[_0xc6bd('0x2a')];this[_0xc6bd('0xb')]=_0x1a37fd['outboundAnswerCallsDay'];this[_0xc6bd('0xc')]=_0x1a37fd[_0xc6bd('0xc')];this[_0xc6bd('0xd')]=_0x1a37fd['outboundBusyCallsDay'];this[_0xc6bd('0x2b')]=_0x1a37fd['outboundCongestionCallsDay'];this[_0xc6bd('0x2c')]=_0x1a37fd[_0xc6bd('0x2c')];this[_0xc6bd('0x2d')]=_0x1a37fd[_0xc6bd('0x2d')];this[_0xc6bd('0x2e')]=_0x1a37fd[_0xc6bd('0x2e')];this[_0xc6bd('0xe')]=_0x1a37fd['outboundNoAnswerCallsDay'];this[_0xc6bd('0xf')]=_0x1a37fd['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x1a37fd['outboundOriginateFailureCallsDay'];this[_0xc6bd('0x10')]=_0x1a37fd[_0xc6bd('0x10')];this[_0xc6bd('0x2f')]=_0x1a37fd[_0xc6bd('0x2f')];this[_0xc6bd('0x30')]=_0x1a37fd[_0xc6bd('0x30')];this[_0xc6bd('0x31')]=_0x1a37fd[_0xc6bd('0x31')];this[_0xc6bd('0x32')]=_0x1a37fd[_0xc6bd('0x32')];this[_0xc6bd('0x33')]=_0x1a37fd['predictiveIntervalAvgTalktime'];this[_0xc6bd('0x34')]=_0x1a37fd['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x1a37fd[_0xc6bd('0x35')];this[_0xc6bd('0x36')]=_0x1a37fd[_0xc6bd('0x36')];this[_0xc6bd('0x37')]=_0x1a37fd[_0xc6bd('0x37')];this[_0xc6bd('0x38')]=_0x1a37fd[_0xc6bd('0x38')];this[_0xc6bd('0x39')]=_0x1a37fd['predictiveIntervalMultiplicativeFactor'];this[_0xc6bd('0x3a')]=_0x1a37fd[_0xc6bd('0x3a')];this['predictiveIntervalAvailable']=_0x1a37fd[_0xc6bd('0x3b')];this[_0xc6bd('0x3c')]=_0x1a37fd[_0xc6bd('0x3c')];this['originated']=_0x1a37fd['originated'];this[_0xc6bd('0x3d')]=_0x1a37fd[_0xc6bd('0x3d')];this[_0xc6bd('0x3e')]=_0x1a37fd[_0xc6bd('0x3e')];this[_0xc6bd('0x3f')]=_0x1a37fd[_0xc6bd('0x3f')];this[_0xc6bd('0x40')]=_0x1a37fd[_0xc6bd('0x40')];this[_0xc6bd('0x41')]=_0x1a37fd[_0xc6bd('0x41')];this['startProgressive']=_0x1a37fd['startProgressive'];this['message']=_0x1a37fd[_0xc6bd('0x42')];this['statusMessage']=_0x1a37fd[_0xc6bd('0x43')];}if(_0x1a37fd[_0xc6bd('0x44')]){this[_0xc6bd('0x44')]={'id':_0x1a37fd[_0xc6bd('0x44')]['id'],'name':_0x1a37fd[_0xc6bd('0x44')][_0xc6bd('0x13')],'active':_0x1a37fd[_0xc6bd('0x44')]['active'],'callerid':_0x1a37fd[_0xc6bd('0x44')][_0xc6bd('0x45')]};}}VoiceQueueSummary[_0xc6bd('0x46')][_0xc6bd('0x47')]=function(_0x15b0a4,_0x502cbf,_0x54dccf,_0x5356cb){this['loggedInDb']=0x0;this[_0xc6bd('0x5')]=0x0;this[_0xc6bd('0x3')]=0x0;this[_0xc6bd('0x1f')]=0x0;this[_0xc6bd('0x19')]=0x0;this[_0xc6bd('0x8')]=0x0;this[_0xc6bd('0x16')]=0x0;this['invalid']=0x0;this[_0xc6bd('0x1e')]=0x0;this[_0xc6bd('0x4')]=0x0;this[_0xc6bd('0x1a')]=0x0;this[_0xc6bd('0x18')]=0x0;if(_0x54dccf){if(_0x54dccf['available']){this['available']=Number(_0x54dccf['available']);}if(_0x54dccf[_0xc6bd('0x48')]){this['loggedIn']=Number(_0x54dccf[_0xc6bd('0x48')]);}if(_0x54dccf[_0xc6bd('0x49')]){this[_0xc6bd('0x6')]=Number(_0x54dccf['callers']);}}for(var _0x2eb25b=0x0;_0x2eb25b<_0x15b0a4['length'];_0x2eb25b++){var _0x4c6b82=_0x502cbf['SIP/'+_0x15b0a4[_0x2eb25b]['name']];if(_0x4c6b82&&_0x4c6b82[_0xc6bd('0x4a')]){this['loggedInDb']+=0x1;}if(_0x15b0a4[_0x2eb25b][_0xc6bd('0x4b')]==='1'){this[_0xc6bd('0x5')]+=0x1;}if(_0x15b0a4[_0x2eb25b][_0xc6bd('0x3')]==='1'&&!['2','7','8'][_0xc6bd('0x4c')](_0x15b0a4[_0x2eb25b]['status'])){this[_0xc6bd('0x3')]+=0x1;}switch(_0x15b0a4[_0x2eb25b][_0xc6bd('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xc6bd('0x19')]+=0x1;break;case'2':this[_0xc6bd('0x8')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xc6bd('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xc6bd('0x4')]+=0x1;break;case'7':this[_0xc6bd('0x1a')]+=0x1;break;case'8':this[_0xc6bd('0x18')]+=0x1;break;}}if(this[_0xc6bd('0x24')]===_0xc6bd('0x4e')){var _0x438baa=Object[_0xc6bd('0x4f')](_0x5356cb);for(var _0x5a0b9a=0x0;_0x5a0b9a<_0x438baa['length'];_0x5a0b9a++){var _0x50cdf2=_0x438baa[_0x5a0b9a];var _0x480fb2=_0x5356cb[_0x50cdf2];if(_0x480fb2[_0xc6bd('0x50')]===this[_0xc6bd('0x13')]&&_0x480fb2['type']===_0xc6bd('0x51')&&_0x480fb2[_0xc6bd('0x52')]===_0xc6bd('0x53')){this[_0xc6bd('0x5')]+=0x1;}}if(this[_0xc6bd('0x5')]>this[_0xc6bd('0x8')]){this['talking']=this['inUse'];}this[_0xc6bd('0x22')]=0x0;}return this;};VoiceQueueSummary[_0xc6bd('0x46')]['compareToInboundQueue']=function(_0x597c20){var _0x24f33e=![];if(_0x597c20){_0x24f33e=INBOUND_COUNTERS['some'](function(_0x247a54){return this[_0x247a54]!==_0x597c20[_0x247a54];},this);}return _0x24f33e;};VoiceQueueSummary[_0xc6bd('0x46')][_0xc6bd('0x54')]=function(_0x1243cb){var _0x2a4d3e=![];var _0x516762=![];var _0x504fde=![];if(_0x1243cb){_0x2a4d3e=this[_0xc6bd('0x24')]!==_0x1243cb[_0xc6bd('0x24')]||this[_0xc6bd('0x23')]!==_0x1243cb[_0xc6bd('0x23')]||this[_0xc6bd('0x42')]!==_0x1243cb[_0xc6bd('0x42')]||this[_0xc6bd('0x43')]!==_0x1243cb[_0xc6bd('0x43')];_0x516762=OUTBOUND_COUNTERS['some'](function(_0x56899b){return this[_0x56899b]!==_0x1243cb[_0x56899b];},this);if(this[_0xc6bd('0x44')]&&_0x1243cb[_0xc6bd('0x44')]){_0x504fde=this['Trunk'][_0xc6bd('0x13')]!==_0x1243cb[_0xc6bd('0x44')][_0xc6bd('0x13')]||this['Trunk'][_0xc6bd('0x55')]!==_0x1243cb[_0xc6bd('0x44')][_0xc6bd('0x55')];}}return _0x2a4d3e||_0x516762||_0x504fde;};VoiceQueueSummary[_0xc6bd('0x46')][_0xc6bd('0x56')]=function(_0x563e46){this['answered']=_0x563e46[_0xc6bd('0x7')];this[_0xc6bd('0x42')]=_0x563e46[_0xc6bd('0x42')];this['statusMessage']=_0x563e46[_0xc6bd('0x43')];this[_0xc6bd('0x9')]=_0x563e46[_0xc6bd('0x9')];this[_0xc6bd('0xa')]=_0x563e46[_0xc6bd('0xa')];this[_0xc6bd('0xb')]=_0x563e46['outboundAnswerCallsDay'];this[_0xc6bd('0xc')]=_0x563e46[_0xc6bd('0xc')];this[_0xc6bd('0xd')]=_0x563e46[_0xc6bd('0xd')];this[_0xc6bd('0x2b')]=_0x563e46[_0xc6bd('0x2b')];this['outboundNoAnswerCallsDay']=_0x563e46[_0xc6bd('0xe')];this[_0xc6bd('0xf')]=_0x563e46[_0xc6bd('0xf')];this[_0xc6bd('0x10')]=_0x563e46['outboundReCallsDay'];this[_0xc6bd('0x2f')]=_0x563e46[_0xc6bd('0x2f')];this[_0xc6bd('0x30')]=_0x563e46[_0xc6bd('0x30')];this[_0xc6bd('0x1b')]=_0x563e46[_0xc6bd('0x1b')];this['sumDuration']=_0x563e46[_0xc6bd('0x11')];this[_0xc6bd('0x12')]=_0x563e46['total'];if(this[_0xc6bd('0x24')]==='preview'){this[_0xc6bd('0x22')]=_0x563e46[_0xc6bd('0x22')];}};module[_0xc6bd('0x57')]=VoiceQueueSummary;