Built motion from commit efa66e19.|2.6.22
[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 _0x13eb=['EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','exports','lodash','events'];(function(_0x3a3464,_0x1322bf){var _0x623436=function(_0x159bed){while(--_0x159bed){_0x3a3464['push'](_0x3a3464['shift']());}};_0x623436(++_0x1322bf);}(_0x13eb,0xca));var _0xb13e=function(_0x5a43b8,_0x2e0eb2){_0x5a43b8=_0x5a43b8-0x0;var _0x26eeef=_0x13eb[_0x5a43b8];return _0x26eeef;};'use strict';var _=require(_0xb13e('0x0'));var EventEmitter=require(_0xb13e('0x1'))[_0xb13e('0x2')];var Redis=require(_0xb13e('0x3'));var AGIError=require(_0xb13e('0x4'));var config=require(_0xb13e('0x5'));config[_0xb13e('0x6')]=_[_0xb13e('0x7')](config[_0xb13e('0x6')],{'host':_0xb13e('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb13e('0x6')]);sub[_0xb13e('0x9')](_0xb13e('0xa'),function(_0xa1f7b6){if(_0xa1f7b6)return eventEmitter[_0xb13e('0xb')](_0xb13e('0xc'),new AGIError(_0xb13e('0xd'),_0xa1f7b6));});sub['on'](_0xb13e('0xe'),function(_0x2266cb,_0x368705){if(_0x2266cb!==_0xb13e('0xa'))return;try{var _0x92c96e=JSON['parse'](_0x368705);eventEmitter['emit'](_0xb13e('0xf'),_0x92c96e);}catch(_0x2d1309){eventEmitter[_0xb13e('0xb')]('error',new AGIError(_0xb13e('0xd'),_0x2d1309));}});module[_0xb13e('0x10')]={'EventEmitter':eventEmitter};