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 _0xd0f1=['message','parse','exports','events','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR'];(function(_0xbad322,_0x3e6b0b){var _0x2101cb=function(_0x1c3c3b){while(--_0x1c3c3b){_0xbad322['push'](_0xbad322['shift']());}};_0x2101cb(++_0x3e6b0b);}(_0xd0f1,0x111));var _0x1d0f=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0xd0f1[_0x429948];return _0x35d5d1;};'use strict';var _=require('lodash');var EventEmitter=require(_0x1d0f('0x0'))['EventEmitter'];var Redis=require(_0x1d0f('0x1'));var AGIError=require(_0x1d0f('0x2'));var config=require(_0x1d0f('0x3'));config[_0x1d0f('0x4')]=_[_0x1d0f('0x5')](config[_0x1d0f('0x4')],{'host':_0x1d0f('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x1d0f('0x7')](_0x1d0f('0x8'),function(_0x2d8711){if(_0x2d8711)return eventEmitter[_0x1d0f('0x9')](_0x1d0f('0xa'),new AGIError(_0x1d0f('0xb'),_0x2d8711));});sub['on'](_0x1d0f('0xc'),function(_0x485fc1,_0x4ea049){if(_0x485fc1!=='agi')return;try{var _0x8bbf7d=JSON[_0x1d0f('0xd')](_0x4ea049);eventEmitter[_0x1d0f('0x9')]('projectUpdate',_0x8bbf7d);}catch(_0x50baba){eventEmitter[_0x1d0f('0x9')](_0x1d0f('0xa'),new AGIError(_0x1d0f('0xb'),_0x50baba));}});module[_0x1d0f('0xe')]={'EventEmitter':eventEmitter};