896a8a08d9cba1d0b86565292d5af4cbddd56fec
[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 _0x0e86=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','info','result','lodash','util','moment'];(function(_0x19db45,_0x531c14){var _0x3a9367=function(_0x41ca8){while(--_0x41ca8){_0x19db45['push'](_0x19db45['shift']());}};_0x3a9367(++_0x531c14);}(_0x0e86,0x111));var _0x60e8=function(_0x3db464,_0x53fd4e){_0x3db464=_0x3db464-0x0;var _0x81faa2=_0x0e86[_0x3db464];return _0x81faa2;};'use strict';var _=require(_0x60e8('0x0'));var util=require(_0x60e8('0x1'));var moment=require(_0x60e8('0x2'));var BPromise=require(_0x60e8('0x3'));var rs=require(_0x60e8('0x4'));var fs=require('fs');var Redis=require(_0x60e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x60e8('0x6'));var logger=require(_0x60e8('0x7'))(_0x60e8('0x8'));var config=require(_0x60e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x60e8('0xa')][_0x60e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf11014,_0x387313,_0x4e88e7){return new BPromise(function(_0x4b5642,_0x555f05){return client['request'](_0xf11014,_0x4e88e7)[_0x60e8('0xc')](function(_0x4d76e2){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x387313,_0x60e8('0xd'));logger[_0x60e8('0xe')](_0x60e8('0xf'),_0x387313,_0x60e8('0xd'),JSON[_0x60e8('0x10')](_0x4d76e2));if(_0x4d76e2[_0x60e8('0x11')]){if(_0x4d76e2['error'][_0x60e8('0x12')]===0x1f4){logger[_0x60e8('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x387313,_0x4d76e2['error'][_0x60e8('0x13')]);return _0x555f05(_0x4d76e2[_0x60e8('0x11')]['message']);}logger[_0x60e8('0x11')](_0x60e8('0x14'),_0x387313,_0x4d76e2[_0x60e8('0x11')][_0x60e8('0x13')]);return _0x4b5642(_0x4d76e2['error'][_0x60e8('0x13')]);}else{logger[_0x60e8('0x15')](_0x60e8('0x14'),_0x387313,'request\x20sent');_0x4b5642(_0x4d76e2[_0x60e8('0x16')][_0x60e8('0x13')]);}})['catch'](function(_0x91f3a1){logger[_0x60e8('0x11')](_0x60e8('0x14'),_0x387313,_0x91f3a1);_0x555f05(_0x91f3a1);});});}