02505996bf13e839b72a46a80b317ec0f72a0ae0
[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 _0xcd6c=['code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0xcd6c,0xf6));var _0xccd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xccd6('0x0'));var util=require(_0xccd6('0x1'));var moment=require(_0xccd6('0x2'));var BPromise=require(_0xccd6('0x3'));var rs=require(_0xccd6('0x4'));var fs=require('fs');var Redis=require(_0xccd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xccd6('0x6'));var logger=require(_0xccd6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xccd6('0x8'));var client=jayson[_0xccd6('0x9')][_0xccd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x339ae4,_0x2703c0,_0x226fa9){return new BPromise(function(_0x214893,_0x4a7604){return client['request'](_0x339ae4,_0x226fa9)[_0xccd6('0xb')](function(_0xbf88b9){logger[_0xccd6('0xc')]('ChatApplication,\x20%s,\x20%s',_0x2703c0,_0xccd6('0xd'));logger[_0xccd6('0xe')](_0xccd6('0xf'),_0x2703c0,_0xccd6('0xd'),JSON[_0xccd6('0x10')](_0xbf88b9));if(_0xbf88b9[_0xccd6('0x11')]){if(_0xbf88b9[_0xccd6('0x11')][_0xccd6('0x12')]===0x1f4){logger[_0xccd6('0x11')](_0xccd6('0x13'),_0x2703c0,_0xbf88b9['error'][_0xccd6('0x14')]);return _0x4a7604(_0xbf88b9[_0xccd6('0x11')][_0xccd6('0x14')]);}logger[_0xccd6('0x11')](_0xccd6('0x13'),_0x2703c0,_0xbf88b9[_0xccd6('0x11')][_0xccd6('0x14')]);return _0x214893(_0xbf88b9[_0xccd6('0x11')][_0xccd6('0x14')]);}else{logger[_0xccd6('0xc')](_0xccd6('0x13'),_0x2703c0,_0xccd6('0xd'));_0x214893(_0xbf88b9[_0xccd6('0x15')][_0xccd6('0x14')]);}})['catch'](function(_0x72cdc0){logger['error'](_0xccd6('0x13'),_0x2703c0,_0x72cdc0);_0x4a7604(_0x72cdc0);});});}