Built motion from commit 639a1a7f.|2.6.19
[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 _0xa2c9=['request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x25ae13,_0x3515f5){var _0x372648=function(_0x1f79e7){while(--_0x1f79e7){_0x25ae13['push'](_0x25ae13['shift']());}};_0x372648(++_0x3515f5);}(_0xa2c9,0x7f));var _0x9a2c=function(_0x5c590d,_0x58422a){_0x5c590d=_0x5c590d-0x0;var _0x32b090=_0xa2c9[_0x5c590d];return _0x32b090;};'use strict';var _=require('lodash');var util=require(_0x9a2c('0x0'));var moment=require(_0x9a2c('0x1'));var BPromise=require(_0x9a2c('0x2'));var rs=require(_0x9a2c('0x3'));var fs=require('fs');var Redis=require(_0x9a2c('0x4'));var db=require(_0x9a2c('0x5'))['db'];var utils=require(_0x9a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a2c('0x7'));var jayson=require(_0x9a2c('0x8'));var client=jayson[_0x9a2c('0x9')][_0x9a2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588128,_0x507a42,_0x583adc){return new BPromise(function(_0x17c0bc,_0x366933){return client[_0x9a2c('0xb')](_0x588128,_0x583adc)[_0x9a2c('0xc')](function(_0x128d11){logger[_0x9a2c('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x507a42,_0x9a2c('0xe'));logger[_0x9a2c('0xf')](_0x9a2c('0x10'),_0x507a42,_0x9a2c('0xe'),JSON[_0x9a2c('0x11')](_0x128d11));if(_0x128d11[_0x9a2c('0x12')]){if(_0x128d11['error']['code']===0x1f4){logger[_0x9a2c('0x12')](_0x9a2c('0x13'),_0x507a42,_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);return _0x366933(_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);}logger['error'](_0x9a2c('0x13'),_0x507a42,_0x128d11[_0x9a2c('0x12')]['message']);return _0x17c0bc(_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);}else{logger[_0x9a2c('0xd')](_0x9a2c('0x13'),_0x507a42,_0x9a2c('0xe'));_0x17c0bc(_0x128d11[_0x9a2c('0x15')][_0x9a2c('0x14')]);}})[_0x9a2c('0x16')](function(_0x47be0c){logger['error'](_0x9a2c('0x13'),_0x507a42,_0x47be0c);_0x366933(_0x47be0c);});});}