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 _0xd9ec=['localhost','error','agi','parse','emit','projectUpdate','exports','lodash','events','EventEmitter','./error','../../config/environment','redis','defaults'];(function(_0x539c06,_0x4dc4b7){var _0x48cf2b=function(_0x946b67){while(--_0x946b67){_0x539c06['push'](_0x539c06['shift']());}};_0x48cf2b(++_0x4dc4b7);}(_0xd9ec,0x93));var _0xcd9e=function(_0x39d03d,_0xb18aee){_0x39d03d=_0x39d03d-0x0;var _0x2630ef=_0xd9ec[_0x39d03d];return _0x2630ef;};'use strict';var _=require(_0xcd9e('0x0'));var EventEmitter=require(_0xcd9e('0x1'))[_0xcd9e('0x2')];var Redis=require('ioredis');var AGIError=require(_0xcd9e('0x3'));var config=require(_0xcd9e('0x4'));config[_0xcd9e('0x5')]=_[_0xcd9e('0x6')](config[_0xcd9e('0x5')],{'host':_0xcd9e('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x177eb4){if(_0x177eb4)return eventEmitter['emit'](_0xcd9e('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x177eb4));});sub['on']('message',function(_0x8e0bff,_0x1fa7fd){if(_0x8e0bff!==_0xcd9e('0x9'))return;try{var _0x31faee=JSON[_0xcd9e('0xa')](_0x1fa7fd);eventEmitter[_0xcd9e('0xb')](_0xcd9e('0xc'),_0x31faee);}catch(_0x303415){eventEmitter['emit'](_0xcd9e('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x303415));}});module[_0xcd9e('0xd')]={'EventEmitter':eventEmitter};