ad58850e094d57eb927557ada2b2a1459e8b3e4a
[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 _0x4e04=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x4e04,0x8a));var _0x44e0=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x4e04[_0x4fbb15];return _0x436338;};'use strict';var _=require(_0x44e0('0x0'));var util=require(_0x44e0('0x1'));var moment=require(_0x44e0('0x2'));var BPromise=require(_0x44e0('0x3'));var rs=require(_0x44e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44e0('0x5'))['db'];var utils=require(_0x44e0('0x6'));var logger=require('../../config/logger')(_0x44e0('0x7'));var config=require(_0x44e0('0x8'));var jayson=require(_0x44e0('0x9'));var client=jayson[_0x44e0('0xa')][_0x44e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c371,_0x3bc730,_0x3d638){return new BPromise(function(_0x320bb5,_0x172a06){return client[_0x44e0('0xc')](_0x45c371,_0x3d638)['then'](function(_0x389125){logger[_0x44e0('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3bc730,_0x44e0('0xe'));logger[_0x44e0('0xf')](_0x44e0('0x10'),_0x3bc730,'request\x20sent',JSON['stringify'](_0x389125));if(_0x389125['error']){if(_0x389125[_0x44e0('0x11')]['code']===0x1f4){logger[_0x44e0('0x11')](_0x44e0('0x12'),_0x3bc730,_0x389125[_0x44e0('0x11')]['message']);return _0x172a06(_0x389125[_0x44e0('0x11')][_0x44e0('0x13')]);}logger['error'](_0x44e0('0x12'),_0x3bc730,_0x389125['error'][_0x44e0('0x13')]);return _0x320bb5(_0x389125[_0x44e0('0x11')][_0x44e0('0x13')]);}else{logger[_0x44e0('0xd')](_0x44e0('0x12'),_0x3bc730,_0x44e0('0xe'));_0x320bb5(_0x389125[_0x44e0('0x14')]['message']);}})[_0x44e0('0x15')](function(_0x4b926b){logger[_0x44e0('0x11')](_0x44e0('0x12'),_0x3bc730,_0x4b926b);_0x172a06(_0x4b926b);});});}