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