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