449fa1b5e4b42fc7325e948e4aded02dd631455f
[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 _0x9ba1=['code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d20b2,_0x5057a2){var _0x2ff3d1=function(_0x3aa32f){while(--_0x3aa32f){_0x3d20b2['push'](_0x3d20b2['shift']());}};_0x2ff3d1(++_0x5057a2);}(_0x9ba1,0x1bb));var _0x19ba=function(_0x1b62f1,_0xbff968){_0x1b62f1=_0x1b62f1-0x0;var _0x582f72=_0x9ba1[_0x1b62f1];return _0x582f72;};'use strict';var _=require('lodash');var util=require(_0x19ba('0x0'));var moment=require('moment');var BPromise=require(_0x19ba('0x1'));var rs=require(_0x19ba('0x2'));var fs=require('fs');var Redis=require(_0x19ba('0x3'));var db=require(_0x19ba('0x4'))['db'];var utils=require(_0x19ba('0x5'));var logger=require(_0x19ba('0x6'))(_0x19ba('0x7'));var config=require(_0x19ba('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37c867,_0x45548a,_0x575ab1){return new BPromise(function(_0x1d50c6,_0x17eb75){return client[_0x19ba('0x9')](_0x37c867,_0x575ab1)[_0x19ba('0xa')](function(_0x314ff2){logger[_0x19ba('0xb')](_0x19ba('0xc'),_0x45548a,_0x19ba('0xd'));logger['debug'](_0x19ba('0xe'),_0x45548a,_0x19ba('0xd'),JSON[_0x19ba('0xf')](_0x314ff2));if(_0x314ff2[_0x19ba('0x10')]){if(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x11')]===0x1f4){logger[_0x19ba('0x10')]('ChatApplication,\x20%s,\x20%s',_0x45548a,_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);return _0x17eb75(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);}logger[_0x19ba('0x10')](_0x19ba('0xc'),_0x45548a,_0x314ff2[_0x19ba('0x10')]['message']);return _0x1d50c6(_0x314ff2[_0x19ba('0x10')][_0x19ba('0x12')]);}else{logger[_0x19ba('0xb')](_0x19ba('0xc'),_0x45548a,_0x19ba('0xd'));_0x1d50c6(_0x314ff2[_0x19ba('0x13')][_0x19ba('0x12')]);}})['catch'](function(_0x6fb7f8){logger[_0x19ba('0x10')](_0x19ba('0xc'),_0x45548a,_0x6fb7f8);_0x17eb75(_0x6fb7f8);});});}