Built motion from commit (unavailable).|2.5.11
[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 _0xf7a8=['error','message','result','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d54ff,_0x1607de){var _0x2795a7=function(_0x2a1ed6){while(--_0x2a1ed6){_0x5d54ff['push'](_0x5d54ff['shift']());}};_0x2795a7(++_0x1607de);}(_0xf7a8,0x1c5));var _0x8f7a=function(_0x27fe50,_0x44a45a){_0x27fe50=_0x27fe50-0x0;var _0x233ebc=_0xf7a8[_0x27fe50];return _0x233ebc;};'use strict';var _=require('lodash');var util=require(_0x8f7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f7a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f7a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f7a('0x3'))(_0x8f7a('0x4'));var config=require(_0x8f7a('0x5'));var jayson=require(_0x8f7a('0x6'));var client=jayson[_0x8f7a('0x7')][_0x8f7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aebdb,_0x1d001a,_0x484313){return new BPromise(function(_0x4de355,_0x327b20){return client['request'](_0x2aebdb,_0x484313)[_0x8f7a('0x9')](function(_0x18abb2){logger[_0x8f7a('0xa')](_0x8f7a('0xb'),_0x1d001a,_0x8f7a('0xc'));logger['debug'](_0x8f7a('0xd'),_0x1d001a,_0x8f7a('0xc'),JSON[_0x8f7a('0xe')](_0x18abb2));if(_0x18abb2[_0x8f7a('0xf')]){if(_0x18abb2[_0x8f7a('0xf')]['code']===0x1f4){logger[_0x8f7a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1d001a,_0x18abb2[_0x8f7a('0xf')][_0x8f7a('0x10')]);return _0x327b20(_0x18abb2[_0x8f7a('0xf')][_0x8f7a('0x10')]);}logger[_0x8f7a('0xf')](_0x8f7a('0xb'),_0x1d001a,_0x18abb2['error']['message']);return _0x4de355(_0x18abb2[_0x8f7a('0xf')]['message']);}else{logger['info'](_0x8f7a('0xb'),_0x1d001a,_0x8f7a('0xc'));_0x4de355(_0x18abb2[_0x8f7a('0x11')]['message']);}})['catch'](function(_0x2a0af4){logger[_0x8f7a('0xf')](_0x8f7a('0xb'),_0x1d001a,_0x2a0af4);_0x327b20(_0x2a0af4);});});}