d1ee333e3eac14469eb05f54baa4e4a91b8ecfb0
[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 _0x7e51=['message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x903eeb,_0x322ebe){var _0x36a1f1=function(_0x5b4924){while(--_0x5b4924){_0x903eeb['push'](_0x903eeb['shift']());}};_0x36a1f1(++_0x322ebe);}(_0x7e51,0x167));var _0x17e5=function(_0x2f66f5,_0x4b4560){_0x2f66f5=_0x2f66f5-0x0;var _0x56e73e=_0x7e51[_0x2f66f5];return _0x56e73e;};'use strict';var _=require(_0x17e5('0x0'));var util=require(_0x17e5('0x1'));var moment=require(_0x17e5('0x2'));var BPromise=require(_0x17e5('0x3'));var rs=require(_0x17e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17e5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x17e5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1e8efa,_0x4466d4,_0x29171e){return new BPromise(function(_0x1c9241,_0x3759bb){return client['request'](_0x1e8efa,_0x29171e)[_0x17e5('0x7')](function(_0x4df81b){logger[_0x17e5('0x8')](_0x17e5('0x9'),_0x4466d4,_0x17e5('0xa'));logger[_0x17e5('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4466d4,_0x17e5('0xa'),JSON[_0x17e5('0xc')](_0x4df81b));if(_0x4df81b[_0x17e5('0xd')]){if(_0x4df81b['error'][_0x17e5('0xe')]===0x1f4){logger[_0x17e5('0xd')](_0x17e5('0x9'),_0x4466d4,_0x4df81b[_0x17e5('0xd')][_0x17e5('0xf')]);return _0x3759bb(_0x4df81b[_0x17e5('0xd')][_0x17e5('0xf')]);}logger[_0x17e5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x4466d4,_0x4df81b[_0x17e5('0xd')][_0x17e5('0xf')]);return _0x1c9241(_0x4df81b[_0x17e5('0xd')][_0x17e5('0xf')]);}else{logger[_0x17e5('0x8')]('ChatProactiveAction,\x20%s,\x20%s',_0x4466d4,_0x17e5('0xa'));_0x1c9241(_0x4df81b[_0x17e5('0x10')][_0x17e5('0xf')]);}})['catch'](function(_0xe6fac7){logger[_0x17e5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x4466d4,_0xe6fac7);_0x3759bb(_0xe6fac7);});});}