9648c2351167bbb561c3eb1c22381e40c321c160
[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 _0x5b20=['outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','incall','includes','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','dialActive','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x5b6cbf,_0x11fc17){var _0x4be9ff=function(_0x1f77ba){while(--_0x1f77ba){_0x5b6cbf['push'](_0x5b6cbf['shift']());}};_0x4be9ff(++_0x11fc17);}(_0x5b20,0x86));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var INBOUND_COUNTERS=[_0x05b2('0x0'),_0x05b2('0x1'),_0x05b2('0x2'),_0x05b2('0x3'),_0x05b2('0x4'),_0x05b2('0x5'),_0x05b2('0x6')];var OUTBOUND_COUNTERS=[_0x05b2('0x0'),_0x05b2('0x7'),_0x05b2('0x8'),_0x05b2('0x1'),'loggedInDb',_0x05b2('0x9'),_0x05b2('0xa'),'outboundAnswerCallsDay',_0x05b2('0xb'),_0x05b2('0xc'),_0x05b2('0xd'),_0x05b2('0xe'),_0x05b2('0xf'),_0x05b2('0x10'),_0x05b2('0x11'),_0x05b2('0x12'),_0x05b2('0x3'),_0x05b2('0x13'),_0x05b2('0x5'),_0x05b2('0x14'),_0x05b2('0x15'),_0x05b2('0x16'),_0x05b2('0x6')];function VoiceQueueSummary(_0x3d3ef0){this['id']=_0x3d3ef0['id'];this['name']=_0x3d3ef0[_0x05b2('0x17')];this[_0x05b2('0x18')]=_0x3d3ef0[_0x05b2('0x18')];this[_0x05b2('0x19')]=_0x3d3ef0['abandoned']||0x0;this[_0x05b2('0x7')]=_0x3d3ef0[_0x05b2('0x7')]||0x0;this[_0x05b2('0x0')]=_0x3d3ef0['available']||0x0;this['busy']=_0x3d3ef0[_0x05b2('0x1a')]||0x0;this[_0x05b2('0x8')]=_0x3d3ef0['inUse']||0x0;this['invalid']=_0x3d3ef0[_0x05b2('0x1b')]||0x0;this[_0x05b2('0x1')]=_0x3d3ef0[_0x05b2('0x1')]||0x0;this[_0x05b2('0x2')]=_0x3d3ef0[_0x05b2('0x2')]||0x0;this[_0x05b2('0x1c')]=_0x3d3ef0[_0x05b2('0x1c')]||0x0;this[_0x05b2('0x1d')]=_0x3d3ef0[_0x05b2('0x1d')]||0x0;this[_0x05b2('0x3')]=_0x3d3ef0[_0x05b2('0x3')]||0x0;this[_0x05b2('0x4')]=_0x3d3ef0[_0x05b2('0x4')]||0x0;this[_0x05b2('0x1e')]=_0x3d3ef0[_0x05b2('0x1e')];this[_0x05b2('0x14')]=_0x3d3ef0['sumBillable'];this[_0x05b2('0x15')]=_0x3d3ef0[_0x05b2('0x15')];this[_0x05b2('0x1f')]=_0x3d3ef0[_0x05b2('0x1f')]||0x0;this[_0x05b2('0x5')]=_0x3d3ef0[_0x05b2('0x5')]||0x0;this[_0x05b2('0x16')]=_0x3d3ef0['total']||0x0;this[_0x05b2('0x20')]=_0x3d3ef0['type'];this[_0x05b2('0x21')]=_0x3d3ef0[_0x05b2('0x21')]||0x0;this['unknown']=_0x3d3ef0[_0x05b2('0x22')]||0x0;this[_0x05b2('0x23')]=_0x3d3ef0[_0x05b2('0x23')]||0x0;this[_0x05b2('0x6')]=_0x3d3ef0[_0x05b2('0x6')]||0x0;if(_0x3d3ef0[_0x05b2('0x20')]===_0x05b2('0x24')){this[_0x05b2('0x13')]=_0x3d3ef0['pTalking']||0x0;this['dialActive']=_0x3d3ef0['dialActive'];this[_0x05b2('0x25')]=_0x3d3ef0['dialMethod'];this['dialOriginateCallerIdName']=_0x3d3ef0[_0x05b2('0x26')];this[_0x05b2('0x27')]=_0x3d3ef0[_0x05b2('0x27')];this[_0x05b2('0x28')]=_0x3d3ef0[_0x05b2('0x28')];this[_0x05b2('0x29')]=_0x3d3ef0[_0x05b2('0x29')];this['temp']=_0x3d3ef0[_0x05b2('0x2a')];this[_0x05b2('0x2b')]=_0x3d3ef0[_0x05b2('0x2b')];this[_0x05b2('0x2c')]=_0x3d3ef0['outboundAnswerCallsDay'];this[_0x05b2('0xb')]=_0x3d3ef0['outboundBlacklistCallsDay'];this[_0x05b2('0xc')]=_0x3d3ef0[_0x05b2('0xc')];this[_0x05b2('0xd')]=_0x3d3ef0[_0x05b2('0xd')];this['outboundDropCallsDayACS']=_0x3d3ef0[_0x05b2('0x2d')];this['outboundDropCallsDayCallersExit']=_0x3d3ef0[_0x05b2('0x2e')];this['outboundDropCallsDayTimeout']=_0x3d3ef0[_0x05b2('0x2f')];this[_0x05b2('0xe')]=_0x3d3ef0[_0x05b2('0xe')];this['outboundNoSuchCallsDay']=_0x3d3ef0['outboundNoSuchCallsDay'];this[_0x05b2('0x30')]=_0x3d3ef0[_0x05b2('0x30')];this[_0x05b2('0x10')]=_0x3d3ef0[_0x05b2('0x10')];this['outboundRejectCallsDay']=_0x3d3ef0[_0x05b2('0x11')];this['outboundUnknownCallsDay']=_0x3d3ef0[_0x05b2('0x12')];this[_0x05b2('0x31')]=_0x3d3ef0['predictiveIntervalAnsweredCalls'];this[_0x05b2('0x32')]=_0x3d3ef0[_0x05b2('0x32')];this['predictiveIntervalAvgTalktime']=_0x3d3ef0['predictiveIntervalAvgTalktime'];this[_0x05b2('0x33')]=_0x3d3ef0[_0x05b2('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x3d3ef0[_0x05b2('0x34')];this[_0x05b2('0x35')]=_0x3d3ef0[_0x05b2('0x35')];this[_0x05b2('0x36')]=_0x3d3ef0['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x3d3ef0['predictiveIntervalHitRate'];this[_0x05b2('0x37')]=_0x3d3ef0[_0x05b2('0x37')];this['predictiveIntervalPauses']=_0x3d3ef0[_0x05b2('0x38')];this[_0x05b2('0x39')]=_0x3d3ef0[_0x05b2('0x39')];this[_0x05b2('0x3a')]=_0x3d3ef0[_0x05b2('0x3a')];this[_0x05b2('0x9')]=_0x3d3ef0[_0x05b2('0x9')];this['erlangCalls']=_0x3d3ef0[_0x05b2('0x3b')];this[_0x05b2('0x3c')]=_0x3d3ef0[_0x05b2('0x3c')];this[_0x05b2('0x3d')]=_0x3d3ef0['erlangAbandonmentRate'];this[_0x05b2('0x3e')]=_0x3d3ef0[_0x05b2('0x3e')];this['startPredictive']=_0x3d3ef0['startPredictive'];this[_0x05b2('0x3f')]=_0x3d3ef0[_0x05b2('0x3f')];this[_0x05b2('0x40')]=_0x3d3ef0[_0x05b2('0x40')];this[_0x05b2('0x41')]=_0x3d3ef0[_0x05b2('0x41')];}if(_0x3d3ef0[_0x05b2('0x42')]){this[_0x05b2('0x42')]={'id':_0x3d3ef0['Trunk']['id'],'name':_0x3d3ef0['Trunk'][_0x05b2('0x17')],'active':_0x3d3ef0[_0x05b2('0x42')]['active'],'callerid':_0x3d3ef0[_0x05b2('0x42')][_0x05b2('0x43')]};}}VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x45')]=function(_0x3c526c,_0x44476a,_0x1a656c,_0x4cea0b){this[_0x05b2('0x2')]=0x0;this['talking']=0x0;this[_0x05b2('0x3')]=0x0;this[_0x05b2('0x22')]=0x0;this['notInUse']=0x0;this[_0x05b2('0x8')]=0x0;this[_0x05b2('0x1a')]=0x0;this['invalid']=0x0;this[_0x05b2('0x21')]=0x0;this[_0x05b2('0x4')]=0x0;this[_0x05b2('0x1e')]=0x0;this[_0x05b2('0x1c')]=0x0;if(_0x1a656c){if(_0x1a656c[_0x05b2('0x0')]){this[_0x05b2('0x0')]=Number(_0x1a656c[_0x05b2('0x0')]);}if(_0x1a656c[_0x05b2('0x46')]){this['loggedIn']=Number(_0x1a656c['loggedin']);}if(_0x1a656c[_0x05b2('0x47')]){this[_0x05b2('0x6')]=Number(_0x1a656c['callers']);}}for(var _0x597d6a=0x0;_0x597d6a<_0x3c526c['length'];_0x597d6a++){var _0x40afb3=_0x44476a['SIP/'+_0x3c526c[_0x597d6a][_0x05b2('0x17')]];if(_0x40afb3&&_0x40afb3['online']){this[_0x05b2('0x2')]+=0x1;}if(_0x3c526c[_0x597d6a][_0x05b2('0x48')]==='1'){this[_0x05b2('0x5')]+=0x1;}if(_0x3c526c[_0x597d6a][_0x05b2('0x3')]==='1'&&!['2','7','8'][_0x05b2('0x49')](_0x3c526c[_0x597d6a][_0x05b2('0x4a')])){this[_0x05b2('0x3')]+=0x1;}switch(_0x3c526c[_0x597d6a][_0x05b2('0x4a')]){case'0':this[_0x05b2('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x05b2('0x8')]+=0x1;break;case'3':this[_0x05b2('0x1a')]+=0x1;break;case'4':this[_0x05b2('0x1b')]+=0x1;break;case'5':this[_0x05b2('0x21')]+=0x1;break;case'6':this[_0x05b2('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x05b2('0x25')]===_0x05b2('0x4b')){var _0x1566c9=Object[_0x05b2('0x4c')](_0x4cea0b);for(var _0xb7ab8e=0x0;_0xb7ab8e<_0x1566c9[_0x05b2('0x4d')];_0xb7ab8e++){var _0x569bad=_0x1566c9[_0xb7ab8e];var _0x43b436=_0x4cea0b[_0x569bad];if(_0x43b436[_0x05b2('0x4e')]===this[_0x05b2('0x17')]&&_0x43b436[_0x05b2('0x20')]===_0x05b2('0x4f')&&_0x43b436[_0x05b2('0x50')]==='xcally-motion-preview'){this[_0x05b2('0x5')]+=0x1;}}if(this[_0x05b2('0x5')]>this[_0x05b2('0x8')]){this[_0x05b2('0x5')]=this[_0x05b2('0x8')];}this[_0x05b2('0x13')]=0x0;}return this;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x51')]=function(_0x367ab1){var _0x577e41=![];if(_0x367ab1){_0x577e41=INBOUND_COUNTERS[_0x05b2('0x52')](function(_0x35f2bb){return this[_0x35f2bb]!==_0x367ab1[_0x35f2bb];},this);}return _0x577e41;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x53')]=function(_0xe65a2a){var _0x43cea0=![];var _0x464aeb=![];var _0x124bc4=![];if(_0xe65a2a){_0x43cea0=this[_0x05b2('0x25')]!==_0xe65a2a['dialMethod']||this['dialActive']!==_0xe65a2a[_0x05b2('0x54')]||this[_0x05b2('0x40')]!==_0xe65a2a[_0x05b2('0x40')]||this[_0x05b2('0x41')]!==_0xe65a2a[_0x05b2('0x41')];_0x464aeb=OUTBOUND_COUNTERS[_0x05b2('0x52')](function(_0x3ff46a){return this[_0x3ff46a]!==_0xe65a2a[_0x3ff46a];},this);if(this['Trunk']&&_0xe65a2a[_0x05b2('0x42')]){_0x124bc4=this['Trunk']['name']!==_0xe65a2a[_0x05b2('0x42')][_0x05b2('0x17')]||this[_0x05b2('0x42')][_0x05b2('0x55')]!==_0xe65a2a[_0x05b2('0x42')][_0x05b2('0x55')];}}return _0x43cea0||_0x464aeb||_0x124bc4;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x56')]=function(_0x5c09c6){this[_0x05b2('0x7')]=_0x5c09c6[_0x05b2('0x7')];this[_0x05b2('0x40')]=_0x5c09c6[_0x05b2('0x40')];this[_0x05b2('0x41')]=_0x5c09c6[_0x05b2('0x41')];this[_0x05b2('0x9')]=_0x5c09c6['originated'];this[_0x05b2('0xa')]=_0x5c09c6[_0x05b2('0xa')];this[_0x05b2('0x2c')]=_0x5c09c6['outboundAnswerCallsDay'];this[_0x05b2('0xb')]=_0x5c09c6['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x5c09c6[_0x05b2('0xc')];this['outboundCongestionCallsDay']=_0x5c09c6[_0x05b2('0xd')];this[_0x05b2('0xe')]=_0x5c09c6['outboundNoAnswerCallsDay'];this[_0x05b2('0xf')]=_0x5c09c6[_0x05b2('0xf')];this['outboundReCallsDay']=_0x5c09c6[_0x05b2('0x10')];this['outboundRejectCallsDay']=_0x5c09c6[_0x05b2('0x11')];this['outboundUnknownCallsDay']=_0x5c09c6[_0x05b2('0x12')];this[_0x05b2('0x14')]=_0x5c09c6[_0x05b2('0x14')];this[_0x05b2('0x15')]=_0x5c09c6['sumDuration'];this[_0x05b2('0x16')]=_0x5c09c6[_0x05b2('0x16')];if(this[_0x05b2('0x25')]===_0x05b2('0x57')){this[_0x05b2('0x13')]=_0x5c09c6[_0x05b2('0x13')];}};module[_0x05b2('0x58')]=VoiceQueueSummary;