b315ee126de6738316fbabbc5b6e16c814202abd
[motion2.git] / server / api / chatApplication / chatApplication.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 _0x802a=['client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4fb1b2,_0xdbc8b3){var _0x515559=function(_0x4d39a1){while(--_0x4d39a1){_0x4fb1b2['push'](_0x4fb1b2['shift']());}};_0x515559(++_0xdbc8b3);}(_0x802a,0x93));var _0xa802=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x802a[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xa802('0x0'));var util=require('util');var moment=require(_0xa802('0x1'));var BPromise=require(_0xa802('0x2'));var rs=require(_0xa802('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa802('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa802('0x5')][_0xa802('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53ff52,_0x2a2d8c,_0x3c8e4d){return new BPromise(function(_0x3a7c7f,_0x39e6e3){return client[_0xa802('0x7')](_0x53ff52,_0x3c8e4d)[_0xa802('0x8')](function(_0x560ffe){logger[_0xa802('0x9')]('ChatApplication,\x20%s,\x20%s',_0x2a2d8c,_0xa802('0xa'));logger[_0xa802('0xb')](_0xa802('0xc'),_0x2a2d8c,_0xa802('0xa'),JSON[_0xa802('0xd')](_0x560ffe));if(_0x560ffe[_0xa802('0xe')]){if(_0x560ffe[_0xa802('0xe')][_0xa802('0xf')]===0x1f4){logger[_0xa802('0xe')](_0xa802('0x10'),_0x2a2d8c,_0x560ffe[_0xa802('0xe')][_0xa802('0x11')]);return _0x39e6e3(_0x560ffe[_0xa802('0xe')][_0xa802('0x11')]);}logger[_0xa802('0xe')](_0xa802('0x10'),_0x2a2d8c,_0x560ffe[_0xa802('0xe')][_0xa802('0x11')]);return _0x3a7c7f(_0x560ffe['error'][_0xa802('0x11')]);}else{logger[_0xa802('0x9')](_0xa802('0x10'),_0x2a2d8c,_0xa802('0xa'));_0x3a7c7f(_0x560ffe[_0xa802('0x12')][_0xa802('0x11')]);}})['catch'](function(_0x1ca363){logger['error'](_0xa802('0x10'),_0x2a2d8c,_0x1ca363);_0x39e6e3(_0x1ca363);});});}