Built motion from commit 06eb8eb0.|2.6.31
[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 _0x3f4e=['defaults','localhost','agi','emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x2ddf36,_0x4b8395){var _0x2b6953=function(_0x3c3566){while(--_0x3c3566){_0x2ddf36['push'](_0x2ddf36['shift']());}};_0x2b6953(++_0x4b8395);}(_0x3f4e,0x70));var _0xe3f4=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x3f4e[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0xe3f4('0x0'));var EventEmitter=require(_0xe3f4('0x1'))[_0xe3f4('0x2')];var Redis=require(_0xe3f4('0x3'));var AGIError=require(_0xe3f4('0x4'));var config=require(_0xe3f4('0x5'));config[_0xe3f4('0x6')]=_[_0xe3f4('0x7')](config[_0xe3f4('0x6')],{'host':_0xe3f4('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe3f4('0x6')]);sub['subscribe'](_0xe3f4('0x9'),function(_0x171a3c){if(_0x171a3c)return eventEmitter[_0xe3f4('0xa')]('error',new AGIError(_0xe3f4('0xb'),_0x171a3c));});sub['on'](_0xe3f4('0xc'),function(_0x95b893,_0xcc9a63){if(_0x95b893!==_0xe3f4('0x9'))return;try{var _0x3a7f3f=JSON[_0xe3f4('0xd')](_0xcc9a63);eventEmitter[_0xe3f4('0xa')](_0xe3f4('0xe'),_0x3a7f3f);}catch(_0xa5a26e){eventEmitter['emit'](_0xe3f4('0xf'),new AGIError(_0xe3f4('0xb'),_0xa5a26e));}});module[_0xe3f4('0x10')]={'EventEmitter':eventEmitter};