Built motion from commit ffdca78c.|2.6.24
[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 _0x6b7a=['catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b7a,0xb1));var _0xa6b7=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6b7a[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa6b7('0x0'));var fs=require('fs');var Redis=require(_0xa6b7('0x1'));var db=require(_0xa6b7('0x2'))['db'];var utils=require(_0xa6b7('0x3'));var logger=require(_0xa6b7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6b7('0x5')]['http']({'port':0x232a});config[_0xa6b7('0x6')]=_[_0xa6b7('0x7')](config[_0xa6b7('0x6')],{'host':_0xa6b7('0x8'),'port':0x18eb});var socket=require(_0xa6b7('0x9'))(new Redis(config['redis']));require(_0xa6b7('0xa'))[_0xa6b7('0xb')](socket);function respondWithRpcPromise(_0x17c5c2,_0x47141f,_0x454330){return new BPromise(function(_0x134f43,_0x4e8117){return client[_0xa6b7('0xc')](_0x17c5c2,_0x454330)['then'](function(_0x4f6872){logger[_0xa6b7('0xd')](_0xa6b7('0xe'),_0x47141f,_0xa6b7('0xf'));logger[_0xa6b7('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x47141f,_0xa6b7('0xf'),JSON['stringify'](_0x4f6872));if(_0x4f6872['error']){if(_0x4f6872['error'][_0xa6b7('0x11')]===0x1f4){logger['error'](_0xa6b7('0xe'),_0x47141f,_0x4f6872[_0xa6b7('0x12')][_0xa6b7('0x13')]);return _0x4e8117(_0x4f6872[_0xa6b7('0x12')]['message']);}logger[_0xa6b7('0x12')](_0xa6b7('0xe'),_0x47141f,_0x4f6872[_0xa6b7('0x12')][_0xa6b7('0x13')]);return _0x134f43(_0x4f6872[_0xa6b7('0x12')][_0xa6b7('0x13')]);}else{logger[_0xa6b7('0xd')](_0xa6b7('0xe'),_0x47141f,_0xa6b7('0xf'));_0x134f43(_0x4f6872[_0xa6b7('0x14')][_0xa6b7('0x13')]);}})[_0xa6b7('0x15')](function(_0x24ebd7){logger[_0xa6b7('0x12')](_0xa6b7('0xe'),_0x47141f,_0x24ebd7);_0x4e8117(_0x24ebd7);});});}