Built motion from commit bab6f49e.|2.6.17
[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 _0x10bb=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4d71b9,_0x8960b2){var _0x279326=function(_0x3b94d9){while(--_0x3b94d9){_0x4d71b9['push'](_0x4d71b9['shift']());}};_0x279326(++_0x8960b2);}(_0x10bb,0x12d));var _0xb10b=function(_0x2c05bd,_0x7244a){_0x2c05bd=_0x2c05bd-0x0;var _0x1ac6c4=_0x10bb[_0x2c05bd];return _0x1ac6c4;};'use strict';var _=require(_0xb10b('0x0'));var util=require(_0xb10b('0x1'));var moment=require('moment');var BPromise=require(_0xb10b('0x2'));var rs=require(_0xb10b('0x3'));var fs=require('fs');var Redis=require(_0xb10b('0x4'));var db=require(_0xb10b('0x5'))['db'];var utils=require(_0xb10b('0x6'));var logger=require('../../config/logger')(_0xb10b('0x7'));var config=require(_0xb10b('0x8'));var jayson=require(_0xb10b('0x9'));var client=jayson[_0xb10b('0xa')][_0xb10b('0xb')]({'port':0x232a});config[_0xb10b('0xc')]=_[_0xb10b('0xd')](config['redis'],{'host':_0xb10b('0xe'),'port':0x18eb});var socket=require(_0xb10b('0xf'))(new Redis(config[_0xb10b('0xc')]));require(_0xb10b('0x10'))[_0xb10b('0x11')](socket);function respondWithRpcPromise(_0x1fbcc6,_0x45e120,_0x270408){return new BPromise(function(_0x4195c2,_0x29cb9a){return client['request'](_0x1fbcc6,_0x270408)['then'](function(_0x527bb8){logger[_0xb10b('0x12')](_0xb10b('0x13'),_0x45e120,_0xb10b('0x14'));logger[_0xb10b('0x15')](_0xb10b('0x16'),_0x45e120,'request\x20sent',JSON[_0xb10b('0x17')](_0x527bb8));if(_0x527bb8[_0xb10b('0x18')]){if(_0x527bb8['error'][_0xb10b('0x19')]===0x1f4){logger['error'](_0xb10b('0x13'),_0x45e120,_0x527bb8[_0xb10b('0x18')]['message']);return _0x29cb9a(_0x527bb8['error'][_0xb10b('0x1a')]);}logger['error'](_0xb10b('0x13'),_0x45e120,_0x527bb8[_0xb10b('0x18')][_0xb10b('0x1a')]);return _0x4195c2(_0x527bb8[_0xb10b('0x18')][_0xb10b('0x1a')]);}else{logger[_0xb10b('0x12')](_0xb10b('0x13'),_0x45e120,_0xb10b('0x14'));_0x4195c2(_0x527bb8[_0xb10b('0x1b')][_0xb10b('0x1a')]);}})['catch'](function(_0x489f2e){logger[_0xb10b('0x18')](_0xb10b('0x13'),_0x45e120,_0x489f2e);_0x29cb9a(_0x489f2e);});});}