Built motion from commit 82bb2304.|2.5.39
[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 _0xbf96=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird'];(function(_0x855caa,_0x5624fa){var _0x25488a=function(_0x4407bd){while(--_0x4407bd){_0x855caa['push'](_0x855caa['shift']());}};_0x25488a(++_0x5624fa);}(_0xbf96,0x1d8));var _0x6bf9=function(_0x4ec1bd,_0x2bd250){_0x4ec1bd=_0x4ec1bd-0x0;var _0x1ef159=_0xbf96[_0x4ec1bd];return _0x1ef159;};'use strict';var _=require('lodash');var util=require(_0x6bf9('0x0'));var moment=require(_0x6bf9('0x1'));var BPromise=require(_0x6bf9('0x2'));var rs=require(_0x6bf9('0x3'));var fs=require('fs');var Redis=require(_0x6bf9('0x4'));var db=require(_0x6bf9('0x5'))['db'];var utils=require(_0x6bf9('0x6'));var logger=require('../../config/logger')(_0x6bf9('0x7'));var config=require(_0x6bf9('0x8'));var jayson=require(_0x6bf9('0x9'));var client=jayson[_0x6bf9('0xa')]['http']({'port':0x232a});config[_0x6bf9('0xb')]=_[_0x6bf9('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6bf9('0xd'))[_0x6bf9('0xe')](socket);function respondWithRpcPromise(_0x40a630,_0x1017d9,_0x11bf0f){return new BPromise(function(_0x4e839a,_0x1468b4){return client[_0x6bf9('0xf')](_0x40a630,_0x11bf0f)[_0x6bf9('0x10')](function(_0x4bd9d2){logger[_0x6bf9('0x11')](_0x6bf9('0x12'),_0x1017d9,_0x6bf9('0x13'));logger['debug'](_0x6bf9('0x14'),_0x1017d9,_0x6bf9('0x13'),JSON['stringify'](_0x4bd9d2));if(_0x4bd9d2[_0x6bf9('0x15')]){if(_0x4bd9d2[_0x6bf9('0x15')][_0x6bf9('0x16')]===0x1f4){logger[_0x6bf9('0x15')](_0x6bf9('0x12'),_0x1017d9,_0x4bd9d2[_0x6bf9('0x15')]['message']);return _0x1468b4(_0x4bd9d2[_0x6bf9('0x15')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1017d9,_0x4bd9d2[_0x6bf9('0x15')]['message']);return _0x4e839a(_0x4bd9d2[_0x6bf9('0x15')][_0x6bf9('0x17')]);}else{logger[_0x6bf9('0x11')](_0x6bf9('0x12'),_0x1017d9,_0x6bf9('0x13'));_0x4e839a(_0x4bd9d2[_0x6bf9('0x18')]['message']);}})['catch'](function(_0x3b345f){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1017d9,_0x3b345f);_0x1468b4(_0x3b345f);});});}