Built motion from commit cb845558.|2.6.34
[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 _0x94ca=['code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x39c138,_0x244b52){var _0x5e737a=function(_0x3ff4a8){while(--_0x3ff4a8){_0x39c138['push'](_0x39c138['shift']());}};_0x5e737a(++_0x244b52);}(_0x94ca,0x8e));var _0xa94c=function(_0x6d989d,_0x416427){_0x6d989d=_0x6d989d-0x0;var _0x5c5535=_0x94ca[_0x6d989d];return _0x5c5535;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa94c('0x0'));var rs=require(_0xa94c('0x1'));var fs=require('fs');var Redis=require(_0xa94c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa94c('0x3'));var logger=require(_0xa94c('0x4'))(_0xa94c('0x5'));var config=require(_0xa94c('0x6'));var jayson=require(_0xa94c('0x7'));var client=jayson['client'][_0xa94c('0x8')]({'port':0x232a});config[_0xa94c('0x9')]=_[_0xa94c('0xa')](config[_0xa94c('0x9')],{'host':_0xa94c('0xb'),'port':0x18eb});var socket=require(_0xa94c('0xc'))(new Redis(config[_0xa94c('0x9')]));require('./chatWebsite.socket')[_0xa94c('0xd')](socket);function respondWithRpcPromise(_0x5f3199,_0x2a0d6c,_0x51c065){return new BPromise(function(_0x50cd48,_0x46aefe){return client['request'](_0x5f3199,_0x51c065)['then'](function(_0x267171){logger[_0xa94c('0xe')](_0xa94c('0xf'),_0x2a0d6c,_0xa94c('0x10'));logger[_0xa94c('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2a0d6c,_0xa94c('0x10'),JSON['stringify'](_0x267171));if(_0x267171[_0xa94c('0x12')]){if(_0x267171[_0xa94c('0x12')][_0xa94c('0x13')]===0x1f4){logger[_0xa94c('0x12')](_0xa94c('0xf'),_0x2a0d6c,_0x267171['error'][_0xa94c('0x14')]);return _0x46aefe(_0x267171['error'][_0xa94c('0x14')]);}logger[_0xa94c('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2a0d6c,_0x267171[_0xa94c('0x12')][_0xa94c('0x14')]);return _0x50cd48(_0x267171[_0xa94c('0x12')]['message']);}else{logger[_0xa94c('0xe')](_0xa94c('0xf'),_0x2a0d6c,'request\x20sent');_0x50cd48(_0x267171[_0xa94c('0x15')]['message']);}})[_0xa94c('0x16')](function(_0x419ea7){logger['error'](_0xa94c('0xf'),_0x2a0d6c,_0x419ea7);_0x46aefe(_0x419ea7);});});}