626f65051fe9df12fe14cdc5f58896c3112deb89
[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 _0xf685=['./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis'];(function(_0x361c5c,_0x17a105){var _0x1c9d0b=function(_0x467784){while(--_0x467784){_0x361c5c['push'](_0x361c5c['shift']());}};_0x1c9d0b(++_0x17a105);}(_0xf685,0xd4));var _0x5f68=function(_0x45290f,_0x15583c){_0x45290f=_0x45290f-0x0;var _0x2d2daa=_0xf685[_0x45290f];return _0x2d2daa;};'use strict';var _=require(_0x5f68('0x0'));var EventEmitter=require(_0x5f68('0x1'))[_0x5f68('0x2')];var Redis=require(_0x5f68('0x3'));var AGIError=require(_0x5f68('0x4'));var config=require(_0x5f68('0x5'));config[_0x5f68('0x6')]=_[_0x5f68('0x7')](config[_0x5f68('0x6')],{'host':_0x5f68('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5f68('0x6')]);sub[_0x5f68('0x9')]('agi',function(_0x1488fa){if(_0x1488fa)return eventEmitter[_0x5f68('0xa')](_0x5f68('0xb'),new AGIError(_0x5f68('0xc'),_0x1488fa));});sub['on'](_0x5f68('0xd'),function(_0x48a7fc,_0x321a5f){if(_0x48a7fc!==_0x5f68('0xe'))return;try{var _0x429664=JSON[_0x5f68('0xf')](_0x321a5f);eventEmitter[_0x5f68('0xa')](_0x5f68('0x10'),_0x429664);}catch(_0x238875){eventEmitter[_0x5f68('0xa')](_0x5f68('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x238875));}});module[_0x5f68('0x11')]={'EventEmitter':eventEmitter};