Built motion from commit 5293bb2a.|2.6.30
[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 _0xff2d=['Agents','waiting','md5','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','online','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xff2d,0xa3));var _0xdff2=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xff2d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xdff2('0x0'));var md5=require('md5');var util=require(_0xdff2('0x1'));var Redis=require(_0xdff2('0x2'));var config=require(_0xdff2('0x3'));config[_0xdff2('0x4')]=_[_0xdff2('0x5')](config[_0xdff2('0x4')],{'host':_0xdff2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdff2('0x4')]));function FaxQueue(_0x4cd7d9){this['id']=_0x4cd7d9['id']||0x0;this[_0xdff2('0x7')]=_0x4cd7d9[_0xdff2('0x7')]||'';this[_0xdff2('0x8')]=_0x4cd7d9['timeout']||0xa;this[_0xdff2('0x9')]=_0x4cd7d9[_0xdff2('0x9')]||_0xdff2('0xa');this[_0xdff2('0xb')]=_0x4cd7d9[_0xdff2('0xb')];this['mapAgentsId']={};this[_0xdff2('0xc')]=0x0;this[_0xdff2('0xd')]='';this[_0xdff2('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xdff2('0xe')]=function(){var _0x528717=this[_0xdff2('0xf')][_0xdff2('0x10')];this['mapAgentsId']=_[_0xdff2('0x11')](this[_0xdff2('0xb')],'id');this[_0xdff2('0xf')][_0xdff2('0x10')]=_0x528717;};FaxQueue[_0xdff2('0x12')][_0xdff2('0x13')]=function(){this[_0xdff2('0x14')]=0x0;this[_0xdff2('0x15')]=0x0;for(var _0x28dcc6=0x0;_0x28dcc6<this[_0xdff2('0xb')]['length'];_0x28dcc6+=0x1){if(this[_0xdff2('0xb')][_0x28dcc6][_0xdff2('0x16')]){this[_0xdff2('0x14')]+=0x1;}if(this[_0xdff2('0xb')][_0x28dcc6]['faxPause']){this[_0xdff2('0x15')]+=0x1;}}this[_0xdff2('0x17')]=this['loggedIn']-this[_0xdff2('0x15')];this['available']=this[_0xdff2('0x17')]>=0x0?this[_0xdff2('0x17')]:0x0;var _0x243a45={'id':this['id'],'available':this[_0xdff2('0x17')],'loggedIn':this[_0xdff2('0x14')],'name':this[_0xdff2('0x7')],'paused':this[_0xdff2('0x15')],'waiting':this[_0xdff2('0xc')]};var _0x1fb513=md5(JSON[_0xdff2('0x18')](_0x243a45));if(this[_0xdff2('0xd')]!==_0x1fb513){this[_0xdff2('0xd')]=_0x1fb513;io['to'](util['format'](_0xdff2('0x19'),_0x243a45[_0xdff2('0x7')]))[_0xdff2('0x1a')](_0xdff2('0x1b'),_0x243a45);}};module[_0xdff2('0x1c')]=FaxQueue;