dade1016141bf7b16879a982877c7613fa6588c7
[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 _0x8347=['util','bluebird','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x588b49,_0x1bc27e){var _0x20079e=function(_0x784472){while(--_0x784472){_0x588b49['push'](_0x588b49['shift']());}};_0x20079e(++_0x1bc27e);}(_0x8347,0x142));var _0x7834=function(_0x3bbc13,_0x4ea5da){_0x3bbc13=_0x3bbc13-0x0;var _0x3e73fc=_0x8347[_0x3bbc13];return _0x3e73fc;};'use strict';var _=require(_0x7834('0x0'));var util=require(_0x7834('0x1'));var moment=require('moment');var BPromise=require(_0x7834('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7834('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7834('0x4'));var logger=require(_0x7834('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7834('0x6')][_0x7834('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27b8ea,_0x4bc03c,_0xeba0cb){return new BPromise(function(_0x1945e4,_0x356f51){return client[_0x7834('0x8')](_0x27b8ea,_0xeba0cb)[_0x7834('0x9')](function(_0x4c4991){logger[_0x7834('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x4bc03c,_0x7834('0xb'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4bc03c,_0x7834('0xb'),JSON[_0x7834('0xc')](_0x4c4991));if(_0x4c4991[_0x7834('0xd')]){if(_0x4c4991['error'][_0x7834('0xe')]===0x1f4){logger[_0x7834('0xd')](_0x7834('0xf'),_0x4bc03c,_0x4c4991[_0x7834('0xd')]['message']);return _0x356f51(_0x4c4991[_0x7834('0xd')][_0x7834('0x10')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4bc03c,_0x4c4991[_0x7834('0xd')][_0x7834('0x10')]);return _0x1945e4(_0x4c4991[_0x7834('0xd')][_0x7834('0x10')]);}else{logger['info'](_0x7834('0xf'),_0x4bc03c,'request\x20sent');_0x1945e4(_0x4c4991[_0x7834('0x11')][_0x7834('0x10')]);}})[_0x7834('0x12')](function(_0x104e9a){logger['error'](_0x7834('0xf'),_0x4bc03c,_0x104e9a);_0x356f51(_0x104e9a);});});}