Built motion from commit 953226e6.|2.6.32
[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 _0xff5b=['Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x3cfe15,_0x4d7512){var _0x6f5e06=function(_0x27c5f0){while(--_0x27c5f0){_0x3cfe15['push'](_0x3cfe15['shift']());}};_0x6f5e06(++_0x4d7512);}(_0xff5b,0x120));var _0xbff5=function(_0x2e8606,_0x143242){_0x2e8606=_0x2e8606-0x0;var _0x20c962=_0xff5b[_0x2e8606];return _0x20c962;};'use strict';var _=require(_0xbff5('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbff5('0x1'));var config=require('../../../config/environment');config[_0xbff5('0x2')]=_['defaults'](config[_0xbff5('0x2')],{'host':_0xbff5('0x3'),'port':0x18eb});var io=require(_0xbff5('0x4'))(new Redis(config[_0xbff5('0x2')]));function FaxQueue(_0x1ce88e){this['id']=_0x1ce88e['id']||0x0;this[_0xbff5('0x5')]=_0x1ce88e[_0xbff5('0x5')]||'';this[_0xbff5('0x6')]=_0x1ce88e[_0xbff5('0x6')]||0xa;this['strategy']=_0x1ce88e[_0xbff5('0x7')]||_0xbff5('0x8');this[_0xbff5('0x9')]=_0x1ce88e[_0xbff5('0x9')];this[_0xbff5('0xa')]={};this[_0xbff5('0xb')]=0x0;this[_0xbff5('0xc')]='';this[_0xbff5('0xd')]();this['updateRealtime']();}FaxQueue[_0xbff5('0xe')][_0xbff5('0xd')]=function(){var _0x47f236=this['mapAgentsId'][_0xbff5('0xf')];this['mapAgentsId']=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xbff5('0xf')]=_0x47f236;};FaxQueue[_0xbff5('0xe')][_0xbff5('0x10')]=function(){this[_0xbff5('0x11')]=0x0;this[_0xbff5('0x12')]=0x0;for(var _0x1689d0=0x0;_0x1689d0<this[_0xbff5('0x9')][_0xbff5('0x13')];_0x1689d0+=0x1){if(this[_0xbff5('0x9')][_0x1689d0]['online']){this[_0xbff5('0x11')]+=0x1;}if(this[_0xbff5('0x9')][_0x1689d0][_0xbff5('0x14')]){this[_0xbff5('0x12')]+=0x1;}}this[_0xbff5('0x15')]=this[_0xbff5('0x11')]-this[_0xbff5('0x12')];this[_0xbff5('0x15')]=this[_0xbff5('0x15')]>=0x0?this['available']:0x0;var _0x5d2fdd={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbff5('0x11')],'name':this['name'],'paused':this[_0xbff5('0x12')],'waiting':this[_0xbff5('0xb')]};var _0x5c955f=md5(JSON[_0xbff5('0x16')](_0x5d2fdd));if(this[_0xbff5('0xc')]!==_0x5c955f){this['md5']=_0x5c955f;io['to'](util[_0xbff5('0x17')](_0xbff5('0x18'),_0x5d2fdd['name']))[_0xbff5('0x19')](_0xbff5('0x1a'),_0x5d2fdd);}};module['exports']=FaxQueue;