bdc00dd97cd65d3819313a226be29f95dcbceabb
[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 _0x48f8=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x22bc1a,_0x4dbf68){var _0x31136f=function(_0xe8d6e2){while(--_0xe8d6e2){_0x22bc1a['push'](_0x22bc1a['shift']());}};_0x31136f(++_0x4dbf68);}(_0x48f8,0x1bc));var _0x848f=function(_0x3423b9,_0x492eea){_0x3423b9=_0x3423b9-0x0;var _0x48f7ac=_0x48f8[_0x3423b9];return _0x48f7ac;};'use strict';var _=require(_0x848f('0x0'));var util=require('util');var moment=require(_0x848f('0x1'));var BPromise=require(_0x848f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x848f('0x3'));var db=require(_0x848f('0x4'))['db'];var utils=require(_0x848f('0x5'));var logger=require('../../config/logger')(_0x848f('0x6'));var config=require(_0x848f('0x7'));var jayson=require(_0x848f('0x8'));var client=jayson[_0x848f('0x9')][_0x848f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x570686,_0x2de8f9,_0x39a6ae){return new BPromise(function(_0x207a2d,_0x14891d){return client[_0x848f('0xb')](_0x570686,_0x39a6ae)['then'](function(_0xf6395d){logger['info'](_0x848f('0xc'),_0x2de8f9,_0x848f('0xd'));logger[_0x848f('0xe')](_0x848f('0xf'),_0x2de8f9,_0x848f('0xd'),JSON[_0x848f('0x10')](_0xf6395d));if(_0xf6395d[_0x848f('0x11')]){if(_0xf6395d[_0x848f('0x11')][_0x848f('0x12')]===0x1f4){logger[_0x848f('0x11')](_0x848f('0xc'),_0x2de8f9,_0xf6395d['error'][_0x848f('0x13')]);return _0x14891d(_0xf6395d[_0x848f('0x11')][_0x848f('0x13')]);}logger[_0x848f('0x11')](_0x848f('0xc'),_0x2de8f9,_0xf6395d[_0x848f('0x11')][_0x848f('0x13')]);return _0x207a2d(_0xf6395d[_0x848f('0x11')][_0x848f('0x13')]);}else{logger[_0x848f('0x14')](_0x848f('0xc'),_0x2de8f9,_0x848f('0xd'));_0x207a2d(_0xf6395d[_0x848f('0x15')][_0x848f('0x13')]);}})[_0x848f('0x16')](function(_0x19c620){logger['error'](_0x848f('0xc'),_0x2de8f9,_0x19c620);_0x14891d(_0x19c620);});});}