5772a2a56e52367e77530b53f61492c0f5412ce9
[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 _0x7c46=['../../config/logger','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','randomstring','ioredis','../../mysqldb'];(function(_0x5672cd,_0x23abf5){var _0x328beb=function(_0x21b745){while(--_0x21b745){_0x5672cd['push'](_0x5672cd['shift']());}};_0x328beb(++_0x23abf5);}(_0x7c46,0xea));var _0x67c4=function(_0xf6e834,_0x1b8457){_0xf6e834=_0xf6e834-0x0;var _0x1ce4c8=_0x7c46[_0xf6e834];return _0x1ce4c8;};'use strict';var _=require('lodash');var util=require(_0x67c4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x67c4('0x1'));var fs=require('fs');var Redis=require(_0x67c4('0x2'));var db=require(_0x67c4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x67c4('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x67c4('0x5'));var client=jayson[_0x67c4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f185a,_0x2b3f03,_0xf4e668){return new BPromise(function(_0x5df09a,_0xa34f29){return client[_0x67c4('0x7')](_0x4f185a,_0xf4e668)[_0x67c4('0x8')](function(_0x49b940){logger[_0x67c4('0x9')](_0x67c4('0xa'),_0x2b3f03,'request\x20sent');logger['debug'](_0x67c4('0xb'),_0x2b3f03,_0x67c4('0xc'),JSON['stringify'](_0x49b940));if(_0x49b940['error']){if(_0x49b940[_0x67c4('0xd')]['code']===0x1f4){logger['error'](_0x67c4('0xa'),_0x2b3f03,_0x49b940[_0x67c4('0xd')]['message']);return _0xa34f29(_0x49b940['error'][_0x67c4('0xe')]);}logger[_0x67c4('0xd')](_0x67c4('0xa'),_0x2b3f03,_0x49b940[_0x67c4('0xd')]['message']);return _0x5df09a(_0x49b940[_0x67c4('0xd')]['message']);}else{logger['info'](_0x67c4('0xa'),_0x2b3f03,'request\x20sent');_0x5df09a(_0x49b940[_0x67c4('0xf')][_0x67c4('0xe')]);}})[_0x67c4('0x10')](function(_0x2d88e8){logger[_0x67c4('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x2b3f03,_0x2d88e8);_0xa34f29(_0x2d88e8);});});}