cebfcc9610eb5ad638cf00abcccd0986f3c7fe07
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.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 _0x10e7=['message','ChatProactiveAction,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10e7,0x147));var _0x710e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x10e7[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x710e('0x0'));var BPromise=require('bluebird');var rs=require(_0x710e('0x1'));var fs=require('fs');var Redis=require(_0x710e('0x2'));var db=require(_0x710e('0x3'))['db'];var utils=require(_0x710e('0x4'));var logger=require(_0x710e('0x5'))(_0x710e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x710e('0x7')][_0x710e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d139,_0x47f2ff,_0x1c6535){return new BPromise(function(_0x38cdb3,_0x5110f9){return client['request'](_0x31d139,_0x1c6535)[_0x710e('0x9')](function(_0x3d8f5f){logger[_0x710e('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x710e('0xb'));logger['debug'](_0x710e('0xc'),_0x47f2ff,_0x710e('0xb'),JSON['stringify'](_0x3d8f5f));if(_0x3d8f5f[_0x710e('0xd')]){if(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xe')]===0x1f4){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);return _0x5110f9(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}logger[_0x710e('0xd')](_0x710e('0x10'),_0x47f2ff,_0x3d8f5f['error'][_0x710e('0xf')]);return _0x38cdb3(_0x3d8f5f[_0x710e('0xd')][_0x710e('0xf')]);}else{logger[_0x710e('0xa')](_0x710e('0x10'),_0x47f2ff,_0x710e('0xb'));_0x38cdb3(_0x3d8f5f[_0x710e('0x11')]['message']);}})[_0x710e('0x12')](function(_0x585d7a){logger[_0x710e('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x47f2ff,_0x585d7a);_0x5110f9(_0x585d7a);});});}