6b94be7ddcd836756df33f999e3416e45cad1c39
[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 _0x9c63=['outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','invalid','ringInUse','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundUnknownCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','talking','sumDuration','total','name','abandoned','answered','busy','inUse','onHold','notInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x9c63,0x1a7));var _0x39c6=function(_0x23d397,_0x462583){_0x23d397=_0x23d397-0x0;var _0x3f912=_0x9c63[_0x23d397];return _0x3f912;};'use strict';var INBOUND_COUNTERS=[_0x39c6('0x0'),_0x39c6('0x1'),_0x39c6('0x2'),_0x39c6('0x3'),_0x39c6('0x4'),'talking',_0x39c6('0x5')];var OUTBOUND_COUNTERS=[_0x39c6('0x0'),'answered','inUse',_0x39c6('0x1'),_0x39c6('0x2'),_0x39c6('0x6'),_0x39c6('0x7'),_0x39c6('0x8'),_0x39c6('0x9'),'outboundBusyCallsDay',_0x39c6('0xa'),_0x39c6('0xb'),_0x39c6('0xc'),_0x39c6('0xd'),_0x39c6('0xe'),'outboundUnknownCallsDay',_0x39c6('0x3'),'pTalking',_0x39c6('0xf'),'sumBillable',_0x39c6('0x10'),_0x39c6('0x11'),_0x39c6('0x5')];function VoiceQueueSummary(_0x231669){this['id']=_0x231669['id'];this['name']=_0x231669[_0x39c6('0x12')];this['strategy']=_0x231669['strategy'];this[_0x39c6('0x13')]=_0x231669[_0x39c6('0x13')]||0x0;this[_0x39c6('0x14')]=_0x231669[_0x39c6('0x14')]||0x0;this['available']=_0x231669[_0x39c6('0x0')]||0x0;this['busy']=_0x231669[_0x39c6('0x15')]||0x0;this[_0x39c6('0x16')]=_0x231669[_0x39c6('0x16')]||0x0;this['invalid']=_0x231669['invalid']||0x0;this[_0x39c6('0x1')]=_0x231669[_0x39c6('0x1')]||0x0;this['loggedInDb']=_0x231669[_0x39c6('0x2')]||0x0;this[_0x39c6('0x17')]=_0x231669[_0x39c6('0x17')]||0x0;this[_0x39c6('0x18')]=_0x231669[_0x39c6('0x18')]||0x0;this[_0x39c6('0x3')]=_0x231669['paused']||0x0;this['ringing']=_0x231669['ringing']||0x0;this['ringInUse']=_0x231669['ringInUse'];this[_0x39c6('0x19')]=_0x231669['sumBillable'];this['sumDuration']=_0x231669[_0x39c6('0x10')];this[_0x39c6('0x1a')]=_0x231669[_0x39c6('0x1a')]||0x0;this[_0x39c6('0xf')]=_0x231669['talking']||0x0;this['total']=_0x231669['total']||0x0;this[_0x39c6('0x1b')]=_0x231669['type'];this['unavailable']=_0x231669[_0x39c6('0x1c')]||0x0;this[_0x39c6('0x1d')]=_0x231669[_0x39c6('0x1d')]||0x0;this[_0x39c6('0x1e')]=_0x231669[_0x39c6('0x1e')]||0x0;this[_0x39c6('0x5')]=_0x231669[_0x39c6('0x5')]||0x0;if(_0x231669[_0x39c6('0x1b')]===_0x39c6('0x1f')){this[_0x39c6('0x20')]=_0x231669[_0x39c6('0x20')]||0x0;this[_0x39c6('0x21')]=_0x231669[_0x39c6('0x21')];this[_0x39c6('0x22')]=_0x231669[_0x39c6('0x22')];this[_0x39c6('0x23')]=_0x231669[_0x39c6('0x23')];this['dialOriginateCallerIdNumber']=_0x231669[_0x39c6('0x24')];this[_0x39c6('0x25')]=_0x231669[_0x39c6('0x25')];this['dialPrefix']=_0x231669[_0x39c6('0x26')];this[_0x39c6('0x27')]=_0x231669[_0x39c6('0x27')];this[_0x39c6('0x28')]=_0x231669['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x231669[_0x39c6('0x8')];this[_0x39c6('0x9')]=_0x231669['outboundBlacklistCallsDay'];this[_0x39c6('0x29')]=_0x231669['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x231669[_0x39c6('0xa')];this[_0x39c6('0x2a')]=_0x231669[_0x39c6('0x2a')];this[_0x39c6('0x2b')]=_0x231669[_0x39c6('0x2b')];this[_0x39c6('0x2c')]=_0x231669[_0x39c6('0x2c')];this[_0x39c6('0xb')]=_0x231669[_0x39c6('0xb')];this[_0x39c6('0xc')]=_0x231669[_0x39c6('0xc')];this[_0x39c6('0x2d')]=_0x231669[_0x39c6('0x2d')];this[_0x39c6('0xd')]=_0x231669[_0x39c6('0xd')];this[_0x39c6('0xe')]=_0x231669[_0x39c6('0xe')];this['outboundUnknownCallsDay']=_0x231669['outboundUnknownCallsDay'];this[_0x39c6('0x2e')]=_0x231669[_0x39c6('0x2e')];this[_0x39c6('0x2f')]=_0x231669[_0x39c6('0x2f')];this[_0x39c6('0x30')]=_0x231669[_0x39c6('0x30')];this[_0x39c6('0x31')]=_0x231669['predictiveIntervalDroppedCallsCallersExit'];this[_0x39c6('0x32')]=_0x231669[_0x39c6('0x32')];this['predictiveIntervalErlangCalls']=_0x231669['predictiveIntervalErlangCalls'];this[_0x39c6('0x33')]=_0x231669[_0x39c6('0x33')];this[_0x39c6('0x34')]=_0x231669[_0x39c6('0x34')];this[_0x39c6('0x35')]=_0x231669[_0x39c6('0x35')];this[_0x39c6('0x36')]=_0x231669[_0x39c6('0x36')];this[_0x39c6('0x37')]=_0x231669[_0x39c6('0x37')];this[_0x39c6('0x38')]=_0x231669[_0x39c6('0x38')];this[_0x39c6('0x6')]=_0x231669['originated'];this['erlangCalls']=_0x231669[_0x39c6('0x39')];this[_0x39c6('0x3a')]=_0x231669[_0x39c6('0x3a')];this['erlangAbandonmentRate']=_0x231669[_0x39c6('0x3b')];this[_0x39c6('0x3c')]=_0x231669[_0x39c6('0x3c')];this[_0x39c6('0x3d')]=_0x231669['startPredictive'];this['startProgressive']=_0x231669[_0x39c6('0x3e')];this['message']=_0x231669[_0x39c6('0x3f')];this[_0x39c6('0x40')]=_0x231669[_0x39c6('0x40')];}if(_0x231669[_0x39c6('0x41')]){this['Trunk']={'id':_0x231669[_0x39c6('0x41')]['id'],'name':_0x231669[_0x39c6('0x41')][_0x39c6('0x12')],'active':_0x231669[_0x39c6('0x41')][_0x39c6('0x42')],'callerid':_0x231669[_0x39c6('0x41')][_0x39c6('0x43')]};}}VoiceQueueSummary[_0x39c6('0x44')][_0x39c6('0x45')]=function(_0x4bf748,_0x4e219c,_0x1b15b0,_0x4b50b9){this[_0x39c6('0x2')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0x39c6('0x1d')]=0x0;this[_0x39c6('0x18')]=0x0;this[_0x39c6('0x16')]=0x0;this['busy']=0x0;this[_0x39c6('0x46')]=0x0;this[_0x39c6('0x1c')]=0x0;this[_0x39c6('0x4')]=0x0;this[_0x39c6('0x47')]=0x0;this[_0x39c6('0x17')]=0x0;if(_0x1b15b0){if(_0x1b15b0[_0x39c6('0x0')]){this['available']=Number(_0x1b15b0['available']);}if(_0x1b15b0[_0x39c6('0x48')]){this[_0x39c6('0x1')]=Number(_0x1b15b0['loggedin']);}if(_0x1b15b0[_0x39c6('0x49')]){this[_0x39c6('0x5')]=Number(_0x1b15b0['callers']);}}for(var _0x43bf40=0x0;_0x43bf40<_0x4bf748[_0x39c6('0x4a')];_0x43bf40++){var _0x100283=_0x4e219c[_0x39c6('0x4b')+_0x4bf748[_0x43bf40][_0x39c6('0x12')]];if(_0x100283&&_0x100283[_0x39c6('0x4c')]){this['loggedInDb']+=0x1;}if(_0x4bf748[_0x43bf40][_0x39c6('0x4d')]==='1'){this[_0x39c6('0xf')]+=0x1;}if(_0x4bf748[_0x43bf40][_0x39c6('0x3')]==='1'&&!['2','7','8'][_0x39c6('0x4e')](_0x4bf748[_0x43bf40][_0x39c6('0x4f')])){this['paused']+=0x1;}switch(_0x4bf748[_0x43bf40][_0x39c6('0x4f')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x39c6('0x18')]+=0x1;break;case'2':this[_0x39c6('0x16')]+=0x1;break;case'3':this[_0x39c6('0x15')]+=0x1;break;case'4':this[_0x39c6('0x46')]+=0x1;break;case'5':this[_0x39c6('0x1c')]+=0x1;break;case'6':this[_0x39c6('0x4')]+=0x1;break;case'7':this[_0x39c6('0x47')]+=0x1;break;case'8':this[_0x39c6('0x17')]+=0x1;break;}}if(this['dialMethod']===_0x39c6('0x50')){var _0x7c2f08=Object[_0x39c6('0x51')](_0x4b50b9);for(var _0x3147e2=0x0;_0x3147e2<_0x7c2f08[_0x39c6('0x4a')];_0x3147e2++){var _0x25150e=_0x7c2f08[_0x3147e2];var _0x369859=_0x4b50b9[_0x25150e];if(_0x369859[_0x39c6('0x52')]===this[_0x39c6('0x12')]&&_0x369859['type']===_0x39c6('0x53')&&_0x369859[_0x39c6('0x54')]===_0x39c6('0x55')){this['talking']+=0x1;}}if(this[_0x39c6('0xf')]>this['inUse']){this[_0x39c6('0xf')]=this['inUse'];}this[_0x39c6('0x20')]=0x0;}return this;};VoiceQueueSummary[_0x39c6('0x44')][_0x39c6('0x56')]=function(_0x56d80b){var _0x3c181e=![];if(_0x56d80b){_0x3c181e=INBOUND_COUNTERS[_0x39c6('0x57')](function(_0x348228){return this[_0x348228]!==_0x56d80b[_0x348228];},this);}return _0x3c181e;};VoiceQueueSummary[_0x39c6('0x44')][_0x39c6('0x58')]=function(_0x43119d){var _0x59136d=![];var _0x1c775f=![];var _0x14e7f4=![];if(_0x43119d){_0x59136d=this[_0x39c6('0x22')]!==_0x43119d['dialMethod']||this[_0x39c6('0x21')]!==_0x43119d[_0x39c6('0x21')]||this['message']!==_0x43119d[_0x39c6('0x3f')]||this[_0x39c6('0x40')]!==_0x43119d[_0x39c6('0x40')];_0x1c775f=OUTBOUND_COUNTERS[_0x39c6('0x57')](function(_0x369394){return this[_0x369394]!==_0x43119d[_0x369394];},this);if(this[_0x39c6('0x41')]&&_0x43119d['Trunk']){_0x14e7f4=this[_0x39c6('0x41')]['name']!==_0x43119d[_0x39c6('0x41')][_0x39c6('0x12')]||this['Trunk']['active']!==_0x43119d[_0x39c6('0x41')][_0x39c6('0x42')];}}return _0x59136d||_0x1c775f||_0x14e7f4;};VoiceQueueSummary[_0x39c6('0x44')][_0x39c6('0x59')]=function(_0x130c35){this['answered']=_0x130c35['answered'];this['message']=_0x130c35[_0x39c6('0x3f')];this[_0x39c6('0x40')]=_0x130c35[_0x39c6('0x40')];this[_0x39c6('0x6')]=_0x130c35[_0x39c6('0x6')];this['outboundAbandonedCallsDay']=_0x130c35[_0x39c6('0x7')];this[_0x39c6('0x8')]=_0x130c35[_0x39c6('0x8')];this[_0x39c6('0x9')]=_0x130c35[_0x39c6('0x9')];this[_0x39c6('0x29')]=_0x130c35['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x130c35[_0x39c6('0xa')];this['outboundNoAnswerCallsDay']=_0x130c35[_0x39c6('0xb')];this[_0x39c6('0xc')]=_0x130c35[_0x39c6('0xc')];this[_0x39c6('0xd')]=_0x130c35[_0x39c6('0xd')];this[_0x39c6('0xe')]=_0x130c35[_0x39c6('0xe')];this[_0x39c6('0x5a')]=_0x130c35[_0x39c6('0x5a')];this[_0x39c6('0x19')]=_0x130c35['sumBillable'];this[_0x39c6('0x10')]=_0x130c35['sumDuration'];this[_0x39c6('0x11')]=_0x130c35['total'];if(this[_0x39c6('0x22')]===_0x39c6('0x5b')){this[_0x39c6('0x20')]=_0x130c35[_0x39c6('0x20')];}};module[_0x39c6('0x5c')]=VoiceQueueSummary;