Built motion from commit 3770a7bd.|2.6.29
[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 _0xac0a=['erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','createReport','loggedin','callers','length','SIP/','incall','status','booked','keys','queue','dialer','exten','prototype','compareToInboundQueue','compareToOutboundQueue','some','updateReportFromOutboundQueue','preview','exports','loggedInDb','paused','talking','waiting','available','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x295242,_0x238973){var _0x9c4b37=function(_0x30edea){while(--_0x30edea){_0x295242['push'](_0x295242['shift']());}};_0x9c4b37(++_0x238973);}(_0xac0a,0x11e));var _0xaac0=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xac0a[_0x1ff2ec];return _0x405683;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0xaac0('0x0'),_0xaac0('0x1'),'ringing',_0xaac0('0x2'),_0xaac0('0x3')];var OUTBOUND_COUNTERS=[_0xaac0('0x4'),_0xaac0('0x5'),_0xaac0('0x6'),_0xaac0('0x7'),_0xaac0('0x0'),_0xaac0('0x8'),_0xaac0('0x9'),_0xaac0('0xa'),_0xaac0('0xb'),_0xaac0('0xc'),'outboundCongestionCallsDay',_0xaac0('0xd'),_0xaac0('0xe'),'outboundReCallsDay',_0xaac0('0xf'),_0xaac0('0x10'),_0xaac0('0x1'),_0xaac0('0x11'),_0xaac0('0x2'),_0xaac0('0x12'),_0xaac0('0x13'),_0xaac0('0x14'),_0xaac0('0x3')];function VoiceQueueSummary(_0x2dfb69){this['id']=_0x2dfb69['id'];this[_0xaac0('0x15')]=_0x2dfb69[_0xaac0('0x15')];this[_0xaac0('0x16')]=_0x2dfb69[_0xaac0('0x16')];this[_0xaac0('0x17')]=_0x2dfb69[_0xaac0('0x17')]||0x0;this[_0xaac0('0x5')]=_0x2dfb69[_0xaac0('0x5')]||0x0;this[_0xaac0('0x4')]=_0x2dfb69[_0xaac0('0x4')]||0x0;this[_0xaac0('0x18')]=_0x2dfb69[_0xaac0('0x18')]||0x0;this[_0xaac0('0x6')]=_0x2dfb69[_0xaac0('0x6')]||0x0;this[_0xaac0('0x19')]=_0x2dfb69[_0xaac0('0x19')]||0x0;this[_0xaac0('0x7')]=_0x2dfb69['loggedIn']||0x0;this[_0xaac0('0x0')]=_0x2dfb69['loggedInDb']||0x0;this['onHold']=_0x2dfb69[_0xaac0('0x1a')]||0x0;this[_0xaac0('0x1b')]=_0x2dfb69['notInUse']||0x0;this[_0xaac0('0x1')]=_0x2dfb69[_0xaac0('0x1')]||0x0;this['ringing']=_0x2dfb69[_0xaac0('0x1c')]||0x0;this[_0xaac0('0x1d')]=_0x2dfb69[_0xaac0('0x1d')];this[_0xaac0('0x12')]=_0x2dfb69[_0xaac0('0x12')];this[_0xaac0('0x13')]=_0x2dfb69['sumDuration'];this['sumHoldTime']=_0x2dfb69[_0xaac0('0x1e')]||0x0;this[_0xaac0('0x2')]=_0x2dfb69['talking']||0x0;this['total']=_0x2dfb69[_0xaac0('0x14')]||0x0;this[_0xaac0('0x1f')]=_0x2dfb69['type'];this[_0xaac0('0x20')]=_0x2dfb69[_0xaac0('0x20')]||0x0;this[_0xaac0('0x21')]=_0x2dfb69['unknown']||0x0;this[_0xaac0('0x22')]=_0x2dfb69[_0xaac0('0x22')]||0x0;this[_0xaac0('0x3')]=_0x2dfb69[_0xaac0('0x3')]||0x0;if(_0x2dfb69[_0xaac0('0x1f')]===_0xaac0('0x23')){this[_0xaac0('0x11')]=_0x2dfb69['pTalking']||0x0;this[_0xaac0('0x24')]=_0x2dfb69[_0xaac0('0x24')];this[_0xaac0('0x25')]=_0x2dfb69[_0xaac0('0x25')];this['dialOriginateCallerIdName']=_0x2dfb69[_0xaac0('0x26')];this[_0xaac0('0x27')]=_0x2dfb69[_0xaac0('0x27')];this['dialOriginateTimeout']=_0x2dfb69['dialOriginateTimeout'];this[_0xaac0('0x28')]=_0x2dfb69[_0xaac0('0x28')];this['temp']=_0x2dfb69['temp'];this[_0xaac0('0x29')]=_0x2dfb69[_0xaac0('0x29')];this['outboundAnswerCallsDay']=_0x2dfb69['outboundAnswerCallsDay'];this[_0xaac0('0xb')]=_0x2dfb69[_0xaac0('0xb')];this[_0xaac0('0xc')]=_0x2dfb69[_0xaac0('0xc')];this[_0xaac0('0x2a')]=_0x2dfb69['outboundCongestionCallsDay'];this[_0xaac0('0x2b')]=_0x2dfb69[_0xaac0('0x2b')];this[_0xaac0('0x2c')]=_0x2dfb69[_0xaac0('0x2c')];this[_0xaac0('0x2d')]=_0x2dfb69['outboundDropCallsDayTimeout'];this[_0xaac0('0xd')]=_0x2dfb69['outboundNoAnswerCallsDay'];this[_0xaac0('0xe')]=_0x2dfb69[_0xaac0('0xe')];this['outboundOriginateFailureCallsDay']=_0x2dfb69[_0xaac0('0x2e')];this[_0xaac0('0x2f')]=_0x2dfb69['outboundReCallsDay'];this[_0xaac0('0xf')]=_0x2dfb69['outboundRejectCallsDay'];this[_0xaac0('0x10')]=_0x2dfb69['outboundUnknownCallsDay'];this[_0xaac0('0x30')]=_0x2dfb69[_0xaac0('0x30')];this[_0xaac0('0x31')]=_0x2dfb69[_0xaac0('0x31')];this[_0xaac0('0x32')]=_0x2dfb69[_0xaac0('0x32')];this[_0xaac0('0x33')]=_0x2dfb69[_0xaac0('0x33')];this[_0xaac0('0x34')]=_0x2dfb69[_0xaac0('0x34')];this[_0xaac0('0x35')]=_0x2dfb69['predictiveIntervalErlangCalls'];this[_0xaac0('0x36')]=_0x2dfb69[_0xaac0('0x36')];this[_0xaac0('0x37')]=_0x2dfb69[_0xaac0('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x2dfb69['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x2dfb69['predictiveIntervalPauses'];this[_0xaac0('0x38')]=_0x2dfb69[_0xaac0('0x38')];this[_0xaac0('0x39')]=_0x2dfb69['predictiveIntervalTotalCalls'];this['originated']=_0x2dfb69[_0xaac0('0x8')];this[_0xaac0('0x3a')]=_0x2dfb69[_0xaac0('0x3a')];this[_0xaac0('0x3b')]=_0x2dfb69['erlangCallToSecond'];this['erlangAbandonmentRate']=_0x2dfb69['erlangAbandonmentRate'];this[_0xaac0('0x3c')]=_0x2dfb69[_0xaac0('0x3c')];this[_0xaac0('0x3d')]=_0x2dfb69[_0xaac0('0x3d')];this[_0xaac0('0x3e')]=_0x2dfb69['startProgressive'];this[_0xaac0('0x3f')]=_0x2dfb69[_0xaac0('0x3f')];this[_0xaac0('0x40')]=_0x2dfb69[_0xaac0('0x40')];}if(_0x2dfb69['Trunk']){this[_0xaac0('0x41')]={'id':_0x2dfb69[_0xaac0('0x41')]['id'],'name':_0x2dfb69['Trunk'][_0xaac0('0x15')],'active':_0x2dfb69[_0xaac0('0x41')][_0xaac0('0x42')],'callerid':_0x2dfb69[_0xaac0('0x41')]['callerid']};}}VoiceQueueSummary['prototype'][_0xaac0('0x43')]=function(_0x5be612,_0x34c859,_0x15543c,_0x2552d1){this[_0xaac0('0x0')]=0x0;this[_0xaac0('0x2')]=0x0;this[_0xaac0('0x1')]=0x0;this[_0xaac0('0x21')]=0x0;this[_0xaac0('0x1b')]=0x0;this[_0xaac0('0x6')]=0x0;this[_0xaac0('0x18')]=0x0;this['invalid']=0x0;this[_0xaac0('0x20')]=0x0;this[_0xaac0('0x1c')]=0x0;this['ringInUse']=0x0;this[_0xaac0('0x1a')]=0x0;if(_0x15543c){if(_0x15543c[_0xaac0('0x4')]){this['available']=Number(_0x15543c[_0xaac0('0x4')]);}if(_0x15543c[_0xaac0('0x44')]){this[_0xaac0('0x7')]=Number(_0x15543c[_0xaac0('0x44')]);}if(_0x15543c[_0xaac0('0x45')]){this[_0xaac0('0x3')]=Number(_0x15543c['callers']);}}for(var _0x33b170=0x0;_0x33b170<_0x5be612[_0xaac0('0x46')];_0x33b170++){var _0x3baa0b=_0x34c859[_0xaac0('0x47')+_0x5be612[_0x33b170][_0xaac0('0x15')]];if(_0x3baa0b&&_0x3baa0b['online']){this[_0xaac0('0x0')]+=0x1;}if(_0x5be612[_0x33b170][_0xaac0('0x48')]==='1'){this[_0xaac0('0x2')]+=0x1;}if(_0x5be612[_0x33b170][_0xaac0('0x1')]==='1'&&!['2','7','8']['includes'](_0x5be612[_0x33b170][_0xaac0('0x49')])){this['paused']+=0x1;}switch(_0x5be612[_0x33b170][_0xaac0('0x49')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xaac0('0x1b')]+=0x1;break;case'2':this[_0xaac0('0x6')]+=0x1;break;case'3':this[_0xaac0('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xaac0('0x20')]+=0x1;break;case'6':this[_0xaac0('0x1c')]+=0x1;break;case'7':this[_0xaac0('0x1d')]+=0x1;break;case'8':this[_0xaac0('0x1a')]+=0x1;break;}}if(this[_0xaac0('0x25')]===_0xaac0('0x4a')){var _0x54abfc=Object[_0xaac0('0x4b')](_0x2552d1);for(var _0x446dc4=0x0;_0x446dc4<_0x54abfc['length'];_0x446dc4++){var _0x30a03f=_0x54abfc[_0x446dc4];var _0x2ecd59=_0x2552d1[_0x30a03f];if(_0x2ecd59[_0xaac0('0x4c')]===this[_0xaac0('0x15')]&&_0x2ecd59[_0xaac0('0x1f')]===_0xaac0('0x4d')&&_0x2ecd59[_0xaac0('0x4e')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0xaac0('0x2')]>this['inUse']){this[_0xaac0('0x2')]=this[_0xaac0('0x6')];}this[_0xaac0('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xaac0('0x4f')][_0xaac0('0x50')]=function(_0x350fb2){var _0x170c92=![];if(_0x350fb2){_0x170c92=INBOUND_COUNTERS['some'](function(_0x22c7e8){return this[_0x22c7e8]!==_0x350fb2[_0x22c7e8];},this);}return _0x170c92;};VoiceQueueSummary[_0xaac0('0x4f')][_0xaac0('0x51')]=function(_0x35814d){var _0x1c2679=![];var _0x3e43a5=![];var _0x44ffca=![];if(_0x35814d){_0x1c2679=this[_0xaac0('0x25')]!==_0x35814d['dialMethod']||this['dialActive']!==_0x35814d[_0xaac0('0x24')]||this['message']!==_0x35814d['message']||this[_0xaac0('0x40')]!==_0x35814d[_0xaac0('0x40')];_0x3e43a5=OUTBOUND_COUNTERS[_0xaac0('0x52')](function(_0x5a72ef){return this[_0x5a72ef]!==_0x35814d[_0x5a72ef];},this);if(this['Trunk']&&_0x35814d['Trunk']){_0x44ffca=this[_0xaac0('0x41')][_0xaac0('0x15')]!==_0x35814d[_0xaac0('0x41')][_0xaac0('0x15')]||this[_0xaac0('0x41')][_0xaac0('0x42')]!==_0x35814d[_0xaac0('0x41')]['active'];}}return _0x1c2679||_0x3e43a5||_0x44ffca;};VoiceQueueSummary[_0xaac0('0x4f')][_0xaac0('0x53')]=function(_0x39861f){this[_0xaac0('0x5')]=_0x39861f[_0xaac0('0x5')];this['message']=_0x39861f[_0xaac0('0x3f')];this[_0xaac0('0x40')]=_0x39861f[_0xaac0('0x40')];this[_0xaac0('0x8')]=_0x39861f[_0xaac0('0x8')];this[_0xaac0('0x9')]=_0x39861f[_0xaac0('0x9')];this['outboundAnswerCallsDay']=_0x39861f[_0xaac0('0xa')];this[_0xaac0('0xb')]=_0x39861f[_0xaac0('0xb')];this[_0xaac0('0xc')]=_0x39861f['outboundBusyCallsDay'];this[_0xaac0('0x2a')]=_0x39861f['outboundCongestionCallsDay'];this[_0xaac0('0xd')]=_0x39861f['outboundNoAnswerCallsDay'];this[_0xaac0('0xe')]=_0x39861f[_0xaac0('0xe')];this[_0xaac0('0x2f')]=_0x39861f[_0xaac0('0x2f')];this[_0xaac0('0xf')]=_0x39861f['outboundRejectCallsDay'];this[_0xaac0('0x10')]=_0x39861f[_0xaac0('0x10')];this[_0xaac0('0x12')]=_0x39861f['sumBillable'];this['sumDuration']=_0x39861f[_0xaac0('0x13')];this[_0xaac0('0x14')]=_0x39861f[_0xaac0('0x14')];if(this[_0xaac0('0x25')]===_0xaac0('0x54')){this[_0xaac0('0x11')]=_0x39861f['pTalking'];}};module[_0xaac0('0x55')]=VoiceQueueSummary;