Built motion from commit 994c64e1.|2.6.1
[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 _0xc7c5=['rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1435b1,_0x5a87e8){var _0x2e83e9=function(_0x3eb69e){while(--_0x3eb69e){_0x1435b1['push'](_0x1435b1['shift']());}};_0x2e83e9(++_0x5a87e8);}(_0xc7c5,0x17f));var _0x5c7c=function(_0x1ddcd0,_0x35557d){_0x1ddcd0=_0x1ddcd0-0x0;var _0x23f108=_0xc7c5[_0x1ddcd0];return _0x23f108;};'use strict';var _=require(_0x5c7c('0x0'));var util=require(_0x5c7c('0x1'));var moment=require('moment');var BPromise=require(_0x5c7c('0x2'));var rs=require(_0x5c7c('0x3'));var fs=require('fs');var Redis=require(_0x5c7c('0x4'));var db=require(_0x5c7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c7c('0x6'))(_0x5c7c('0x7'));var config=require(_0x5c7c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c7c('0x9')]({'port':0x232a});config['redis']=_[_0x5c7c('0xa')](config['redis'],{'host':_0x5c7c('0xb'),'port':0x18eb});var socket=require(_0x5c7c('0xc'))(new Redis(config[_0x5c7c('0xd')]));require(_0x5c7c('0xe'))['register'](socket);function respondWithRpcPromise(_0x8c6042,_0x4df3c3,_0x185075){return new BPromise(function(_0x1ee531,_0x107270){return client['request'](_0x8c6042,_0x185075)[_0x5c7c('0xf')](function(_0x43ad19){logger[_0x5c7c('0x10')](_0x5c7c('0x11'),_0x4df3c3,_0x5c7c('0x12'));logger[_0x5c7c('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4df3c3,_0x5c7c('0x12'),JSON[_0x5c7c('0x14')](_0x43ad19));if(_0x43ad19[_0x5c7c('0x15')]){if(_0x43ad19['error'][_0x5c7c('0x16')]===0x1f4){logger[_0x5c7c('0x15')](_0x5c7c('0x11'),_0x4df3c3,_0x43ad19['error'][_0x5c7c('0x17')]);return _0x107270(_0x43ad19[_0x5c7c('0x15')][_0x5c7c('0x17')]);}logger[_0x5c7c('0x15')](_0x5c7c('0x11'),_0x4df3c3,_0x43ad19[_0x5c7c('0x15')][_0x5c7c('0x17')]);return _0x1ee531(_0x43ad19['error'][_0x5c7c('0x17')]);}else{logger[_0x5c7c('0x10')](_0x5c7c('0x11'),_0x4df3c3,_0x5c7c('0x12'));_0x1ee531(_0x43ad19[_0x5c7c('0x18')][_0x5c7c('0x17')]);}})[_0x5c7c('0x19')](function(_0x479672){logger[_0x5c7c('0x15')](_0x5c7c('0x11'),_0x4df3c3,_0x479672);_0x107270(_0x479672);});});}