Built motion from commit eddce310.|2.6.12
[motion2.git] / server / services / routing / model / faxQueue.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 _0x256d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0x256d,0xd2));var _0xd256=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0x256d[_0x246227];return _0x37bd4a;};'use strict';var _=require(_0xd256('0x0'));var md5=require(_0xd256('0x1'));var util=require(_0xd256('0x2'));var Redis=require(_0xd256('0x3'));var config=require(_0xd256('0x4'));config[_0xd256('0x5')]=_[_0xd256('0x6')](config['redis'],{'host':_0xd256('0x7'),'port':0x18eb});var io=require(_0xd256('0x8'))(new Redis(config['redis']));function FaxQueue(_0x4ea66a){this['id']=_0x4ea66a['id']||0x0;this[_0xd256('0x9')]=_0x4ea66a[_0xd256('0x9')]||'';this[_0xd256('0xa')]=_0x4ea66a['timeout']||0xa;this[_0xd256('0xb')]=_0x4ea66a[_0xd256('0xb')]||_0xd256('0xc');this[_0xd256('0xd')]=_0x4ea66a[_0xd256('0xd')];this[_0xd256('0xe')]={};this[_0xd256('0xf')]=0x0;this[_0xd256('0x1')]='';this[_0xd256('0x10')]();this[_0xd256('0x11')]();}FaxQueue[_0xd256('0x12')]['updateRouting']=function(){var _0x3e08ae=this[_0xd256('0xe')]['_rr'];this[_0xd256('0xe')]=_['map'](this['Agents'],'id');this[_0xd256('0xe')][_0xd256('0x13')]=_0x3e08ae;};FaxQueue[_0xd256('0x12')]['updateRealtime']=function(){this[_0xd256('0x14')]=0x0;this[_0xd256('0x15')]=0x0;for(var _0x50301c=0x0;_0x50301c<this[_0xd256('0xd')][_0xd256('0x16')];_0x50301c+=0x1){if(this['Agents'][_0x50301c][_0xd256('0x17')]){this['loggedIn']+=0x1;}if(this[_0xd256('0xd')][_0x50301c][_0xd256('0x18')]){this[_0xd256('0x15')]+=0x1;}}this[_0xd256('0x19')]=this[_0xd256('0x14')]-this[_0xd256('0x15')];this[_0xd256('0x19')]=this[_0xd256('0x19')]>=0x0?this['available']:0x0;var _0x2f26f3={'id':this['id'],'available':this[_0xd256('0x19')],'loggedIn':this[_0xd256('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xd256('0xf')]};var _0x27ec0f=md5(JSON[_0xd256('0x1a')](_0x2f26f3));if(this[_0xd256('0x1')]!==_0x27ec0f){this['md5']=_0x27ec0f;io['to'](util['format'](_0xd256('0x1b'),_0x2f26f3[_0xd256('0x9')]))[_0xd256('0x1c')](_0xd256('0x1d'),_0x2f26f3);}};module[_0xd256('0x1e')]=FaxQueue;