ebe3b5e8966865d59213807e47de109c65530c41
[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 _0x6663=['../../config/environment','jayson/promise','client','redis','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x324f33,_0x339c81){var _0x3f614c=function(_0x23ba1a){while(--_0x23ba1a){_0x324f33['push'](_0x324f33['shift']());}};_0x3f614c(++_0x339c81);}(_0x6663,0x118));var _0x3666=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x6663[_0x13ff53];return _0x290228;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3666('0x0'));var BPromise=require('bluebird');var rs=require(_0x3666('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3666('0x2'))['db'];var utils=require(_0x3666('0x3'));var logger=require(_0x3666('0x4'))(_0x3666('0x5'));var config=require(_0x3666('0x6'));var jayson=require(_0x3666('0x7'));var client=jayson[_0x3666('0x8')]['http']({'port':0x232a});config[_0x3666('0x9')]=_['defaults'](config[_0x3666('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3666('0xa'))(new Redis(config[_0x3666('0x9')]));require(_0x3666('0xb'))['register'](socket);function respondWithRpcPromise(_0x40b4e1,_0x471b71,_0xe65586){return new BPromise(function(_0x1b6cfb,_0x1f421d){return client['request'](_0x40b4e1,_0xe65586)[_0x3666('0xc')](function(_0xf060fd){logger[_0x3666('0xd')](_0x3666('0xe'),_0x471b71,_0x3666('0xf'));logger[_0x3666('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x471b71,_0x3666('0xf'),JSON[_0x3666('0x11')](_0xf060fd));if(_0xf060fd[_0x3666('0x12')]){if(_0xf060fd[_0x3666('0x12')][_0x3666('0x13')]===0x1f4){logger[_0x3666('0x12')](_0x3666('0xe'),_0x471b71,_0xf060fd[_0x3666('0x12')][_0x3666('0x14')]);return _0x1f421d(_0xf060fd[_0x3666('0x12')][_0x3666('0x14')]);}logger[_0x3666('0x12')](_0x3666('0xe'),_0x471b71,_0xf060fd['error'][_0x3666('0x14')]);return _0x1b6cfb(_0xf060fd[_0x3666('0x12')][_0x3666('0x14')]);}else{logger[_0x3666('0xd')](_0x3666('0xe'),_0x471b71,_0x3666('0xf'));_0x1b6cfb(_0xf060fd[_0x3666('0x15')][_0x3666('0x14')]);}})['catch'](function(_0x3969da){logger['error'](_0x3666('0xe'),_0x471b71,_0x3969da);_0x1f421d(_0x3969da);});});}