Built motion from commit (unavailable).|2.4.1
[motion2.git] / server / services / routing / model / smsQueue.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 _0xce93=['md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online','smsPause','available','waiting','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x3a7dc6,_0x28d918){var _0xe42cfb=function(_0x19e126){while(--_0x19e126){_0x3a7dc6['push'](_0x3a7dc6['shift']());}};_0xe42cfb(++_0x28d918);}(_0xce93,0xd1));var _0x3ce9=function(_0x4a752b,_0x1a8b9a){_0x4a752b=_0x4a752b-0x0;var _0x4696a4=_0xce93[_0x4a752b];return _0x4696a4;};'use strict';var _=require(_0x3ce9('0x0'));var md5=require(_0x3ce9('0x1'));var util=require(_0x3ce9('0x2'));var Redis=require(_0x3ce9('0x3'));var config=require(_0x3ce9('0x4'));config[_0x3ce9('0x5')]=_[_0x3ce9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3ce9('0x7'))(new Redis(config[_0x3ce9('0x5')]));function SmsQueue(_0x3338e5){this['id']=_0x3338e5['id']||0x0;this['name']=_0x3338e5[_0x3ce9('0x8')]||'';this['timeout']=_0x3338e5[_0x3ce9('0x9')]||0xa;this[_0x3ce9('0xa')]=_0x3338e5[_0x3ce9('0xa')]||_0x3ce9('0xb');this[_0x3ce9('0xc')]=_0x3338e5[_0x3ce9('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3ce9('0x1')]='';this[_0x3ce9('0xd')]();this[_0x3ce9('0xe')]();}SmsQueue['prototype'][_0x3ce9('0xd')]=function(){var _0x4f8be2=this['mapAgentsId'][_0x3ce9('0xf')];this[_0x3ce9('0x10')]=_[_0x3ce9('0x11')](this[_0x3ce9('0xc')],'id');this[_0x3ce9('0x10')][_0x3ce9('0xf')]=_0x4f8be2;};SmsQueue[_0x3ce9('0x12')]['updateRealtime']=function(){this[_0x3ce9('0x13')]=0x0;this[_0x3ce9('0x14')]=0x0;for(var _0x2c5030=0x0;_0x2c5030<this['Agents'][_0x3ce9('0x15')];_0x2c5030+=0x1){if(this[_0x3ce9('0xc')][_0x2c5030][_0x3ce9('0x16')]){this[_0x3ce9('0x13')]+=0x1;}if(this['Agents'][_0x2c5030][_0x3ce9('0x17')]){this[_0x3ce9('0x14')]+=0x1;}}this[_0x3ce9('0x18')]=this['loggedIn']-this[_0x3ce9('0x14')];this[_0x3ce9('0x18')]=this[_0x3ce9('0x18')]>=0x0?this[_0x3ce9('0x18')]:0x0;var _0x4f3eed={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3ce9('0x13')],'name':this[_0x3ce9('0x8')],'paused':this[_0x3ce9('0x14')],'waiting':this[_0x3ce9('0x19')]};var _0x40ba57=md5(JSON[_0x3ce9('0x1a')](_0x4f3eed));if(this[_0x3ce9('0x1')]!==_0x40ba57){this[_0x3ce9('0x1')]=_0x40ba57;io['to'](util['format'](_0x3ce9('0x1b'),_0x4f3eed['name']))[_0x3ce9('0x1c')]('sms_queue:save',_0x4f3eed);}};module[_0x3ce9('0x1d')]=SmsQueue;