Built motion from commit 00bf23f6.|2.6.16
[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 _0xde03=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xde03,0x1af));var _0x3de0=function(_0x364857,_0x2ca0fe){_0x364857=_0x364857-0x0;var _0x3ab9a6=_0xde03[_0x364857];return _0x3ab9a6;};'use strict';var _=require('lodash');var util=require(_0x3de0('0x0'));var moment=require(_0x3de0('0x1'));var BPromise=require(_0x3de0('0x2'));var rs=require(_0x3de0('0x3'));var fs=require('fs');var Redis=require(_0x3de0('0x4'));var db=require(_0x3de0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3de0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3de0('0x7')][_0x3de0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1795ae,_0x2b1256,_0xcd5c2c){return new BPromise(function(_0x26cff3,_0x5bd684){return client[_0x3de0('0x9')](_0x1795ae,_0xcd5c2c)[_0x3de0('0xa')](function(_0x3b03db){logger['info'](_0x3de0('0xb'),_0x2b1256,_0x3de0('0xc'));logger['debug'](_0x3de0('0xd'),_0x2b1256,'request\x20sent',JSON['stringify'](_0x3b03db));if(_0x3b03db[_0x3de0('0xe')]){if(_0x3b03db[_0x3de0('0xe')][_0x3de0('0xf')]===0x1f4){logger[_0x3de0('0xe')](_0x3de0('0xb'),_0x2b1256,_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);return _0x5bd684(_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);}logger[_0x3de0('0xe')](_0x3de0('0xb'),_0x2b1256,_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);return _0x26cff3(_0x3b03db[_0x3de0('0xe')][_0x3de0('0x10')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2b1256,_0x3de0('0xc'));_0x26cff3(_0x3b03db[_0x3de0('0x11')]['message']);}})['catch'](function(_0xf32061){logger[_0x3de0('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2b1256,_0xf32061);_0x5bd684(_0xf32061);});});}