55cb8387e629130adf6c1be7daeb291aa236d3c6
[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 _0xc543=['info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then'];(function(_0x579a2f,_0x2a815a){var _0x5c9e93=function(_0x3e6fc9){while(--_0x3e6fc9){_0x579a2f['push'](_0x579a2f['shift']());}};_0x5c9e93(++_0x2a815a);}(_0xc543,0x15a));var _0x3c54=function(_0x52564b,_0x24c4eb){_0x52564b=_0x52564b-0x0;var _0x31042d=_0xc543[_0x52564b];return _0x31042d;};'use strict';var _=require(_0x3c54('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c54('0x1'));var rs=require(_0x3c54('0x2'));var fs=require('fs');var Redis=require(_0x3c54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c54('0x4'));var logger=require(_0x3c54('0x5'))('rpc');var config=require(_0x3c54('0x6'));var jayson=require(_0x3c54('0x7'));var client=jayson[_0x3c54('0x8')]['http']({'port':0x232a});config[_0x3c54('0x9')]=_[_0x3c54('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3c54('0xb'))(new Redis(config[_0x3c54('0x9')]));require('./chatWebsite.socket')[_0x3c54('0xc')](socket);function respondWithRpcPromise(_0x56acfe,_0x1dcb5f,_0xa2d51b){return new BPromise(function(_0x22651a,_0x51790f){return client['request'](_0x56acfe,_0xa2d51b)[_0x3c54('0xd')](function(_0x2426a1){logger[_0x3c54('0xe')](_0x3c54('0xf'),_0x1dcb5f,'request\x20sent');logger[_0x3c54('0x10')](_0x3c54('0x11'),_0x1dcb5f,_0x3c54('0x12'),JSON['stringify'](_0x2426a1));if(_0x2426a1['error']){if(_0x2426a1['error'][_0x3c54('0x13')]===0x1f4){logger[_0x3c54('0x14')](_0x3c54('0xf'),_0x1dcb5f,_0x2426a1[_0x3c54('0x14')][_0x3c54('0x15')]);return _0x51790f(_0x2426a1[_0x3c54('0x14')]['message']);}logger[_0x3c54('0x14')](_0x3c54('0xf'),_0x1dcb5f,_0x2426a1['error'][_0x3c54('0x15')]);return _0x22651a(_0x2426a1[_0x3c54('0x14')][_0x3c54('0x15')]);}else{logger[_0x3c54('0xe')](_0x3c54('0xf'),_0x1dcb5f,_0x3c54('0x12'));_0x22651a(_0x2426a1[_0x3c54('0x16')][_0x3c54('0x15')]);}})[_0x3c54('0x17')](function(_0x15895e){logger[_0x3c54('0x14')](_0x3c54('0xf'),_0x1dcb5f,_0x15895e);_0x51790f(_0x15895e);});});}