3be300cbbd9cb6c4054080cd81f4e6d7873a3038
[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 _0xea4c=['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','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request'];(function(_0xb4464f,_0x34b86b){var _0x5a7cb9=function(_0x2fddda){while(--_0x2fddda){_0xb4464f['push'](_0xb4464f['shift']());}};_0x5a7cb9(++_0x34b86b);}(_0xea4c,0xac));var _0xcea4=function(_0x4c105b,_0xd8f530){_0x4c105b=_0x4c105b-0x0;var _0x173e54=_0xea4c[_0x4c105b];return _0x173e54;};'use strict';var _=require(_0xcea4('0x0'));var util=require(_0xcea4('0x1'));var moment=require(_0xcea4('0x2'));var BPromise=require(_0xcea4('0x3'));var rs=require(_0xcea4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcea4('0x5'))['db'];var utils=require(_0xcea4('0x6'));var logger=require(_0xcea4('0x7'))(_0xcea4('0x8'));var config=require(_0xcea4('0x9'));var jayson=require(_0xcea4('0xa'));var client=jayson[_0xcea4('0xb')][_0xcea4('0xc')]({'port':0x232a});config['redis']=_[_0xcea4('0xd')](config['redis'],{'host':_0xcea4('0xe'),'port':0x18eb});var socket=require(_0xcea4('0xf'))(new Redis(config[_0xcea4('0x10')]));require(_0xcea4('0x11'))[_0xcea4('0x12')](socket);function respondWithRpcPromise(_0x5bb414,_0x4c3979,_0x132fd7){return new BPromise(function(_0x133d30,_0x51e3d2){return client[_0xcea4('0x13')](_0x5bb414,_0x132fd7)[_0xcea4('0x14')](function(_0x1ea208){logger[_0xcea4('0x15')](_0xcea4('0x16'),_0x4c3979,_0xcea4('0x17'));logger[_0xcea4('0x18')](_0xcea4('0x19'),_0x4c3979,_0xcea4('0x17'),JSON[_0xcea4('0x1a')](_0x1ea208));if(_0x1ea208[_0xcea4('0x1b')]){if(_0x1ea208[_0xcea4('0x1b')][_0xcea4('0x1c')]===0x1f4){logger[_0xcea4('0x1b')](_0xcea4('0x16'),_0x4c3979,_0x1ea208['error'][_0xcea4('0x1d')]);return _0x51e3d2(_0x1ea208[_0xcea4('0x1b')][_0xcea4('0x1d')]);}logger['error'](_0xcea4('0x16'),_0x4c3979,_0x1ea208[_0xcea4('0x1b')][_0xcea4('0x1d')]);return _0x133d30(_0x1ea208[_0xcea4('0x1b')][_0xcea4('0x1d')]);}else{logger[_0xcea4('0x15')](_0xcea4('0x16'),_0x4c3979,_0xcea4('0x17'));_0x133d30(_0x1ea208[_0xcea4('0x1e')]['message']);}})[_0xcea4('0x1f')](function(_0x5acc39){logger[_0xcea4('0x1b')](_0xcea4('0x16'),_0x4c3979,_0x5acc39);_0x51e3d2(_0x5acc39);});});}