Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / services / routing / model / agent.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 _0xd732=['faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','smsCapacity','smsCurrentCapacity','openchannelStatusTime','stringify','emit','user:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus'];(function(_0x4c04c6,_0x382d1a){var _0x25cfc7=function(_0x29f6cf){while(--_0x29f6cf){_0x4c04c6['push'](_0x4c04c6['shift']());}};_0x25cfc7(++_0x382d1a);}(_0xd732,0x18e));var _0x2d73=function(_0x1030fb,_0x30c5f1){_0x1030fb=_0x1030fb-0x0;var _0x4398dd=_0xd732[_0x1030fb];return _0x4398dd;};'use strict';var _=require(_0x2d73('0x0'));var moment=require('moment');var md5=require(_0x2d73('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2d73('0x2')]=_[_0x2d73('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2d73('0x4'))(new Redis(config['redis']));function Agent(_0x462758){this['id']=_0x462758['id']||0x0;this[_0x2d73('0x5')]=_0x462758['name']||'';this['online']=_0x462758[_0x2d73('0x6')]||!![];this['voicePause']=_0x462758[_0x2d73('0x7')]||![];this[_0x2d73('0x8')]=_0x462758[_0x2d73('0x8')]||![];this[_0x2d73('0x9')]=_0x462758['mailPause']||![];this[_0x2d73('0xa')]=_0x462758[_0x2d73('0xa')]||![];this[_0x2d73('0xb')]=_0x462758[_0x2d73('0xb')]||![];this['openchannelPause']=_0x462758[_0x2d73('0xc')]||![];this[_0x2d73('0xd')]=_0x2d73('0xe');this[_0x2d73('0xf')]=0x0;this[_0x2d73('0x10')]=_0x462758[_0x2d73('0x10')]||0x0;this[_0x2d73('0x11')]=0x0;this[_0x2d73('0x12')]=_0x2d73('0xe');this[_0x2d73('0x13')]=0x0;this[_0x2d73('0x14')]=_0x462758[_0x2d73('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x2d73('0x15')]='unknown';this[_0x2d73('0x16')]=0x0;this['faxCapacity']=_0x462758[_0x2d73('0x17')]||0x0;this[_0x2d73('0x18')]=0x0;this[_0x2d73('0x19')]=_0x2d73('0xe');this[_0x2d73('0x1a')]=0x0;this['smsCapacity']=_0x462758['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x2d73('0x1b')]=_0x2d73('0xe');this[_0x2d73('0x1c')]=0x0;this['whatsappCapacity']=_0x462758[_0x2d73('0x1d')]||0x0;this[_0x2d73('0x1e')]=0x0;this[_0x2d73('0x1f')]=_0x2d73('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x462758[_0x2d73('0x20')]||0x0;this[_0x2d73('0x21')]=0x0;this[_0x2d73('0x22')]=![];this[_0x2d73('0x23')]=undefined;this[_0x2d73('0x1')]='';this[_0x2d73('0x24')]();}Agent[_0x2d73('0x25')][_0x2d73('0x26')]=function(_0x503b49){if(this[_0x503b49+_0x2d73('0x27')]>0x0){if(this[_0x503b49+_0x2d73('0x28')]>0x0&&this[_0x503b49+_0x2d73('0x27')]>=this[_0x503b49+_0x2d73('0x28')]){return'maxcapacity';}else{return _0x2d73('0x29');}}else{return _0x2d73('0x2a');}};Agent[_0x2d73('0x25')][_0x2d73('0x24')]=function(){var _0x1899d6=[_0x2d73('0x2b'),_0x2d73('0x2c'),_0x2d73('0x2d'),_0x2d73('0x2e'),_0x2d73('0x2f'),_0x2d73('0x30')];for(var _0x20b818=0x0;_0x20b818<_0x1899d6[_0x2d73('0x31')];_0x20b818+=0x1){var _0x11d2f3=this[_0x2d73('0x26')](_0x1899d6[_0x20b818]);if(this[_0x1899d6[_0x20b818]+_0x2d73('0x32')]!==_0x11d2f3){this[_0x1899d6[_0x20b818]+_0x2d73('0x33')]=_['toNumber'](moment()[_0x2d73('0x34')]('x'));}this[_0x1899d6[_0x20b818]+_0x2d73('0x32')]=_0x11d2f3;}var _0x2cdfd0={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x2d73('0x7')],'chatPause':this[_0x2d73('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x2d73('0xa')],'openchannelPause':this[_0x2d73('0xc')],'chatStatus':this[_0x2d73('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2d73('0x11')],'mailStatus':this[_0x2d73('0x12')],'mailStatusTime':this[_0x2d73('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2d73('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2d73('0x17')],'faxCurrentCapacity':this[_0x2d73('0x18')],'smsStatus':this[_0x2d73('0x19')],'smsStatusTime':this[_0x2d73('0x1a')],'smsCapacity':this[_0x2d73('0x35')],'smsCurrentCapacity':this[_0x2d73('0x36')],'whatsappStatus':this[_0x2d73('0x1b')],'whatsappStatusTime':this[_0x2d73('0x1c')],'whatsappCapacity':this[_0x2d73('0x1d')],'whatsappCurrentCapacity':this[_0x2d73('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x2d73('0x37')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x2d73('0x21')],'busy':this['busy'],'busyQueue':this[_0x2d73('0x23')]};var _0x28bc43=md5(JSON[_0x2d73('0x38')](_0x2cdfd0));if(this[_0x2d73('0x1')]!==_0x28bc43){this[_0x2d73('0x1')]=_0x28bc43;io[_0x2d73('0x39')](_0x2d73('0x3a'),_0x2cdfd0);}};module[_0x2d73('0x3b')]=Agent;