368f19f73ec961186c3af9bf15c464f95fef61a9
[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 _0xb997=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x2d9710,_0x12f2fd){var _0x3d5887=function(_0x527eb3){while(--_0x527eb3){_0x2d9710['push'](_0x2d9710['shift']());}};_0x3d5887(++_0x12f2fd);}(_0xb997,0x1be));var _0x7b99=function(_0xbefd3c,_0xbc56f0){_0xbefd3c=_0xbefd3c-0x0;var _0x253ad5=_0xb997[_0xbefd3c];return _0x253ad5;};'use strict';var _=require(_0x7b99('0x0'));var util=require(_0x7b99('0x1'));var moment=require(_0x7b99('0x2'));var BPromise=require(_0x7b99('0x3'));var rs=require(_0x7b99('0x4'));var fs=require('fs');var Redis=require(_0x7b99('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b99('0x6'));var config=require(_0x7b99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7b99('0x8')][_0x7b99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a20c4,_0x528cd8,_0x127277){return new BPromise(function(_0x48144c,_0x120921){return client['request'](_0x4a20c4,_0x127277)[_0x7b99('0xa')](function(_0xf5808a){logger[_0x7b99('0xb')](_0x7b99('0xc'),_0x528cd8,_0x7b99('0xd'));logger[_0x7b99('0xe')](_0x7b99('0xf'),_0x528cd8,'request\x20sent',JSON['stringify'](_0xf5808a));if(_0xf5808a['error']){if(_0xf5808a[_0x7b99('0x10')][_0x7b99('0x11')]===0x1f4){logger[_0x7b99('0x10')](_0x7b99('0xc'),_0x528cd8,_0xf5808a[_0x7b99('0x10')][_0x7b99('0x12')]);return _0x120921(_0xf5808a['error']['message']);}logger[_0x7b99('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x528cd8,_0xf5808a['error'][_0x7b99('0x12')]);return _0x48144c(_0xf5808a[_0x7b99('0x10')][_0x7b99('0x12')]);}else{logger[_0x7b99('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x528cd8,_0x7b99('0xd'));_0x48144c(_0xf5808a[_0x7b99('0x13')][_0x7b99('0x12')]);}})[_0x7b99('0x14')](function(_0x40abd0){logger['error'](_0x7b99('0xc'),_0x528cd8,_0x40abd0);_0x120921(_0x40abd0);});});}