Built motion from commit 10af8726.|2.6.34
[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 _0xff16=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','busy','unavailable','loggedin','callers','length','SIP/','incall','status','dialMethod','booked','queue','xcally-motion-preview','some','compareToOutboundQueue','prototype','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','abandoned','invalid','loggedInDb','onHold','notInUse','ringInUse','sumHoldTime','type','unknown','unmanaged','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0xff16,0x7f));var _0x6ff1=function(_0x10f0f5,_0x18ef35){_0x10f0f5=_0x10f0f5-0x0;var _0x1f5e1c=_0xff16[_0x10f0f5];return _0x1f5e1c;};'use strict';var INBOUND_COUNTERS=[_0x6ff1('0x0'),_0x6ff1('0x1'),'loggedInDb',_0x6ff1('0x2'),_0x6ff1('0x3'),_0x6ff1('0x4'),_0x6ff1('0x5')];var OUTBOUND_COUNTERS=[_0x6ff1('0x0'),_0x6ff1('0x6'),_0x6ff1('0x7'),_0x6ff1('0x1'),'loggedInDb',_0x6ff1('0x8'),'outboundAbandonedCallsDay',_0x6ff1('0x9'),_0x6ff1('0xa'),_0x6ff1('0xb'),_0x6ff1('0xc'),_0x6ff1('0xd'),_0x6ff1('0xe'),_0x6ff1('0xf'),_0x6ff1('0x10'),'outboundUnknownCallsDay',_0x6ff1('0x2'),_0x6ff1('0x11'),_0x6ff1('0x4'),_0x6ff1('0x12'),_0x6ff1('0x13'),_0x6ff1('0x14'),_0x6ff1('0x5')];function VoiceQueueSummary(_0x5a6f92){this['id']=_0x5a6f92['id'];this[_0x6ff1('0x15')]=_0x5a6f92[_0x6ff1('0x15')];this['strategy']=_0x5a6f92['strategy'];this[_0x6ff1('0x16')]=_0x5a6f92['abandoned']||0x0;this[_0x6ff1('0x6')]=_0x5a6f92[_0x6ff1('0x6')]||0x0;this[_0x6ff1('0x0')]=_0x5a6f92['available']||0x0;this['busy']=_0x5a6f92['busy']||0x0;this[_0x6ff1('0x7')]=_0x5a6f92[_0x6ff1('0x7')]||0x0;this[_0x6ff1('0x17')]=_0x5a6f92[_0x6ff1('0x17')]||0x0;this[_0x6ff1('0x1')]=_0x5a6f92[_0x6ff1('0x1')]||0x0;this['loggedInDb']=_0x5a6f92[_0x6ff1('0x18')]||0x0;this[_0x6ff1('0x19')]=_0x5a6f92[_0x6ff1('0x19')]||0x0;this[_0x6ff1('0x1a')]=_0x5a6f92[_0x6ff1('0x1a')]||0x0;this[_0x6ff1('0x2')]=_0x5a6f92['paused']||0x0;this[_0x6ff1('0x3')]=_0x5a6f92[_0x6ff1('0x3')]||0x0;this[_0x6ff1('0x1b')]=_0x5a6f92[_0x6ff1('0x1b')];this[_0x6ff1('0x12')]=_0x5a6f92[_0x6ff1('0x12')];this['sumDuration']=_0x5a6f92[_0x6ff1('0x13')];this[_0x6ff1('0x1c')]=_0x5a6f92[_0x6ff1('0x1c')]||0x0;this[_0x6ff1('0x4')]=_0x5a6f92[_0x6ff1('0x4')]||0x0;this[_0x6ff1('0x14')]=_0x5a6f92[_0x6ff1('0x14')]||0x0;this['type']=_0x5a6f92[_0x6ff1('0x1d')];this['unavailable']=_0x5a6f92['unavailable']||0x0;this[_0x6ff1('0x1e')]=_0x5a6f92[_0x6ff1('0x1e')]||0x0;this[_0x6ff1('0x1f')]=_0x5a6f92[_0x6ff1('0x1f')]||0x0;this[_0x6ff1('0x5')]=_0x5a6f92[_0x6ff1('0x5')]||0x0;if(_0x5a6f92[_0x6ff1('0x1d')]===_0x6ff1('0x20')){this['pTalking']=_0x5a6f92[_0x6ff1('0x11')]||0x0;this[_0x6ff1('0x21')]=_0x5a6f92[_0x6ff1('0x21')];this['dialMethod']=_0x5a6f92['dialMethod'];this[_0x6ff1('0x22')]=_0x5a6f92[_0x6ff1('0x22')];this['dialOriginateCallerIdNumber']=_0x5a6f92[_0x6ff1('0x23')];this[_0x6ff1('0x24')]=_0x5a6f92['dialOriginateTimeout'];this[_0x6ff1('0x25')]=_0x5a6f92[_0x6ff1('0x25')];this['temp']=_0x5a6f92[_0x6ff1('0x26')];this[_0x6ff1('0x27')]=_0x5a6f92[_0x6ff1('0x27')];this[_0x6ff1('0x9')]=_0x5a6f92['outboundAnswerCallsDay'];this[_0x6ff1('0xa')]=_0x5a6f92[_0x6ff1('0xa')];this[_0x6ff1('0xb')]=_0x5a6f92[_0x6ff1('0xb')];this[_0x6ff1('0xc')]=_0x5a6f92['outboundCongestionCallsDay'];this[_0x6ff1('0x28')]=_0x5a6f92[_0x6ff1('0x28')];this[_0x6ff1('0x29')]=_0x5a6f92['outboundDropCallsDayCallersExit'];this[_0x6ff1('0x2a')]=_0x5a6f92['outboundDropCallsDayTimeout'];this[_0x6ff1('0xd')]=_0x5a6f92[_0x6ff1('0xd')];this[_0x6ff1('0xe')]=_0x5a6f92[_0x6ff1('0xe')];this[_0x6ff1('0x2b')]=_0x5a6f92[_0x6ff1('0x2b')];this[_0x6ff1('0xf')]=_0x5a6f92['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x5a6f92[_0x6ff1('0x10')];this[_0x6ff1('0x2c')]=_0x5a6f92[_0x6ff1('0x2c')];this[_0x6ff1('0x2d')]=_0x5a6f92[_0x6ff1('0x2d')];this[_0x6ff1('0x2e')]=_0x5a6f92['predictiveIntervalAvgHoldtime'];this[_0x6ff1('0x2f')]=_0x5a6f92[_0x6ff1('0x2f')];this[_0x6ff1('0x30')]=_0x5a6f92['predictiveIntervalDroppedCallsCallersExit'];this[_0x6ff1('0x31')]=_0x5a6f92['predictiveIntervalDroppedCallsTimeout'];this[_0x6ff1('0x32')]=_0x5a6f92['predictiveIntervalErlangCalls'];this[_0x6ff1('0x33')]=_0x5a6f92[_0x6ff1('0x33')];this['predictiveIntervalHitRate']=_0x5a6f92['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x5a6f92[_0x6ff1('0x34')];this[_0x6ff1('0x35')]=_0x5a6f92[_0x6ff1('0x35')];this[_0x6ff1('0x36')]=_0x5a6f92[_0x6ff1('0x36')];this['predictiveIntervalTotalCalls']=_0x5a6f92[_0x6ff1('0x37')];this['originated']=_0x5a6f92[_0x6ff1('0x8')];this['erlangCalls']=_0x5a6f92['erlangCalls'];this[_0x6ff1('0x38')]=_0x5a6f92[_0x6ff1('0x38')];this[_0x6ff1('0x39')]=_0x5a6f92[_0x6ff1('0x39')];this[_0x6ff1('0x3a')]=_0x5a6f92[_0x6ff1('0x3a')];this['startPredictive']=_0x5a6f92[_0x6ff1('0x3b')];this[_0x6ff1('0x3c')]=_0x5a6f92['startProgressive'];this['message']=_0x5a6f92[_0x6ff1('0x3d')];this['statusMessage']=_0x5a6f92[_0x6ff1('0x3e')];}if(_0x5a6f92[_0x6ff1('0x3f')]){this[_0x6ff1('0x3f')]={'id':_0x5a6f92[_0x6ff1('0x3f')]['id'],'name':_0x5a6f92[_0x6ff1('0x3f')][_0x6ff1('0x15')],'active':_0x5a6f92['Trunk'][_0x6ff1('0x40')],'callerid':_0x5a6f92[_0x6ff1('0x3f')]['callerid']};}}VoiceQueueSummary['prototype']['createReport']=function(_0xc8ae37,_0x6bc8bb,_0x3e01e6,_0x5f7999){this[_0x6ff1('0x18')]=0x0;this[_0x6ff1('0x4')]=0x0;this[_0x6ff1('0x2')]=0x0;this['unknown']=0x0;this[_0x6ff1('0x1a')]=0x0;this[_0x6ff1('0x7')]=0x0;this[_0x6ff1('0x41')]=0x0;this[_0x6ff1('0x17')]=0x0;this[_0x6ff1('0x42')]=0x0;this['ringing']=0x0;this[_0x6ff1('0x1b')]=0x0;this[_0x6ff1('0x19')]=0x0;if(_0x3e01e6){if(_0x3e01e6[_0x6ff1('0x0')]){this[_0x6ff1('0x0')]=Number(_0x3e01e6[_0x6ff1('0x0')]);}if(_0x3e01e6[_0x6ff1('0x43')]){this['loggedIn']=Number(_0x3e01e6[_0x6ff1('0x43')]);}if(_0x3e01e6[_0x6ff1('0x44')]){this['waiting']=Number(_0x3e01e6[_0x6ff1('0x44')]);}}for(var _0x5cbff8=0x0;_0x5cbff8<_0xc8ae37[_0x6ff1('0x45')];_0x5cbff8++){var _0x1c07c1=_0x6bc8bb[_0x6ff1('0x46')+_0xc8ae37[_0x5cbff8][_0x6ff1('0x15')]];if(_0x1c07c1&&_0x1c07c1['online']){this['loggedInDb']+=0x1;}if(_0xc8ae37[_0x5cbff8][_0x6ff1('0x47')]==='1'){this['talking']+=0x1;}if(_0xc8ae37[_0x5cbff8][_0x6ff1('0x2')]==='1'&&!['2','7','8']['includes'](_0xc8ae37[_0x5cbff8]['status'])){this[_0x6ff1('0x2')]+=0x1;}switch(_0xc8ae37[_0x5cbff8][_0x6ff1('0x48')]){case'0':this[_0x6ff1('0x1e')]+=0x1;break;case'1':this[_0x6ff1('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x6ff1('0x41')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x6ff1('0x3')]+=0x1;break;case'7':this[_0x6ff1('0x1b')]+=0x1;break;case'8':this[_0x6ff1('0x19')]+=0x1;break;}}if(this[_0x6ff1('0x49')]===_0x6ff1('0x4a')){var _0x25141b=Object['keys'](_0x5f7999);for(var _0x143492=0x0;_0x143492<_0x25141b['length'];_0x143492++){var _0x9ab9f4=_0x25141b[_0x143492];var _0x4481ee=_0x5f7999[_0x9ab9f4];if(_0x4481ee[_0x6ff1('0x4b')]===this[_0x6ff1('0x15')]&&_0x4481ee['type']==='dialer'&&_0x4481ee['exten']===_0x6ff1('0x4c')){this[_0x6ff1('0x4')]+=0x1;}}if(this[_0x6ff1('0x4')]>this[_0x6ff1('0x7')]){this[_0x6ff1('0x4')]=this[_0x6ff1('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x2ba240){var _0xd6d344=![];if(_0x2ba240){_0xd6d344=INBOUND_COUNTERS[_0x6ff1('0x4d')](function(_0x880490){return this[_0x880490]!==_0x2ba240[_0x880490];},this);}return _0xd6d344;};VoiceQueueSummary['prototype'][_0x6ff1('0x4e')]=function(_0x40a53a){var _0x33a32f=![];var _0x5cec60=![];var _0x2b62d6=![];if(_0x40a53a){_0x33a32f=this[_0x6ff1('0x49')]!==_0x40a53a['dialMethod']||this[_0x6ff1('0x21')]!==_0x40a53a[_0x6ff1('0x21')]||this['message']!==_0x40a53a[_0x6ff1('0x3d')]||this['statusMessage']!==_0x40a53a[_0x6ff1('0x3e')];_0x5cec60=OUTBOUND_COUNTERS[_0x6ff1('0x4d')](function(_0x4a5a0d){return this[_0x4a5a0d]!==_0x40a53a[_0x4a5a0d];},this);if(this['Trunk']&&_0x40a53a[_0x6ff1('0x3f')]){_0x2b62d6=this[_0x6ff1('0x3f')]['name']!==_0x40a53a[_0x6ff1('0x3f')]['name']||this[_0x6ff1('0x3f')][_0x6ff1('0x40')]!==_0x40a53a[_0x6ff1('0x3f')]['active'];}}return _0x33a32f||_0x5cec60||_0x2b62d6;};VoiceQueueSummary[_0x6ff1('0x4f')][_0x6ff1('0x50')]=function(_0x3ee52e){this[_0x6ff1('0x6')]=_0x3ee52e[_0x6ff1('0x6')];this['message']=_0x3ee52e[_0x6ff1('0x3d')];this[_0x6ff1('0x3e')]=_0x3ee52e[_0x6ff1('0x3e')];this[_0x6ff1('0x8')]=_0x3ee52e[_0x6ff1('0x8')];this[_0x6ff1('0x51')]=_0x3ee52e['outboundAbandonedCallsDay'];this['outboundAnswerCallsDay']=_0x3ee52e['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x3ee52e[_0x6ff1('0xa')];this[_0x6ff1('0xb')]=_0x3ee52e[_0x6ff1('0xb')];this[_0x6ff1('0xc')]=_0x3ee52e['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x3ee52e[_0x6ff1('0xd')];this[_0x6ff1('0xe')]=_0x3ee52e[_0x6ff1('0xe')];this[_0x6ff1('0xf')]=_0x3ee52e[_0x6ff1('0xf')];this[_0x6ff1('0x10')]=_0x3ee52e[_0x6ff1('0x10')];this['outboundUnknownCallsDay']=_0x3ee52e[_0x6ff1('0x2c')];this['sumBillable']=_0x3ee52e[_0x6ff1('0x12')];this[_0x6ff1('0x13')]=_0x3ee52e['sumDuration'];this[_0x6ff1('0x14')]=_0x3ee52e['total'];if(this[_0x6ff1('0x49')]===_0x6ff1('0x52')){this[_0x6ff1('0x11')]=_0x3ee52e['pTalking'];}};module[_0x6ff1('0x53')]=VoiceQueueSummary;