c0ac01aae4418877a0776679c506b6cb4e63ed84
[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 _0xe661=['message','result','catch','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xe661,0x1f0));var _0x1e66=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe661[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e66('0x0'))['db'];var utils=require(_0x1e66('0x1'));var logger=require(_0x1e66('0x2'))(_0x1e66('0x3'));var config=require(_0x1e66('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f4312,_0x569a83,_0x564437){return new BPromise(function(_0x2eb142,_0x5376e6){return client[_0x1e66('0x5')](_0x3f4312,_0x564437)[_0x1e66('0x6')](function(_0xf3cff5){logger[_0x1e66('0x7')](_0x1e66('0x8'),_0x569a83,_0x1e66('0x9'));logger['debug'](_0x1e66('0xa'),_0x569a83,'request\x20sent',JSON[_0x1e66('0xb')](_0xf3cff5));if(_0xf3cff5['error']){if(_0xf3cff5[_0x1e66('0xc')][_0x1e66('0xd')]===0x1f4){logger[_0x1e66('0xc')](_0x1e66('0x8'),_0x569a83,_0xf3cff5['error'][_0x1e66('0xe')]);return _0x5376e6(_0xf3cff5[_0x1e66('0xc')]['message']);}logger[_0x1e66('0xc')](_0x1e66('0x8'),_0x569a83,_0xf3cff5[_0x1e66('0xc')]['message']);return _0x2eb142(_0xf3cff5[_0x1e66('0xc')]['message']);}else{logger[_0x1e66('0x7')](_0x1e66('0x8'),_0x569a83,_0x1e66('0x9'));_0x2eb142(_0xf3cff5[_0x1e66('0xf')][_0x1e66('0xe')]);}})[_0x1e66('0x10')](function(_0x2f5430){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x569a83,_0x2f5430);_0x5376e6(_0x2f5430);});});}