6f9aa8ba043affe9d6ed31c67428b528acdebd56
[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 _0xf804=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatWebsite.socket','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x1b7e6d,_0x274279){var _0x36b251=function(_0x3be7f4){while(--_0x3be7f4){_0x1b7e6d['push'](_0x1b7e6d['shift']());}};_0x36b251(++_0x274279);}(_0xf804,0xe0));var _0x4f80=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf804[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var moment=require(_0x4f80('0x2'));var BPromise=require(_0x4f80('0x3'));var rs=require(_0x4f80('0x4'));var fs=require('fs');var Redis=require(_0x4f80('0x5'));var db=require(_0x4f80('0x6'))['db'];var utils=require(_0x4f80('0x7'));var logger=require(_0x4f80('0x8'))(_0x4f80('0x9'));var config=require(_0x4f80('0xa'));var jayson=require(_0x4f80('0xb'));var client=jayson['client'][_0x4f80('0xc')]({'port':0x232a});config[_0x4f80('0xd')]=_['defaults'](config[_0x4f80('0xd')],{'host':_0x4f80('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4f80('0xf'))['register'](socket);function respondWithRpcPromise(_0x116a7d,_0x1376aa,_0x4eb1f0){return new BPromise(function(_0x3c5561,_0x1a748d){return client[_0x4f80('0x10')](_0x116a7d,_0x4eb1f0)[_0x4f80('0x11')](function(_0x2739ee){logger[_0x4f80('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1376aa,'request\x20sent');logger[_0x4f80('0x13')](_0x4f80('0x14'),_0x1376aa,_0x4f80('0x15'),JSON[_0x4f80('0x16')](_0x2739ee));if(_0x2739ee[_0x4f80('0x17')]){if(_0x2739ee[_0x4f80('0x17')][_0x4f80('0x18')]===0x1f4){logger[_0x4f80('0x17')](_0x4f80('0x19'),_0x1376aa,_0x2739ee[_0x4f80('0x17')][_0x4f80('0x1a')]);return _0x1a748d(_0x2739ee[_0x4f80('0x17')]['message']);}logger[_0x4f80('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1376aa,_0x2739ee['error'][_0x4f80('0x1a')]);return _0x3c5561(_0x2739ee[_0x4f80('0x17')][_0x4f80('0x1a')]);}else{logger[_0x4f80('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1376aa,_0x4f80('0x15'));_0x3c5561(_0x2739ee[_0x4f80('0x1b')][_0x4f80('0x1a')]);}})['catch'](function(_0x157289){logger[_0x4f80('0x17')](_0x4f80('0x19'),_0x1376aa,_0x157289);_0x1a748d(_0x157289);});});}