Built motion from commit (unavailable).|2.0.74
[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 _0x6a69=['updateRealtime','prototype','getChannelStatus','CurrentCapacity','fax','sms','length','Status','StatusTime','format','emit','user:save','exports','lodash','moment','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0x1b9b74,_0xd2ba13){var _0x33a515=function(_0x1b4d6b){while(--_0x1b4d6b){_0x1b9b74['push'](_0x1b9b74['shift']());}};_0x33a515(++_0xd2ba13);}(_0x6a69,0x12c));var _0x96a6=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x6a69[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x96a6('0x0'));var moment=require(_0x96a6('0x1'));var io=require(_0x96a6('0x2'))({'host':'localhost','port':0x18eb});function Agent(_0x68289){this['id']=_0x68289['id']||0x0;this[_0x96a6('0x3')]=_0x68289[_0x96a6('0x3')]||'';this['online']=_0x68289[_0x96a6('0x4')]||!![];this['voicePause']=_0x68289[_0x96a6('0x5')]||![];this[_0x96a6('0x6')]=_0x68289[_0x96a6('0x6')]||![];this['mailPause']=_0x68289['mailPause']||![];this[_0x96a6('0x7')]=_0x68289[_0x96a6('0x7')]||![];this[_0x96a6('0x8')]=_0x68289[_0x96a6('0x8')]||![];this[_0x96a6('0x9')]=_0x68289[_0x96a6('0x9')]||![];this[_0x96a6('0xa')]='unknown';this[_0x96a6('0xb')]=0x0;this[_0x96a6('0xc')]=_0x68289[_0x96a6('0xc')]||0x0;this[_0x96a6('0xd')]=0x0;this['mailStatus']=_0x96a6('0xe');this[_0x96a6('0xf')]=0x0;this['mailCapacity']=_0x68289[_0x96a6('0x10')]||0x0;this[_0x96a6('0x11')]=0x0;this[_0x96a6('0x12')]='unknown';this[_0x96a6('0x13')]=0x0;this[_0x96a6('0x14')]=_0x68289[_0x96a6('0x14')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x96a6('0xe');this['smsStatusTime']=0x0;this[_0x96a6('0x15')]=_0x68289['smsCapacity']||0x0;this[_0x96a6('0x16')]=0x0;this['openchannelStatus']=_0x96a6('0xe');this[_0x96a6('0x17')]=0x0;this[_0x96a6('0x18')]=_0x68289[_0x96a6('0x18')]||0x0;this[_0x96a6('0x19')]=0x0;this[_0x96a6('0x1a')]=![];this[_0x96a6('0x1b')]=undefined;this[_0x96a6('0x1c')]();}Agent[_0x96a6('0x1d')][_0x96a6('0x1e')]=function(_0x571a67){if(this[_0x571a67+_0x96a6('0x1f')]>0x0){if(this[_0x571a67+'Capacity']>0x0&&this[_0x571a67+_0x96a6('0x1f')]>=this[_0x571a67+'Capacity']){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0xe702c6=['mail','chat','openchannel',_0x96a6('0x20'),_0x96a6('0x21')];for(var _0x417fd0=0x0;_0x417fd0<_0xe702c6[_0x96a6('0x22')];_0x417fd0+=0x1){var _0x4c1eb0=this['getChannelStatus'](_0xe702c6[_0x417fd0]);if(this[_0xe702c6[_0x417fd0]+_0x96a6('0x23')]!==_0x4c1eb0){this[_0xe702c6[_0x417fd0]+_0x96a6('0x24')]=_['toNumber'](moment()[_0x96a6('0x25')]('x'));}this[_0xe702c6[_0x417fd0]+'Status']=_0x4c1eb0;}io[_0x96a6('0x26')](_0x96a6('0x27'),this);};module[_0x96a6('0x28')]=Agent;