Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / services / ami / model / agent.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 _0x0457=['voiceStatusCallerIdNumber','interface','stringify','user:%s','emit','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','address'];(function(_0x50261e,_0x2c859b){var _0x36925a=function(_0x1a2497){while(--_0x1a2497){_0x50261e['push'](_0x50261e['shift']());}};_0x36925a(++_0x2c859b);}(_0x0457,0x18c));var _0x7045=function(_0x2ef714,_0x49e1c4){_0x2ef714=_0x2ef714-0x0;var _0x252ab0=_0x0457[_0x2ef714];return _0x252ab0;};'use strict';var _=require(_0x7045('0x0'));var util=require(_0x7045('0x1'));var moment=require(_0x7045('0x2'));var md5=require(_0x7045('0x3'));var Redis=require(_0x7045('0x4'));var config=require(_0x7045('0x5'));config[_0x7045('0x6')]=_[_0x7045('0x7')](config['redis'],{'host':_0x7045('0x8'),'port':0x18eb});var io=require(_0x7045('0x9'))(new Redis(config[_0x7045('0x6')]));function Agent(_0x1d9e79){this['id']=_0x1d9e79['id']||0x0;this[_0x7045('0xa')]=_0x1d9e79['name']||'';this[_0x7045('0xb')]=_0x1d9e79[_0x7045('0xb')]||'';this[_0x7045('0xc')]=_0x1d9e79['accountcode']||'';this[_0x7045('0xd')]=_0x1d9e79[_0x7045('0xd')]||'';this[_0x7045('0xe')]=_0x7045('0xf');this[_0x7045('0x10')]=0x0;this[_0x7045('0x11')]=_0x7045('0xf');this['address']='';this['phone']='';this['mobile']='';this['interface']='';this[_0x7045('0x12')]=_0x1d9e79[_0x7045('0x12')]||![];this[_0x7045('0x13')]=_0x7045('0xf');this[_0x7045('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x7045('0x15')]='';this[_0x7045('0x16')]=![];this['local']=![];this[_0x7045('0x3')]='';}Agent[_0x7045('0x17')][_0x7045('0x18')]=function(_0x5b0b79){var _0x319179;if(_0x5b0b79&&_0x5b0b79[_0x7045('0xe')]){_0x319179=_0x5b0b79[_0x7045('0xe')][_0x7045('0x19')]();switch(_0x319179){case _0x7045('0x1a'):_0x319179=_0x7045('0x1b');break;case _0x7045('0x1c'):_0x319179=_0x7045('0x1d');break;}}if(_0x319179&&this['voiceStatus']!==_0x319179||_0x5b0b79[_0x7045('0x1e')]){this[_0x7045('0x14')]=_['toNumber'](moment()[_0x7045('0x1f')]('x'));}if(_0x319179){this[_0x7045('0x13')]=_0x319179;}var _0x57ea48={'id':this['id'],'name':this[_0x7045('0xa')],'email':this['email'],'accountcode':this[_0x7045('0xc')],'fullname':this[_0x7045('0xd')],'state':this[_0x7045('0xe')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x7045('0x20')],'online':this['online'],'voiceStatus':this[_0x7045('0x13')],'voiceStatusTime':this[_0x7045('0x14')],'voiceStatusCallerIdNumber':this[_0x7045('0x21')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x7045('0x22')],'onhold':this[_0x7045('0x16')]};var _0x402582=md5(JSON[_0x7045('0x23')](_0x57ea48));if(this[_0x7045('0x3')]!==_0x402582){this['md5']=_0x402582;io['to'](util[_0x7045('0x1f')](_0x7045('0x24'),_0x57ea48[_0x7045('0xa')]))[_0x7045('0x25')]('user:save',_0x57ea48);}};module[_0x7045('0x26')]=Agent;