71d0cdc43d5c492b0c99499f87a0b5ee622e1c29
[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 _0x89b1=['http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x112a66,_0x5cc3a3){var _0x838651=function(_0x2b794c){while(--_0x2b794c){_0x112a66['push'](_0x112a66['shift']());}};_0x838651(++_0x5cc3a3);}(_0x89b1,0xae));var _0x189b=function(_0x43e281,_0x4579c3){_0x43e281=_0x43e281-0x0;var _0x2dc360=_0x89b1[_0x43e281];return _0x2dc360;};'use strict';var _=require(_0x189b('0x0'));var util=require(_0x189b('0x1'));var moment=require(_0x189b('0x2'));var BPromise=require('bluebird');var rs=require(_0x189b('0x3'));var fs=require('fs');var Redis=require(_0x189b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x189b('0x5'));var logger=require(_0x189b('0x6'))(_0x189b('0x7'));var config=require('../../config/environment');var jayson=require(_0x189b('0x8'));var client=jayson[_0x189b('0x9')][_0x189b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40605a,_0x1a753b,_0x501ed4){return new BPromise(function(_0x5667f5,_0xcb2f4d){return client[_0x189b('0xb')](_0x40605a,_0x501ed4)[_0x189b('0xc')](function(_0x5bd7e7){logger[_0x189b('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a753b,_0x189b('0xe'));logger[_0x189b('0xf')](_0x189b('0x10'),_0x1a753b,_0x189b('0xe'),JSON[_0x189b('0x11')](_0x5bd7e7));if(_0x5bd7e7[_0x189b('0x12')]){if(_0x5bd7e7[_0x189b('0x12')][_0x189b('0x13')]===0x1f4){logger[_0x189b('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a753b,_0x5bd7e7['error'][_0x189b('0x14')]);return _0xcb2f4d(_0x5bd7e7['error'][_0x189b('0x14')]);}logger[_0x189b('0x12')](_0x189b('0x15'),_0x1a753b,_0x5bd7e7[_0x189b('0x12')][_0x189b('0x14')]);return _0x5667f5(_0x5bd7e7[_0x189b('0x12')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1a753b,_0x189b('0xe'));_0x5667f5(_0x5bd7e7[_0x189b('0x16')]['message']);}})['catch'](function(_0x38f7bc){logger[_0x189b('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a753b,_0x38f7bc);_0xcb2f4d(_0x38f7bc);});});}