615de8592f509a8a406b9f8d9c6828e02e150438
[motion2.git] / server / api / UserChatInteraction / UserChatInteraction.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 _0x0934=['code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','UserChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x599dc3,_0x406b27){var _0x13c968=function(_0x5b2683){while(--_0x5b2683){_0x599dc3['push'](_0x599dc3['shift']());}};_0x13c968(++_0x406b27);}(_0x0934,0x148));var _0x4093=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x0934[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4093('0x0'));var rs=require(_0x4093('0x1'));var fs=require('fs');var Redis=require(_0x4093('0x2'));var db=require(_0x4093('0x3'))['db'];var utils=require(_0x4093('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4093('0x5'));var jayson=require(_0x4093('0x6'));var client=jayson['client'][_0x4093('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53981,_0x2024f8,_0x284b70){return new BPromise(function(_0x24e961,_0x2bab35){return client[_0x4093('0x8')](_0x53981,_0x284b70)[_0x4093('0x9')](function(_0x551603){logger['info'](_0x4093('0xa'),_0x2024f8,_0x4093('0xb'));logger['debug']('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x2024f8,'request\x20sent',JSON[_0x4093('0xc')](_0x551603));if(_0x551603['error']){if(_0x551603[_0x4093('0xd')][_0x4093('0xe')]===0x1f4){logger[_0x4093('0xd')]('UserChatInteraction,\x20%s,\x20%s',_0x2024f8,_0x551603[_0x4093('0xd')][_0x4093('0xf')]);return _0x2bab35(_0x551603[_0x4093('0xd')][_0x4093('0xf')]);}logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x2024f8,_0x551603[_0x4093('0xd')][_0x4093('0xf')]);return _0x24e961(_0x551603['error'][_0x4093('0xf')]);}else{logger['info'](_0x4093('0xa'),_0x2024f8,_0x4093('0xb'));_0x24e961(_0x551603[_0x4093('0x10')][_0x4093('0xf')]);}})[_0x4093('0x11')](function(_0x1e7cc6){logger['error'](_0x4093('0xa'),_0x2024f8,_0x1e7cc6);_0x2bab35(_0x1e7cc6);});});}