Built motion from commit 9d0783e6.|2.6.13
[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 _0x8a2a=['ioredis','./error','../../config/environment','redis','defaults','localhost','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','EventEmitter'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8a2a,0x1ea));var _0xa8a2=function(_0x31a938,_0x4daec6){_0x31a938=_0x31a938-0x0;var _0x1bf341=_0x8a2a[_0x31a938];return _0x1bf341;};'use strict';var _=require(_0xa8a2('0x0'));var EventEmitter=require(_0xa8a2('0x1'))[_0xa8a2('0x2')];var Redis=require(_0xa8a2('0x3'));var AGIError=require(_0xa8a2('0x4'));var config=require(_0xa8a2('0x5'));config[_0xa8a2('0x6')]=_[_0xa8a2('0x7')](config[_0xa8a2('0x6')],{'host':_0xa8a2('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa8a2('0x6')]);sub['subscribe'](_0xa8a2('0x9'),function(_0x4971fd){if(_0x4971fd)return eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xb'),new AGIError(_0xa8a2('0xc'),_0x4971fd));});sub['on'](_0xa8a2('0xd'),function(_0x192815,_0x1c1be3){if(_0x192815!=='agi')return;try{var _0x1af045=JSON[_0xa8a2('0xe')](_0x1c1be3);eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xf'),_0x1af045);}catch(_0x1897be){eventEmitter[_0xa8a2('0xa')](_0xa8a2('0xb'),new AGIError(_0xa8a2('0xc'),_0x1897be));}});module[_0xa8a2('0x10')]={'EventEmitter':eventEmitter};