Built motion from commit e8d9bd62.|2.6.25
[motion2.git] / server / services / agi / events.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 _0xd998=['E_AGI_SERVER_ERROR','message','parse','emit','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','error'];(function(_0x4a5e99,_0x5bc6ff){var _0x49a0eb=function(_0x2bf404){while(--_0x2bf404){_0x4a5e99['push'](_0x4a5e99['shift']());}};_0x49a0eb(++_0x5bc6ff);}(_0xd998,0xb8));var _0x8d99=function(_0x12bdb5,_0x210deb){_0x12bdb5=_0x12bdb5-0x0;var _0x2b9c88=_0xd998[_0x12bdb5];return _0x2b9c88;};'use strict';var _=require(_0x8d99('0x0'));var EventEmitter=require(_0x8d99('0x1'))[_0x8d99('0x2')];var Redis=require(_0x8d99('0x3'));var AGIError=require(_0x8d99('0x4'));var config=require(_0x8d99('0x5'));config[_0x8d99('0x6')]=_[_0x8d99('0x7')](config[_0x8d99('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x8d99('0x8')](_0x8d99('0x9'),function(_0x1ac153){if(_0x1ac153)return eventEmitter['emit'](_0x8d99('0xa'),new AGIError(_0x8d99('0xb'),_0x1ac153));});sub['on'](_0x8d99('0xc'),function(_0x267cea,_0x5b9765){if(_0x267cea!==_0x8d99('0x9'))return;try{var _0x3b57fe=JSON[_0x8d99('0xd')](_0x5b9765);eventEmitter[_0x8d99('0xe')]('projectUpdate',_0x3b57fe);}catch(_0x18a5de){eventEmitter['emit'](_0x8d99('0xa'),new AGIError(_0x8d99('0xb'),_0x18a5de));}});module['exports']={'EventEmitter':eventEmitter};