556d39195706bf03395a24316fe916f44b6b295d
[motion2.git] / server / api / chatWebsite / chatWebsite.rpc.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 _0x67c1=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x67c1,0x126));var _0x167c=function(_0x45b07f,_0x56a2e9){_0x45b07f=_0x45b07f-0x0;var _0x160a5c=_0x67c1[_0x45b07f];return _0x160a5c;};'use strict';var _=require(_0x167c('0x0'));var util=require(_0x167c('0x1'));var moment=require(_0x167c('0x2'));var BPromise=require(_0x167c('0x3'));var rs=require(_0x167c('0x4'));var fs=require('fs');var Redis=require(_0x167c('0x5'));var db=require(_0x167c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x167c('0x7'))(_0x167c('0x8'));var config=require(_0x167c('0x9'));var jayson=require(_0x167c('0xa'));var client=jayson[_0x167c('0xb')][_0x167c('0xc')]({'port':0x232a});config[_0x167c('0xd')]=_[_0x167c('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x167c('0xf'))[_0x167c('0x10')](socket);function respondWithRpcPromise(_0x3c3aa8,_0x4facbe,_0xb52cb9){return new BPromise(function(_0x265689,_0x59f0e4){return client[_0x167c('0x11')](_0x3c3aa8,_0xb52cb9)[_0x167c('0x12')](function(_0x4e9291){logger[_0x167c('0x13')](_0x167c('0x14'),_0x4facbe,_0x167c('0x15'));logger[_0x167c('0x16')](_0x167c('0x17'),_0x4facbe,_0x167c('0x15'),JSON[_0x167c('0x18')](_0x4e9291));if(_0x4e9291[_0x167c('0x19')]){if(_0x4e9291[_0x167c('0x19')][_0x167c('0x1a')]===0x1f4){logger[_0x167c('0x19')](_0x167c('0x14'),_0x4facbe,_0x4e9291[_0x167c('0x19')][_0x167c('0x1b')]);return _0x59f0e4(_0x4e9291['error'][_0x167c('0x1b')]);}logger[_0x167c('0x19')](_0x167c('0x14'),_0x4facbe,_0x4e9291['error'][_0x167c('0x1b')]);return _0x265689(_0x4e9291[_0x167c('0x19')][_0x167c('0x1b')]);}else{logger[_0x167c('0x13')](_0x167c('0x14'),_0x4facbe,_0x167c('0x15'));_0x265689(_0x4e9291[_0x167c('0x1c')]['message']);}})[_0x167c('0x1d')](function(_0xdc2209){logger['error'](_0x167c('0x14'),_0x4facbe,_0xdc2209);_0x59f0e4(_0xdc2209);});});}