5dd1d8ac1e0ea0d55fa75bbf1c48637c65bcd1a3
[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 _0x7051=['rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x3d75c4,_0x594c23){var _0x407801=function(_0x344234){while(--_0x344234){_0x3d75c4['push'](_0x3d75c4['shift']());}};_0x407801(++_0x594c23);}(_0x7051,0x120));var _0x1705=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x7051[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x1705('0x0'));var util=require(_0x1705('0x1'));var moment=require('moment');var BPromise=require(_0x1705('0x2'));var rs=require(_0x1705('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1705('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1705('0x5'))(_0x1705('0x6'));var config=require(_0x1705('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1705('0x8')][_0x1705('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16dd1d,_0x38eb46,_0x5aa6b1){return new BPromise(function(_0x523842,_0x41cb7b){return client['request'](_0x16dd1d,_0x5aa6b1)[_0x1705('0xa')](function(_0x8672e1){logger[_0x1705('0xb')](_0x1705('0xc'),_0x38eb46,_0x1705('0xd'));logger[_0x1705('0xe')](_0x1705('0xf'),_0x38eb46,'request\x20sent',JSON['stringify'](_0x8672e1));if(_0x8672e1[_0x1705('0x10')]){if(_0x8672e1['error'][_0x1705('0x11')]===0x1f4){logger[_0x1705('0x10')]('ChatApplication,\x20%s,\x20%s',_0x38eb46,_0x8672e1['error']['message']);return _0x41cb7b(_0x8672e1[_0x1705('0x10')][_0x1705('0x12')]);}logger[_0x1705('0x10')](_0x1705('0xc'),_0x38eb46,_0x8672e1[_0x1705('0x10')][_0x1705('0x12')]);return _0x523842(_0x8672e1[_0x1705('0x10')]['message']);}else{logger[_0x1705('0xb')](_0x1705('0xc'),_0x38eb46,'request\x20sent');_0x523842(_0x8672e1[_0x1705('0x13')][_0x1705('0x12')]);}})[_0x1705('0x14')](function(_0x528f38){logger[_0x1705('0x10')](_0x1705('0xc'),_0x38eb46,_0x528f38);_0x41cb7b(_0x528f38);});});}