Built motion from commit 4a17b4ed.|2.6.17
[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 _0xd412=['updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x1e0246,_0xa01c9d){var _0x5123ff=function(_0x35c05d){while(--_0x35c05d){_0x1e0246['push'](_0x1e0246['shift']());}};_0x5123ff(++_0xa01c9d);}(_0xd412,0x168));var _0x2d41=function(_0xedea6a,_0x23fa84){_0xedea6a=_0xedea6a-0x0;var _0x3bc2f8=_0xd412[_0xedea6a];return _0x3bc2f8;};'use strict';var _=require(_0x2d41('0x0'));var md5=require('md5');var util=require(_0x2d41('0x1'));var Redis=require(_0x2d41('0x2'));var config=require(_0x2d41('0x3'));config[_0x2d41('0x4')]=_[_0x2d41('0x5')](config[_0x2d41('0x4')],{'host':_0x2d41('0x6'),'port':0x18eb});var io=require(_0x2d41('0x7'))(new Redis(config[_0x2d41('0x4')]));function FaxQueue(_0x3f475d){this['id']=_0x3f475d['id']||0x0;this[_0x2d41('0x8')]=_0x3f475d[_0x2d41('0x8')]||'';this[_0x2d41('0x9')]=_0x3f475d['timeout']||0xa;this['strategy']=_0x3f475d[_0x2d41('0xa')]||_0x2d41('0xb');this[_0x2d41('0xc')]=_0x3f475d[_0x2d41('0xc')];this[_0x2d41('0xd')]={};this[_0x2d41('0xe')]=0x0;this[_0x2d41('0xf')]='';this[_0x2d41('0x10')]();this[_0x2d41('0x11')]();}FaxQueue[_0x2d41('0x12')]['updateRouting']=function(){var _0x4c91bb=this[_0x2d41('0xd')][_0x2d41('0x13')];this[_0x2d41('0xd')]=_['map'](this[_0x2d41('0xc')],'id');this[_0x2d41('0xd')][_0x2d41('0x13')]=_0x4c91bb;};FaxQueue[_0x2d41('0x12')][_0x2d41('0x11')]=function(){this[_0x2d41('0x14')]=0x0;this[_0x2d41('0x15')]=0x0;for(var _0x5ef94a=0x0;_0x5ef94a<this[_0x2d41('0xc')][_0x2d41('0x16')];_0x5ef94a+=0x1){if(this[_0x2d41('0xc')][_0x5ef94a][_0x2d41('0x17')]){this[_0x2d41('0x14')]+=0x1;}if(this[_0x2d41('0xc')][_0x5ef94a][_0x2d41('0x18')]){this[_0x2d41('0x15')]+=0x1;}}this[_0x2d41('0x19')]=this['loggedIn']-this[_0x2d41('0x15')];this['available']=this['available']>=0x0?this[_0x2d41('0x19')]:0x0;var _0x1dd56b={'id':this['id'],'available':this[_0x2d41('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x2d41('0x8')],'paused':this[_0x2d41('0x15')],'waiting':this[_0x2d41('0xe')]};var _0x953983=md5(JSON[_0x2d41('0x1a')](_0x1dd56b));if(this['md5']!==_0x953983){this[_0x2d41('0xf')]=_0x953983;io['to'](util[_0x2d41('0x1b')]('fax:queue:%s',_0x1dd56b['name']))[_0x2d41('0x1c')]('fax_queue:save',_0x1dd56b);}};module['exports']=FaxQueue;