ccd05ebca8f9aad476a96b2722fc45f518d2889c
[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 _0x3fa4=['abandoned','busy','invalid','loggedInDb','onHold','paused','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','notInUse','loggedin','length','SIP/','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','preview','exports','available','ringing','talking','waiting','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x3fa4,0xf0));var _0x43fa=function(_0x479bdd,_0x4f4105){_0x479bdd=_0x479bdd-0x0;var _0xdd6acc=_0x3fa4[_0x479bdd];return _0xdd6acc;};'use strict';var INBOUND_COUNTERS=[_0x43fa('0x0'),'loggedIn','loggedInDb','paused',_0x43fa('0x1'),_0x43fa('0x2'),_0x43fa('0x3')];var OUTBOUND_COUNTERS=[_0x43fa('0x0'),_0x43fa('0x4'),_0x43fa('0x5'),_0x43fa('0x6'),'loggedInDb',_0x43fa('0x7'),_0x43fa('0x8'),_0x43fa('0x9'),'outboundBlacklistCallsDay',_0x43fa('0xa'),_0x43fa('0xb'),_0x43fa('0xc'),'outboundNoSuchCallsDay',_0x43fa('0xd'),_0x43fa('0xe'),'outboundUnknownCallsDay','paused',_0x43fa('0xf'),_0x43fa('0x2'),_0x43fa('0x10'),_0x43fa('0x11'),_0x43fa('0x12'),'waiting'];function VoiceQueueSummary(_0x464e7b){this['id']=_0x464e7b['id'];this[_0x43fa('0x13')]=_0x464e7b[_0x43fa('0x13')];this['strategy']=_0x464e7b[_0x43fa('0x14')];this[_0x43fa('0x15')]=_0x464e7b[_0x43fa('0x15')]||0x0;this['answered']=_0x464e7b[_0x43fa('0x4')]||0x0;this['available']=_0x464e7b['available']||0x0;this['busy']=_0x464e7b[_0x43fa('0x16')]||0x0;this['inUse']=_0x464e7b[_0x43fa('0x5')]||0x0;this[_0x43fa('0x17')]=_0x464e7b['invalid']||0x0;this[_0x43fa('0x6')]=_0x464e7b[_0x43fa('0x6')]||0x0;this[_0x43fa('0x18')]=_0x464e7b[_0x43fa('0x18')]||0x0;this[_0x43fa('0x19')]=_0x464e7b[_0x43fa('0x19')]||0x0;this['notInUse']=_0x464e7b['notInUse']||0x0;this[_0x43fa('0x1a')]=_0x464e7b[_0x43fa('0x1a')]||0x0;this[_0x43fa('0x1')]=_0x464e7b[_0x43fa('0x1')]||0x0;this[_0x43fa('0x1b')]=_0x464e7b[_0x43fa('0x1b')];this[_0x43fa('0x10')]=_0x464e7b[_0x43fa('0x10')];this[_0x43fa('0x11')]=_0x464e7b['sumDuration'];this[_0x43fa('0x1c')]=_0x464e7b[_0x43fa('0x1c')]||0x0;this[_0x43fa('0x2')]=_0x464e7b[_0x43fa('0x2')]||0x0;this[_0x43fa('0x12')]=_0x464e7b['total']||0x0;this[_0x43fa('0x1d')]=_0x464e7b[_0x43fa('0x1d')];this[_0x43fa('0x1e')]=_0x464e7b[_0x43fa('0x1e')]||0x0;this[_0x43fa('0x1f')]=_0x464e7b[_0x43fa('0x1f')]||0x0;this[_0x43fa('0x20')]=_0x464e7b[_0x43fa('0x20')]||0x0;this[_0x43fa('0x3')]=_0x464e7b['waiting']||0x0;if(_0x464e7b['type']===_0x43fa('0x21')){this[_0x43fa('0xf')]=_0x464e7b[_0x43fa('0xf')]||0x0;this[_0x43fa('0x22')]=_0x464e7b[_0x43fa('0x22')];this[_0x43fa('0x23')]=_0x464e7b['dialMethod'];this['dialOriginateCallerIdName']=_0x464e7b[_0x43fa('0x24')];this[_0x43fa('0x25')]=_0x464e7b[_0x43fa('0x25')];this[_0x43fa('0x26')]=_0x464e7b['dialOriginateTimeout'];this[_0x43fa('0x27')]=_0x464e7b[_0x43fa('0x27')];this[_0x43fa('0x28')]=_0x464e7b[_0x43fa('0x28')];this['outboundAnswerAgiCallsDay']=_0x464e7b[_0x43fa('0x29')];this[_0x43fa('0x9')]=_0x464e7b[_0x43fa('0x9')];this[_0x43fa('0x2a')]=_0x464e7b[_0x43fa('0x2a')];this[_0x43fa('0xa')]=_0x464e7b[_0x43fa('0xa')];this[_0x43fa('0xb')]=_0x464e7b[_0x43fa('0xb')];this[_0x43fa('0x2b')]=_0x464e7b[_0x43fa('0x2b')];this[_0x43fa('0x2c')]=_0x464e7b['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x464e7b[_0x43fa('0x2d')];this[_0x43fa('0xc')]=_0x464e7b[_0x43fa('0xc')];this[_0x43fa('0x2e')]=_0x464e7b['outboundNoSuchCallsDay'];this[_0x43fa('0x2f')]=_0x464e7b[_0x43fa('0x2f')];this[_0x43fa('0xd')]=_0x464e7b['outboundReCallsDay'];this[_0x43fa('0xe')]=_0x464e7b[_0x43fa('0xe')];this[_0x43fa('0x30')]=_0x464e7b[_0x43fa('0x30')];this['predictiveIntervalAnsweredCalls']=_0x464e7b[_0x43fa('0x31')];this['predictiveIntervalAvgHoldtime']=_0x464e7b[_0x43fa('0x32')];this[_0x43fa('0x33')]=_0x464e7b[_0x43fa('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x464e7b[_0x43fa('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x464e7b['predictiveIntervalDroppedCallsTimeout'];this[_0x43fa('0x35')]=_0x464e7b[_0x43fa('0x35')];this[_0x43fa('0x36')]=_0x464e7b['predictiveIntervalErlangCallsDroppedCalls'];this[_0x43fa('0x37')]=_0x464e7b[_0x43fa('0x37')];this[_0x43fa('0x38')]=_0x464e7b[_0x43fa('0x38')];this[_0x43fa('0x39')]=_0x464e7b['predictiveIntervalPauses'];this[_0x43fa('0x3a')]=_0x464e7b[_0x43fa('0x3a')];this[_0x43fa('0x3b')]=_0x464e7b[_0x43fa('0x3b')];this['originated']=_0x464e7b['originated'];this[_0x43fa('0x3c')]=_0x464e7b[_0x43fa('0x3c')];this[_0x43fa('0x3d')]=_0x464e7b[_0x43fa('0x3d')];this[_0x43fa('0x3e')]=_0x464e7b['erlangAbandonmentRate'];this[_0x43fa('0x3f')]=_0x464e7b['erlangBusyFactor'];this['startPredictive']=_0x464e7b[_0x43fa('0x40')];this['startProgressive']=_0x464e7b[_0x43fa('0x41')];this[_0x43fa('0x42')]=_0x464e7b[_0x43fa('0x42')];this[_0x43fa('0x43')]=_0x464e7b['statusMessage'];}if(_0x464e7b['Trunk']){this['Trunk']={'id':_0x464e7b[_0x43fa('0x44')]['id'],'name':_0x464e7b[_0x43fa('0x44')]['name'],'active':_0x464e7b[_0x43fa('0x44')][_0x43fa('0x45')],'callerid':_0x464e7b[_0x43fa('0x44')][_0x43fa('0x46')]};}}VoiceQueueSummary['prototype'][_0x43fa('0x47')]=function(_0x23e156,_0x4ac89a,_0x5e453f,_0x21e7d6){this['loggedInDb']=0x0;this[_0x43fa('0x2')]=0x0;this[_0x43fa('0x1a')]=0x0;this['unknown']=0x0;this[_0x43fa('0x48')]=0x0;this['inUse']=0x0;this[_0x43fa('0x16')]=0x0;this[_0x43fa('0x17')]=0x0;this[_0x43fa('0x1e')]=0x0;this['ringing']=0x0;this[_0x43fa('0x1b')]=0x0;this[_0x43fa('0x19')]=0x0;if(_0x5e453f){if(_0x5e453f[_0x43fa('0x0')]){this[_0x43fa('0x0')]=Number(_0x5e453f[_0x43fa('0x0')]);}if(_0x5e453f[_0x43fa('0x49')]){this['loggedIn']=Number(_0x5e453f[_0x43fa('0x49')]);}if(_0x5e453f['callers']){this[_0x43fa('0x3')]=Number(_0x5e453f['callers']);}}for(var _0x1e6a3c=0x0;_0x1e6a3c<_0x23e156[_0x43fa('0x4a')];_0x1e6a3c++){var _0x132a0b=_0x4ac89a[_0x43fa('0x4b')+_0x23e156[_0x1e6a3c][_0x43fa('0x13')]];if(_0x132a0b&&_0x132a0b['online']){this[_0x43fa('0x18')]+=0x1;}if(_0x23e156[_0x1e6a3c]['incall']==='1'){this['talking']+=0x1;}if(_0x23e156[_0x1e6a3c]['paused']==='1'&&!['2','7','8'][_0x43fa('0x4c')](_0x23e156[_0x1e6a3c][_0x43fa('0x4d')])){this[_0x43fa('0x1a')]+=0x1;}switch(_0x23e156[_0x1e6a3c][_0x43fa('0x4d')]){case'0':this[_0x43fa('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x43fa('0x5')]+=0x1;break;case'3':this[_0x43fa('0x16')]+=0x1;break;case'4':this[_0x43fa('0x17')]+=0x1;break;case'5':this[_0x43fa('0x1e')]+=0x1;break;case'6':this[_0x43fa('0x1')]+=0x1;break;case'7':this[_0x43fa('0x1b')]+=0x1;break;case'8':this[_0x43fa('0x19')]+=0x1;break;}}if(this[_0x43fa('0x23')]===_0x43fa('0x4e')){var _0x458e11=Object[_0x43fa('0x4f')](_0x21e7d6);for(var _0x52d66f=0x0;_0x52d66f<_0x458e11[_0x43fa('0x4a')];_0x52d66f++){var _0x2a06ff=_0x458e11[_0x52d66f];var _0x4b84f6=_0x21e7d6[_0x2a06ff];if(_0x4b84f6[_0x43fa('0x50')]===this['name']&&_0x4b84f6[_0x43fa('0x1d')]===_0x43fa('0x51')&&_0x4b84f6[_0x43fa('0x52')]===_0x43fa('0x53')){this[_0x43fa('0x2')]+=0x1;}}if(this['talking']>this[_0x43fa('0x5')]){this['talking']=this[_0x43fa('0x5')];}this[_0x43fa('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x43fa('0x54')]['compareToInboundQueue']=function(_0x5cbcd9){var _0xc3f7aa=![];if(_0x5cbcd9){_0xc3f7aa=INBOUND_COUNTERS['some'](function(_0x2ca431){return this[_0x2ca431]!==_0x5cbcd9[_0x2ca431];},this);}return _0xc3f7aa;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x2228e0){var _0x393842=![];var _0x4c48b5=![];var _0x43f94c=![];if(_0x2228e0){_0x393842=this[_0x43fa('0x23')]!==_0x2228e0[_0x43fa('0x23')]||this[_0x43fa('0x22')]!==_0x2228e0['dialActive']||this[_0x43fa('0x42')]!==_0x2228e0[_0x43fa('0x42')]||this[_0x43fa('0x43')]!==_0x2228e0[_0x43fa('0x43')];_0x4c48b5=OUTBOUND_COUNTERS['some'](function(_0x4cdf94){return this[_0x4cdf94]!==_0x2228e0[_0x4cdf94];},this);if(this[_0x43fa('0x44')]&&_0x2228e0['Trunk']){_0x43f94c=this['Trunk']['name']!==_0x2228e0[_0x43fa('0x44')][_0x43fa('0x13')]||this[_0x43fa('0x44')][_0x43fa('0x45')]!==_0x2228e0[_0x43fa('0x44')][_0x43fa('0x45')];}}return _0x393842||_0x4c48b5||_0x43f94c;};VoiceQueueSummary[_0x43fa('0x54')]['updateReportFromOutboundQueue']=function(_0x41134e){this[_0x43fa('0x4')]=_0x41134e['answered'];this[_0x43fa('0x42')]=_0x41134e['message'];this[_0x43fa('0x43')]=_0x41134e[_0x43fa('0x43')];this[_0x43fa('0x7')]=_0x41134e[_0x43fa('0x7')];this['outboundAbandonedCallsDay']=_0x41134e['outboundAbandonedCallsDay'];this[_0x43fa('0x9')]=_0x41134e[_0x43fa('0x9')];this[_0x43fa('0x2a')]=_0x41134e[_0x43fa('0x2a')];this['outboundBusyCallsDay']=_0x41134e['outboundBusyCallsDay'];this[_0x43fa('0xb')]=_0x41134e['outboundCongestionCallsDay'];this[_0x43fa('0xc')]=_0x41134e[_0x43fa('0xc')];this[_0x43fa('0x2e')]=_0x41134e[_0x43fa('0x2e')];this['outboundReCallsDay']=_0x41134e['outboundReCallsDay'];this[_0x43fa('0xe')]=_0x41134e['outboundRejectCallsDay'];this[_0x43fa('0x30')]=_0x41134e[_0x43fa('0x30')];this[_0x43fa('0x10')]=_0x41134e[_0x43fa('0x10')];this[_0x43fa('0x11')]=_0x41134e[_0x43fa('0x11')];this[_0x43fa('0x12')]=_0x41134e['total'];if(this[_0x43fa('0x23')]===_0x43fa('0x55')){this[_0x43fa('0xf')]=_0x41134e[_0x43fa('0xf')];}};module[_0x43fa('0x56')]=VoiceQueueSummary;