Built motion from commit 3c2ce842.|2.6.31
[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 _0x12cc=['redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x12cc,0x1ed));var _0xc12c=function(_0x583e92,_0x18cf7b){_0x583e92=_0x583e92-0x0;var _0x3ec500=_0x12cc[_0x583e92];return _0x3ec500;};'use strict';var _=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var moment=require(_0xc12c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc12c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc12c('0x4'))['db'];var utils=require(_0xc12c('0x5'));var logger=require(_0xc12c('0x6'))(_0xc12c('0x7'));var config=require(_0xc12c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc12c('0x9')][_0xc12c('0xa')]({'port':0x232a});config[_0xc12c('0xb')]=_[_0xc12c('0xc')](config[_0xc12c('0xb')],{'host':_0xc12c('0xd'),'port':0x18eb});var socket=require(_0xc12c('0xe'))(new Redis(config[_0xc12c('0xb')]));require(_0xc12c('0xf'))[_0xc12c('0x10')](socket);function respondWithRpcPromise(_0xda3f92,_0x3995fc,_0x2ce1c7){return new BPromise(function(_0x5c4d65,_0x1cc600){return client[_0xc12c('0x11')](_0xda3f92,_0x2ce1c7)[_0xc12c('0x12')](function(_0x316645){logger[_0xc12c('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0xc12c('0x14'));logger['debug'](_0xc12c('0x15'),_0x3995fc,_0xc12c('0x14'),JSON['stringify'](_0x316645));if(_0x316645[_0xc12c('0x16')]){if(_0x316645[_0xc12c('0x16')][_0xc12c('0x17')]===0x1f4){logger[_0xc12c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);return _0x1cc600(_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);}logger['error'](_0xc12c('0x19'),_0x3995fc,_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);return _0x5c4d65(_0x316645[_0xc12c('0x16')][_0xc12c('0x18')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3995fc,_0xc12c('0x14'));_0x5c4d65(_0x316645[_0xc12c('0x1a')][_0xc12c('0x18')]);}})[_0xc12c('0x1b')](function(_0x4783cb){logger['error'](_0xc12c('0x19'),_0x3995fc,_0x4783cb);_0x1cc600(_0x4783cb);});});}