1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0xb2c5=['error','E_AGI_SERVER_ERROR','message','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','emit'];(function(_0x53fda4,_0x4b3384){var _0xcc6663=function(_0x3e55fc){while(--_0x3e55fc){_0x53fda4['push'](_0x53fda4['shift']());}};_0xcc6663(++_0x4b3384);}(_0xb2c5,0x66));var _0x5b2c=function(_0x1c1577,_0x1d4d6d){_0x1c1577=_0x1c1577-0x0;var _0x566d1f=_0xb2c5[_0x1c1577];return _0x566d1f;};'use strict';var _=require(_0x5b2c('0x0'));var EventEmitter=require(_0x5b2c('0x1'))[_0x5b2c('0x2')];var Redis=require(_0x5b2c('0x3'));var AGIError=require(_0x5b2c('0x4'));var config=require(_0x5b2c('0x5'));config[_0x5b2c('0x6')]=_[_0x5b2c('0x7')](config['redis'],{'host':_0x5b2c('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5b2c('0x6')]);sub['subscribe']('agi',function(_0x5edef8){if(_0x5edef8)return eventEmitter[_0x5b2c('0x9')](_0x5b2c('0xa'),new AGIError(_0x5b2c('0xb'),_0x5edef8));});sub['on'](_0x5b2c('0xc'),function(_0x40815d,_0x5d61d4){if(_0x40815d!=='agi')return;try{var _0x33c5a3=JSON['parse'](_0x5d61d4);eventEmitter[_0x5b2c('0x9')]('projectUpdate',_0x33c5a3);}catch(_0x26f59c){eventEmitter[_0x5b2c('0x9')](_0x5b2c('0xa'),new AGIError(_0x5b2c('0xb'),_0x26f59c));}});module[_0x5b2c('0xd')]={'EventEmitter':eventEmitter};