dbe8e2426e655f6c08e4548712db82573b323ac7
[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 _0xe132=['preview','exports','available','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','loggedin','callers','SIP/','incall','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0xe132,0x162));var _0x2e13=function(_0x1b64c1,_0x54627b){_0x1b64c1=_0x1b64c1-0x0;var _0x2f6725=_0xe132[_0x1b64c1];return _0x2f6725;};'use strict';var INBOUND_COUNTERS=[_0x2e13('0x0'),'loggedIn',_0x2e13('0x1'),_0x2e13('0x2'),_0x2e13('0x3'),_0x2e13('0x4'),_0x2e13('0x5')];var OUTBOUND_COUNTERS=['available',_0x2e13('0x6'),_0x2e13('0x7'),'loggedIn','loggedInDb',_0x2e13('0x8'),_0x2e13('0x9'),_0x2e13('0xa'),_0x2e13('0xb'),_0x2e13('0xc'),_0x2e13('0xd'),_0x2e13('0xe'),_0x2e13('0xf'),_0x2e13('0x10'),_0x2e13('0x11'),'outboundUnknownCallsDay',_0x2e13('0x2'),_0x2e13('0x12'),_0x2e13('0x4'),_0x2e13('0x13'),_0x2e13('0x14'),_0x2e13('0x15'),_0x2e13('0x5')];function VoiceQueueSummary(_0x5f4ee2){this['id']=_0x5f4ee2['id'];this[_0x2e13('0x16')]=_0x5f4ee2[_0x2e13('0x16')];this[_0x2e13('0x17')]=_0x5f4ee2[_0x2e13('0x17')];this[_0x2e13('0x18')]=_0x5f4ee2[_0x2e13('0x18')]||0x0;this[_0x2e13('0x6')]=_0x5f4ee2['answered']||0x0;this[_0x2e13('0x0')]=_0x5f4ee2[_0x2e13('0x0')]||0x0;this[_0x2e13('0x19')]=_0x5f4ee2['busy']||0x0;this[_0x2e13('0x7')]=_0x5f4ee2[_0x2e13('0x7')]||0x0;this[_0x2e13('0x1a')]=_0x5f4ee2['invalid']||0x0;this[_0x2e13('0x1b')]=_0x5f4ee2[_0x2e13('0x1b')]||0x0;this[_0x2e13('0x1')]=_0x5f4ee2['loggedInDb']||0x0;this['onHold']=_0x5f4ee2[_0x2e13('0x1c')]||0x0;this[_0x2e13('0x1d')]=_0x5f4ee2[_0x2e13('0x1d')]||0x0;this[_0x2e13('0x2')]=_0x5f4ee2[_0x2e13('0x2')]||0x0;this[_0x2e13('0x3')]=_0x5f4ee2[_0x2e13('0x3')]||0x0;this[_0x2e13('0x1e')]=_0x5f4ee2['ringInUse'];this[_0x2e13('0x13')]=_0x5f4ee2[_0x2e13('0x13')];this[_0x2e13('0x14')]=_0x5f4ee2[_0x2e13('0x14')];this['sumHoldTime']=_0x5f4ee2['sumHoldTime']||0x0;this[_0x2e13('0x4')]=_0x5f4ee2[_0x2e13('0x4')]||0x0;this['total']=_0x5f4ee2['total']||0x0;this['type']=_0x5f4ee2[_0x2e13('0x1f')];this[_0x2e13('0x20')]=_0x5f4ee2[_0x2e13('0x20')]||0x0;this[_0x2e13('0x21')]=_0x5f4ee2[_0x2e13('0x21')]||0x0;this[_0x2e13('0x22')]=_0x5f4ee2['unmanaged']||0x0;this[_0x2e13('0x5')]=_0x5f4ee2[_0x2e13('0x5')]||0x0;if(_0x5f4ee2[_0x2e13('0x1f')]===_0x2e13('0x23')){this[_0x2e13('0x12')]=_0x5f4ee2[_0x2e13('0x12')]||0x0;this['dialActive']=_0x5f4ee2[_0x2e13('0x24')];this[_0x2e13('0x25')]=_0x5f4ee2['dialMethod'];this['dialOriginateCallerIdName']=_0x5f4ee2[_0x2e13('0x26')];this[_0x2e13('0x27')]=_0x5f4ee2[_0x2e13('0x27')];this['dialOriginateTimeout']=_0x5f4ee2[_0x2e13('0x28')];this[_0x2e13('0x29')]=_0x5f4ee2[_0x2e13('0x29')];this[_0x2e13('0x2a')]=_0x5f4ee2[_0x2e13('0x2a')];this[_0x2e13('0x2b')]=_0x5f4ee2[_0x2e13('0x2b')];this[_0x2e13('0xa')]=_0x5f4ee2[_0x2e13('0xa')];this[_0x2e13('0xb')]=_0x5f4ee2[_0x2e13('0xb')];this[_0x2e13('0xc')]=_0x5f4ee2[_0x2e13('0xc')];this[_0x2e13('0xd')]=_0x5f4ee2[_0x2e13('0xd')];this['outboundDropCallsDayACS']=_0x5f4ee2[_0x2e13('0x2c')];this[_0x2e13('0x2d')]=_0x5f4ee2[_0x2e13('0x2d')];this['outboundDropCallsDayTimeout']=_0x5f4ee2['outboundDropCallsDayTimeout'];this[_0x2e13('0xe')]=_0x5f4ee2[_0x2e13('0xe')];this[_0x2e13('0xf')]=_0x5f4ee2[_0x2e13('0xf')];this[_0x2e13('0x2e')]=_0x5f4ee2[_0x2e13('0x2e')];this['outboundReCallsDay']=_0x5f4ee2['outboundReCallsDay'];this[_0x2e13('0x11')]=_0x5f4ee2[_0x2e13('0x11')];this[_0x2e13('0x2f')]=_0x5f4ee2[_0x2e13('0x2f')];this[_0x2e13('0x30')]=_0x5f4ee2[_0x2e13('0x30')];this[_0x2e13('0x31')]=_0x5f4ee2[_0x2e13('0x31')];this['predictiveIntervalAvgTalktime']=_0x5f4ee2[_0x2e13('0x32')];this[_0x2e13('0x33')]=_0x5f4ee2[_0x2e13('0x33')];this[_0x2e13('0x34')]=_0x5f4ee2[_0x2e13('0x34')];this['predictiveIntervalErlangCalls']=_0x5f4ee2[_0x2e13('0x35')];this[_0x2e13('0x36')]=_0x5f4ee2['predictiveIntervalErlangCallsDroppedCalls'];this[_0x2e13('0x37')]=_0x5f4ee2[_0x2e13('0x37')];this[_0x2e13('0x38')]=_0x5f4ee2['predictiveIntervalMultiplicativeFactor'];this[_0x2e13('0x39')]=_0x5f4ee2[_0x2e13('0x39')];this['predictiveIntervalAvailable']=_0x5f4ee2[_0x2e13('0x3a')];this[_0x2e13('0x3b')]=_0x5f4ee2['predictiveIntervalTotalCalls'];this[_0x2e13('0x8')]=_0x5f4ee2['originated'];this[_0x2e13('0x3c')]=_0x5f4ee2[_0x2e13('0x3c')];this['erlangCallToSecond']=_0x5f4ee2[_0x2e13('0x3d')];this[_0x2e13('0x3e')]=_0x5f4ee2[_0x2e13('0x3e')];this[_0x2e13('0x3f')]=_0x5f4ee2[_0x2e13('0x3f')];this[_0x2e13('0x40')]=_0x5f4ee2[_0x2e13('0x40')];this[_0x2e13('0x41')]=_0x5f4ee2[_0x2e13('0x41')];this[_0x2e13('0x42')]=_0x5f4ee2['message'];this[_0x2e13('0x43')]=_0x5f4ee2[_0x2e13('0x43')];}if(_0x5f4ee2[_0x2e13('0x44')]){this[_0x2e13('0x44')]={'id':_0x5f4ee2[_0x2e13('0x44')]['id'],'name':_0x5f4ee2['Trunk'][_0x2e13('0x16')],'active':_0x5f4ee2['Trunk'][_0x2e13('0x45')],'callerid':_0x5f4ee2[_0x2e13('0x44')]['callerid']};}}VoiceQueueSummary[_0x2e13('0x46')]['createReport']=function(_0x73f6a2,_0x790564,_0x3f473f,_0x230f94){this[_0x2e13('0x1')]=0x0;this['talking']=0x0;this[_0x2e13('0x2')]=0x0;this['unknown']=0x0;this[_0x2e13('0x1d')]=0x0;this[_0x2e13('0x7')]=0x0;this[_0x2e13('0x19')]=0x0;this[_0x2e13('0x1a')]=0x0;this[_0x2e13('0x20')]=0x0;this[_0x2e13('0x3')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x3f473f){if(_0x3f473f[_0x2e13('0x0')]){this[_0x2e13('0x0')]=Number(_0x3f473f['available']);}if(_0x3f473f[_0x2e13('0x47')]){this[_0x2e13('0x1b')]=Number(_0x3f473f[_0x2e13('0x47')]);}if(_0x3f473f['callers']){this['waiting']=Number(_0x3f473f[_0x2e13('0x48')]);}}for(var _0x59ae24=0x0;_0x59ae24<_0x73f6a2['length'];_0x59ae24++){var _0x8a6f35=_0x790564[_0x2e13('0x49')+_0x73f6a2[_0x59ae24][_0x2e13('0x16')]];if(_0x8a6f35&&_0x8a6f35['online']){this[_0x2e13('0x1')]+=0x1;}if(_0x73f6a2[_0x59ae24][_0x2e13('0x4a')]==='1'){this[_0x2e13('0x4')]+=0x1;}if(_0x73f6a2[_0x59ae24][_0x2e13('0x2')]==='1'&&!['2','7','8']['includes'](_0x73f6a2[_0x59ae24][_0x2e13('0x4b')])){this['paused']+=0x1;}switch(_0x73f6a2[_0x59ae24][_0x2e13('0x4b')]){case'0':this[_0x2e13('0x21')]+=0x1;break;case'1':this[_0x2e13('0x1d')]+=0x1;break;case'2':this[_0x2e13('0x7')]+=0x1;break;case'3':this[_0x2e13('0x19')]+=0x1;break;case'4':this[_0x2e13('0x1a')]+=0x1;break;case'5':this[_0x2e13('0x20')]+=0x1;break;case'6':this[_0x2e13('0x3')]+=0x1;break;case'7':this[_0x2e13('0x1e')]+=0x1;break;case'8':this[_0x2e13('0x1c')]+=0x1;break;}}if(this['dialMethod']===_0x2e13('0x4c')){var _0x10352e=Object[_0x2e13('0x4d')](_0x230f94);for(var _0x1d13ec=0x0;_0x1d13ec<_0x10352e[_0x2e13('0x4e')];_0x1d13ec++){var _0xcc5495=_0x10352e[_0x1d13ec];var _0x2cd6d4=_0x230f94[_0xcc5495];if(_0x2cd6d4[_0x2e13('0x4f')]===this[_0x2e13('0x16')]&&_0x2cd6d4[_0x2e13('0x1f')]===_0x2e13('0x50')&&_0x2cd6d4[_0x2e13('0x51')]==='xcally-motion-preview'){this[_0x2e13('0x4')]+=0x1;}}if(this[_0x2e13('0x4')]>this[_0x2e13('0x7')]){this[_0x2e13('0x4')]=this[_0x2e13('0x7')];}this[_0x2e13('0x12')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x2e13('0x52')]=function(_0x1682ad){var _0xb63ed4=![];if(_0x1682ad){_0xb63ed4=INBOUND_COUNTERS[_0x2e13('0x53')](function(_0x2a9587){return this[_0x2a9587]!==_0x1682ad[_0x2a9587];},this);}return _0xb63ed4;};VoiceQueueSummary[_0x2e13('0x46')][_0x2e13('0x54')]=function(_0x5aefda){var _0x2ee749=![];var _0x3a1a9c=![];var _0x252b14=![];if(_0x5aefda){_0x2ee749=this['dialMethod']!==_0x5aefda[_0x2e13('0x25')]||this[_0x2e13('0x24')]!==_0x5aefda['dialActive']||this[_0x2e13('0x42')]!==_0x5aefda['message']||this['statusMessage']!==_0x5aefda[_0x2e13('0x43')];_0x3a1a9c=OUTBOUND_COUNTERS[_0x2e13('0x53')](function(_0x448680){return this[_0x448680]!==_0x5aefda[_0x448680];},this);if(this[_0x2e13('0x44')]&&_0x5aefda[_0x2e13('0x44')]){_0x252b14=this['Trunk'][_0x2e13('0x16')]!==_0x5aefda['Trunk']['name']||this[_0x2e13('0x44')]['active']!==_0x5aefda[_0x2e13('0x44')][_0x2e13('0x45')];}}return _0x2ee749||_0x3a1a9c||_0x252b14;};VoiceQueueSummary[_0x2e13('0x46')][_0x2e13('0x55')]=function(_0x3dbc75){this[_0x2e13('0x6')]=_0x3dbc75[_0x2e13('0x6')];this[_0x2e13('0x42')]=_0x3dbc75['message'];this[_0x2e13('0x43')]=_0x3dbc75[_0x2e13('0x43')];this['originated']=_0x3dbc75['originated'];this[_0x2e13('0x9')]=_0x3dbc75[_0x2e13('0x9')];this[_0x2e13('0xa')]=_0x3dbc75['outboundAnswerCallsDay'];this[_0x2e13('0xb')]=_0x3dbc75['outboundBlacklistCallsDay'];this[_0x2e13('0xc')]=_0x3dbc75[_0x2e13('0xc')];this[_0x2e13('0xd')]=_0x3dbc75['outboundCongestionCallsDay'];this[_0x2e13('0xe')]=_0x3dbc75['outboundNoAnswerCallsDay'];this[_0x2e13('0xf')]=_0x3dbc75[_0x2e13('0xf')];this[_0x2e13('0x10')]=_0x3dbc75[_0x2e13('0x10')];this[_0x2e13('0x11')]=_0x3dbc75[_0x2e13('0x11')];this['outboundUnknownCallsDay']=_0x3dbc75[_0x2e13('0x2f')];this[_0x2e13('0x13')]=_0x3dbc75['sumBillable'];this['sumDuration']=_0x3dbc75[_0x2e13('0x14')];this[_0x2e13('0x15')]=_0x3dbc75['total'];if(this['dialMethod']===_0x2e13('0x56')){this['pTalking']=_0x3dbc75[_0x2e13('0x12')];}};module[_0x2e13('0x57')]=VoiceQueueSummary;