6a347df73ad89feb09afdb9e6f3afbbcc5ca807f
[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 _0x4420=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x4420,0x96));var _0x0442=function(_0x364831,_0x9b86db){_0x364831=_0x364831-0x0;var _0x51e68f=_0x4420[_0x364831];return _0x51e68f;};'use strict';var _=require(_0x0442('0x0'));var util=require(_0x0442('0x1'));var moment=require(_0x0442('0x2'));var BPromise=require(_0x0442('0x3'));var rs=require(_0x0442('0x4'));var fs=require('fs');var Redis=require(_0x0442('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0442('0x6'));var logger=require('../../config/logger')(_0x0442('0x7'));var config=require(_0x0442('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0442('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x263c57,_0x4eb73a,_0x26da88){return new BPromise(function(_0x5cc7be,_0x3906c7){return client[_0x0442('0xa')](_0x263c57,_0x26da88)[_0x0442('0xb')](function(_0x58c5dd){logger[_0x0442('0xc')](_0x0442('0xd'),_0x4eb73a,_0x0442('0xe'));logger[_0x0442('0xf')](_0x0442('0x10'),_0x4eb73a,_0x0442('0xe'),JSON[_0x0442('0x11')](_0x58c5dd));if(_0x58c5dd[_0x0442('0x12')]){if(_0x58c5dd['error']['code']===0x1f4){logger[_0x0442('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x4eb73a,_0x58c5dd[_0x0442('0x12')][_0x0442('0x13')]);return _0x3906c7(_0x58c5dd[_0x0442('0x12')]['message']);}logger[_0x0442('0x12')](_0x0442('0xd'),_0x4eb73a,_0x58c5dd['error'][_0x0442('0x13')]);return _0x5cc7be(_0x58c5dd[_0x0442('0x12')]['message']);}else{logger[_0x0442('0xc')](_0x0442('0xd'),_0x4eb73a,_0x0442('0xe'));_0x5cc7be(_0x58c5dd['result'][_0x0442('0x13')]);}})[_0x0442('0x14')](function(_0x3098c1){logger['error'](_0x0442('0xd'),_0x4eb73a,_0x3098c1);_0x3906c7(_0x3098c1);});});}