Built motion from commit da617fac.|2.6.6
[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 _0x3b0a=['ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3b0a,0x1c2));var _0xa3b0=function(_0x1fedd9,_0x5352b2){_0x1fedd9=_0x1fedd9-0x0;var _0x426583=_0x3b0a[_0x1fedd9];return _0x426583;};'use strict';var _=require(_0xa3b0('0x0'));var util=require('util');var moment=require(_0xa3b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xa3b0('0x2'));var fs=require('fs');var Redis=require(_0xa3b0('0x3'));var db=require(_0xa3b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3b0('0x5'))('rpc');var config=require(_0xa3b0('0x6'));var jayson=require(_0xa3b0('0x7'));var client=jayson[_0xa3b0('0x8')][_0xa3b0('0x9')]({'port':0x232a});config[_0xa3b0('0xa')]=_[_0xa3b0('0xb')](config[_0xa3b0('0xa')],{'host':_0xa3b0('0xc'),'port':0x18eb});var socket=require(_0xa3b0('0xd'))(new Redis(config[_0xa3b0('0xa')]));require('./chatWebsite.socket')[_0xa3b0('0xe')](socket);function respondWithRpcPromise(_0x15273f,_0x15d32b,_0xfde187){return new BPromise(function(_0x42e0b4,_0x517fef){return client[_0xa3b0('0xf')](_0x15273f,_0xfde187)[_0xa3b0('0x10')](function(_0x38efc2){logger[_0xa3b0('0x11')](_0xa3b0('0x12'),_0x15d32b,'request\x20sent');logger['debug'](_0xa3b0('0x13'),_0x15d32b,_0xa3b0('0x14'),JSON[_0xa3b0('0x15')](_0x38efc2));if(_0x38efc2[_0xa3b0('0x16')]){if(_0x38efc2[_0xa3b0('0x16')]['code']===0x1f4){logger[_0xa3b0('0x16')](_0xa3b0('0x12'),_0x15d32b,_0x38efc2[_0xa3b0('0x16')][_0xa3b0('0x17')]);return _0x517fef(_0x38efc2[_0xa3b0('0x16')][_0xa3b0('0x17')]);}logger[_0xa3b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x15d32b,_0x38efc2[_0xa3b0('0x16')][_0xa3b0('0x17')]);return _0x42e0b4(_0x38efc2['error']['message']);}else{logger[_0xa3b0('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x15d32b,_0xa3b0('0x14'));_0x42e0b4(_0x38efc2[_0xa3b0('0x18')]['message']);}})[_0xa3b0('0x19')](function(_0x4001ad){logger[_0xa3b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x15d32b,_0x4001ad);_0x517fef(_0x4001ad);});});}