Built motion from commit (unavailable).|2.3.6
[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 _0x5a46=['phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','format','name','stringify','emit','user:save','exports','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','email','accountcode','fullname','state','stateTime','status','unknown','address'];(function(_0x3eb228,_0xb299e5){var _0x5ba782=function(_0x1be8a8){while(--_0x1be8a8){_0x3eb228['push'](_0x3eb228['shift']());}};_0x5ba782(++_0xb299e5);}(_0x5a46,0x101));var _0x65a4=function(_0x406c58,_0x4a2847){_0x406c58=_0x406c58-0x0;var _0x2e9f5c=_0x5a46[_0x406c58];return _0x2e9f5c;};'use strict';var _=require(_0x65a4('0x0'));var util=require(_0x65a4('0x1'));var moment=require('moment');var md5=require(_0x65a4('0x2'));var Redis=require(_0x65a4('0x3'));var config=require(_0x65a4('0x4'));config['redis']=_['defaults'](config[_0x65a4('0x5')],{'host':_0x65a4('0x6'),'port':0x18eb});var io=require(_0x65a4('0x7'))(new Redis(config[_0x65a4('0x5')]));function Agent(_0x119c81){this['id']=_0x119c81['id']||0x0;this['name']=_0x119c81['name']||'';this[_0x65a4('0x8')]=_0x119c81[_0x65a4('0x8')]||'';this['accountcode']=_0x119c81[_0x65a4('0x9')]||'';this[_0x65a4('0xa')]=_0x119c81[_0x65a4('0xa')]||'';this[_0x65a4('0xb')]='unknown';this[_0x65a4('0xc')]=0x0;this[_0x65a4('0xd')]=_0x65a4('0xe');this[_0x65a4('0xf')]='';this[_0x65a4('0x10')]='';this[_0x65a4('0x11')]='';this['interface']='';this['online']=_0x119c81[_0x65a4('0x12')]||![];this['voiceStatus']='unknown';this[_0x65a4('0x13')]=0x0;this[_0x65a4('0x14')]='';this[_0x65a4('0x15')]='';this[_0x65a4('0x16')]=![];this[_0x65a4('0x17')]=![];this['md5']='';}Agent[_0x65a4('0x18')][_0x65a4('0x19')]=function(_0xd8a5b5){var _0x5c2635;if(_0xd8a5b5&&_0xd8a5b5[_0x65a4('0xb')]){_0x5c2635=_0xd8a5b5[_0x65a4('0xb')][_0x65a4('0x1a')]();switch(_0x5c2635){case _0x65a4('0x1b'):_0x5c2635=_0x65a4('0x1c');break;case _0x65a4('0x1d'):_0x5c2635=_0x65a4('0x1e');break;}}if(_0x5c2635&&this[_0x65a4('0x1f')]!==_0x5c2635||_0xd8a5b5[_0x65a4('0x20')]){this[_0x65a4('0x13')]=_['toNumber'](moment()[_0x65a4('0x21')]('x'));}if(_0x5c2635){this[_0x65a4('0x1f')]=_0x5c2635;}var _0x2f5130={'id':this['id'],'name':this[_0x65a4('0x22')],'email':this[_0x65a4('0x8')],'accountcode':this[_0x65a4('0x9')],'fullname':this[_0x65a4('0xa')],'state':this[_0x65a4('0xb')],'stateTime':this[_0x65a4('0xc')],'status':this[_0x65a4('0xd')],'address':this[_0x65a4('0xf')],'online':this[_0x65a4('0x12')],'voiceStatus':this[_0x65a4('0x1f')],'voiceStatusTime':this[_0x65a4('0x13')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x65a4('0x15')],'interface':this['interface'],'onhold':this['onhold']};var _0x23f0f0=md5(JSON[_0x65a4('0x23')](_0x2f5130));if(this[_0x65a4('0x2')]!==_0x23f0f0){this[_0x65a4('0x2')]=_0x23f0f0;io['to'](util[_0x65a4('0x21')]('user:%s',_0x2f5130[_0x65a4('0x22')]))[_0x65a4('0x24')](_0x65a4('0x25'),_0x2f5130);}};module[_0x65a4('0x26')]=Agent;