da75e5708ced5be576826eea0cd92215dd152ec7
[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 _0xb9d5=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xb9d5,0x17a));var _0x5b9d=function(_0x2c5007,_0x334d11){_0x2c5007=_0x2c5007-0x0;var _0x55f26b=_0xb9d5[_0x2c5007];return _0x55f26b;};'use strict';var _=require(_0x5b9d('0x0'));var util=require('util');var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rs=require(_0x5b9d('0x3'));var fs=require('fs');var Redis=require(_0x5b9d('0x4'));var db=require(_0x5b9d('0x5'))['db'];var utils=require(_0x5b9d('0x6'));var logger=require(_0x5b9d('0x7'))(_0x5b9d('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b9d('0x9'));var client=jayson[_0x5b9d('0xa')][_0x5b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8375,_0x383de2,_0x2c5c6a){return new BPromise(function(_0x100a21,_0x78a052){return client[_0x5b9d('0xc')](_0x5c8375,_0x2c5c6a)[_0x5b9d('0xd')](function(_0x4ee194){logger[_0x5b9d('0xe')](_0x5b9d('0xf'),_0x383de2,_0x5b9d('0x10'));logger['debug'](_0x5b9d('0x11'),_0x383de2,'request\x20sent',JSON['stringify'](_0x4ee194));if(_0x4ee194['error']){if(_0x4ee194[_0x5b9d('0x12')][_0x5b9d('0x13')]===0x1f4){logger[_0x5b9d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x383de2,_0x4ee194['error'][_0x5b9d('0x14')]);return _0x78a052(_0x4ee194[_0x5b9d('0x12')][_0x5b9d('0x14')]);}logger[_0x5b9d('0x12')]('ChatApplication,\x20%s,\x20%s',_0x383de2,_0x4ee194[_0x5b9d('0x12')][_0x5b9d('0x14')]);return _0x100a21(_0x4ee194[_0x5b9d('0x12')][_0x5b9d('0x14')]);}else{logger[_0x5b9d('0xe')](_0x5b9d('0xf'),_0x383de2,'request\x20sent');_0x100a21(_0x4ee194[_0x5b9d('0x15')][_0x5b9d('0x14')]);}})[_0x5b9d('0x16')](function(_0x46049f){logger['error'](_0x5b9d('0xf'),_0x383de2,_0x46049f);_0x78a052(_0x46049f);});});}