Built motion from commit (unavailable).|2.6.0
[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 _0x57ca=['redis','defaults','localhost','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5afe69,_0x2f5f0b){var _0x316774=function(_0x4a87cc){while(--_0x4a87cc){_0x5afe69['push'](_0x5afe69['shift']());}};_0x316774(++_0x2f5f0b);}(_0x57ca,0x108));var _0xa57c=function(_0x1f2f03,_0x3c6937){_0x1f2f03=_0x1f2f03-0x0;var _0x1ca131=_0x57ca[_0x1f2f03];return _0x1ca131;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./chatWebsite.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}