Built motion from commit 47436d59.|2.6.7
[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 _0xde22=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x3fbb8f,_0x2ad588){var _0x15b862=function(_0x5b12e9){while(--_0x5b12e9){_0x3fbb8f['push'](_0x3fbb8f['shift']());}};_0x15b862(++_0x2ad588);}(_0xde22,0x1d4));var _0x2de2=function(_0x3da0b7,_0x475713){_0x3da0b7=_0x3da0b7-0x0;var _0x52c6c2=_0xde22[_0x3da0b7];return _0x52c6c2;};'use strict';var _=require(_0x2de2('0x0'));var util=require(_0x2de2('0x1'));var moment=require('moment');var BPromise=require(_0x2de2('0x2'));var rs=require(_0x2de2('0x3'));var fs=require('fs');var Redis=require(_0x2de2('0x4'));var db=require(_0x2de2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2de2('0x6'))(_0x2de2('0x7'));var config=require(_0x2de2('0x8'));var jayson=require(_0x2de2('0x9'));var client=jayson[_0x2de2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb952e1,_0x24b884,_0x11b8df){return new BPromise(function(_0x10339a,_0x4a20dc){return client[_0x2de2('0xb')](_0xb952e1,_0x11b8df)[_0x2de2('0xc')](function(_0x1c2842){logger[_0x2de2('0xd')](_0x2de2('0xe'),_0x24b884,'request\x20sent');logger[_0x2de2('0xf')](_0x2de2('0x10'),_0x24b884,_0x2de2('0x11'),JSON[_0x2de2('0x12')](_0x1c2842));if(_0x1c2842['error']){if(_0x1c2842[_0x2de2('0x13')][_0x2de2('0x14')]===0x1f4){logger[_0x2de2('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x24b884,_0x1c2842[_0x2de2('0x13')][_0x2de2('0x15')]);return _0x4a20dc(_0x1c2842[_0x2de2('0x13')][_0x2de2('0x15')]);}logger['error'](_0x2de2('0xe'),_0x24b884,_0x1c2842[_0x2de2('0x13')][_0x2de2('0x15')]);return _0x10339a(_0x1c2842[_0x2de2('0x13')][_0x2de2('0x15')]);}else{logger[_0x2de2('0xd')](_0x2de2('0xe'),_0x24b884,_0x2de2('0x11'));_0x10339a(_0x1c2842[_0x2de2('0x16')][_0x2de2('0x15')]);}})['catch'](function(_0x6b48b){logger[_0x2de2('0x13')](_0x2de2('0xe'),_0x24b884,_0x6b48b);_0x4a20dc(_0x6b48b);});});}