65c27990bc79da27385d192a87f83adcf0455c6b
[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 _0x018e=['request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0xe54585,_0x9db18c){var _0x584d94=function(_0x380e0d){while(--_0x380e0d){_0xe54585['push'](_0xe54585['shift']());}};_0x584d94(++_0x9db18c);}(_0x018e,0x1a8));var _0xe018=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0x018e[_0x3b085];return _0x476a57;};'use strict';var _=require(_0xe018('0x0'));var util=require(_0xe018('0x1'));var moment=require(_0xe018('0x2'));var BPromise=require(_0xe018('0x3'));var rs=require(_0xe018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe018('0x5'))['db'];var utils=require(_0xe018('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe018('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe018('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbbfb,_0x14c4d7,_0x167615){return new BPromise(function(_0x5b44eb,_0x26f394){return client[_0xe018('0x9')](_0x3dbbfb,_0x167615)[_0xe018('0xa')](function(_0x60db92){logger[_0xe018('0xb')](_0xe018('0xc'),_0x14c4d7,_0xe018('0xd'));logger[_0xe018('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14c4d7,_0xe018('0xd'),JSON['stringify'](_0x60db92));if(_0x60db92['error']){if(_0x60db92[_0xe018('0xf')]['code']===0x1f4){logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);return _0x26f394(_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);}logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x60db92[_0xe018('0xf')]['message']);return _0x5b44eb(_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);}else{logger[_0xe018('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x14c4d7,_0xe018('0xd'));_0x5b44eb(_0x60db92[_0xe018('0x11')][_0xe018('0x10')]);}})[_0xe018('0x12')](function(_0x5940ce){logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x5940ce);_0x26f394(_0x5940ce);});});}