Built motion from commit 44b1f254.|2.6.26
[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 _0xce7c=['prototype','map','Agents','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime'];(function(_0x455912,_0x354916){var _0x2b3343=function(_0xe72dcb){while(--_0xe72dcb){_0x455912['push'](_0x455912['shift']());}};_0x2b3343(++_0x354916);}(_0xce7c,0xea));var _0xcce7=function(_0x3cef2a,_0x48bc9d){_0x3cef2a=_0x3cef2a-0x0;var _0x4a303b=_0xce7c[_0x3cef2a];return _0x4a303b;};'use strict';var _=require(_0xcce7('0x0'));var md5=require(_0xcce7('0x1'));var util=require(_0xcce7('0x2'));var Redis=require('ioredis');var config=require(_0xcce7('0x3'));config['redis']=_[_0xcce7('0x4')](config[_0xcce7('0x5')],{'host':_0xcce7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcce7('0x5')]));function FaxQueue(_0x524c09){this['id']=_0x524c09['id']||0x0;this['name']=_0x524c09[_0xcce7('0x7')]||'';this['timeout']=_0x524c09[_0xcce7('0x8')]||0xa;this[_0xcce7('0x9')]=_0x524c09['strategy']||_0xcce7('0xa');this['Agents']=_0x524c09['Agents'];this['mapAgentsId']={};this[_0xcce7('0xb')]=0x0;this[_0xcce7('0x1')]='';this[_0xcce7('0xc')]();this[_0xcce7('0xd')]();}FaxQueue[_0xcce7('0xe')][_0xcce7('0xc')]=function(){var _0x531a1c=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xcce7('0xf')](this[_0xcce7('0x10')],'id');this[_0xcce7('0x11')][_0xcce7('0x12')]=_0x531a1c;};FaxQueue[_0xcce7('0xe')][_0xcce7('0xd')]=function(){this[_0xcce7('0x13')]=0x0;this[_0xcce7('0x14')]=0x0;for(var _0x1ab5bd=0x0;_0x1ab5bd<this['Agents'][_0xcce7('0x15')];_0x1ab5bd+=0x1){if(this[_0xcce7('0x10')][_0x1ab5bd][_0xcce7('0x16')]){this[_0xcce7('0x13')]+=0x1;}if(this[_0xcce7('0x10')][_0x1ab5bd][_0xcce7('0x17')]){this[_0xcce7('0x14')]+=0x1;}}this[_0xcce7('0x18')]=this['loggedIn']-this['paused'];this[_0xcce7('0x18')]=this[_0xcce7('0x18')]>=0x0?this['available']:0x0;var _0x3a0bd8={'id':this['id'],'available':this[_0xcce7('0x18')],'loggedIn':this[_0xcce7('0x13')],'name':this[_0xcce7('0x7')],'paused':this['paused'],'waiting':this[_0xcce7('0xb')]};var _0x304a81=md5(JSON[_0xcce7('0x19')](_0x3a0bd8));if(this['md5']!==_0x304a81){this[_0xcce7('0x1')]=_0x304a81;io['to'](util[_0xcce7('0x1a')](_0xcce7('0x1b'),_0x3a0bd8['name']))[_0xcce7('0x1c')](_0xcce7('0x1d'),_0x3a0bd8);}};module[_0xcce7('0x1e')]=FaxQueue;