eafbbd0a376e354f4bd4cc44fca599cabf31bc60
[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 _0x5202=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x170e3d,_0x2c69f7){var _0x58bbee=function(_0x2afaca){while(--_0x2afaca){_0x170e3d['push'](_0x170e3d['shift']());}};_0x58bbee(++_0x2c69f7);}(_0x5202,0x191));var _0x2520=function(_0x552da7,_0x20ceda){_0x552da7=_0x552da7-0x0;var _0x583894=_0x5202[_0x552da7];return _0x583894;};'use strict';var _=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var moment=require(_0x2520('0x2'));var BPromise=require(_0x2520('0x3'));var rs=require(_0x2520('0x4'));var fs=require('fs');var Redis=require(_0x2520('0x5'));var db=require(_0x2520('0x6'))['db'];var utils=require(_0x2520('0x7'));var logger=require(_0x2520('0x8'))('rpc');var config=require(_0x2520('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2520('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4383e9,_0x1f6d12,_0x2e4bd9){return new BPromise(function(_0x2b25ba,_0xa2d745){return client[_0x2520('0xb')](_0x4383e9,_0x2e4bd9)[_0x2520('0xc')](function(_0x578c19){logger[_0x2520('0xd')](_0x2520('0xe'),_0x1f6d12,'request\x20sent');logger[_0x2520('0xf')](_0x2520('0x10'),_0x1f6d12,_0x2520('0x11'),JSON[_0x2520('0x12')](_0x578c19));if(_0x578c19[_0x2520('0x13')]){if(_0x578c19['error'][_0x2520('0x14')]===0x1f4){logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x578c19[_0x2520('0x13')][_0x2520('0x15')]);return _0xa2d745(_0x578c19['error'][_0x2520('0x15')]);}logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x578c19[_0x2520('0x13')][_0x2520('0x15')]);return _0x2b25ba(_0x578c19['error']['message']);}else{logger[_0x2520('0xd')](_0x2520('0xe'),_0x1f6d12,_0x2520('0x11'));_0x2b25ba(_0x578c19[_0x2520('0x16')][_0x2520('0x15')]);}})[_0x2520('0x17')](function(_0x5d2be4){logger[_0x2520('0x13')](_0x2520('0xe'),_0x1f6d12,_0x5d2be4);_0xa2d745(_0x5d2be4);});});}