b218e42340d1c3be96e6b386602a57fdee193d01
[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 _0xf61e=['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','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x1c8522,_0x47fb95){var _0x58ddf9=function(_0x26cc4f){while(--_0x26cc4f){_0x1c8522['push'](_0x1c8522['shift']());}};_0x58ddf9(++_0x47fb95);}(_0xf61e,0x191));var _0xef61=function(_0x641f89,_0x29b591){_0x641f89=_0x641f89-0x0;var _0x15459e=_0xf61e[_0x641f89];return _0x15459e;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});config[_0xef61('0xd')]=_['defaults'](config[_0xef61('0xd')],{'host':_0xef61('0xe'),'port':0x18eb});var socket=require(_0xef61('0xf'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xef61('0x10')](socket);function respondWithRpcPromise(_0x2e28c7,_0x1ab79d,_0x11181b){return new BPromise(function(_0x2af74c,_0xdcd707){return client[_0xef61('0x11')](_0x2e28c7,_0x11181b)[_0xef61('0x12')](function(_0x237f43){logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));logger[_0xef61('0x16')](_0xef61('0x17'),_0x1ab79d,'request\x20sent',JSON[_0xef61('0x18')](_0x237f43));if(_0x237f43['error']){if(_0x237f43[_0xef61('0x19')][_0xef61('0x1a')]===0x1f4){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x237f43['error'][_0xef61('0x1b')]);return _0xdcd707(_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);}logger[_0xef61('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1ab79d,_0x237f43[_0xef61('0x19')][_0xef61('0x1b')]);return _0x2af74c(_0x237f43['error'][_0xef61('0x1b')]);}else{logger[_0xef61('0x13')](_0xef61('0x14'),_0x1ab79d,_0xef61('0x15'));_0x2af74c(_0x237f43[_0xef61('0x1c')][_0xef61('0x1b')]);}})[_0xef61('0x1d')](function(_0x55f887){logger[_0xef61('0x19')](_0xef61('0x14'),_0x1ab79d,_0x55f887);_0xdcd707(_0x55f887);});});}