95250de048821d6591d1ef48691164c56f7ef052
[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 _0xf3cb=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0xf3cb,0x125));var _0xbf3c=function(_0x479dcc,_0xbdb759){_0x479dcc=_0x479dcc-0x0;var _0xebfb56=_0xf3cb[_0x479dcc];return _0xebfb56;};'use strict';var _=require(_0xbf3c('0x0'));var util=require('util');var moment=require(_0xbf3c('0x1'));var BPromise=require(_0xbf3c('0x2'));var rs=require(_0xbf3c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf3c('0x4'))['db'];var utils=require(_0xbf3c('0x5'));var logger=require(_0xbf3c('0x6'))(_0xbf3c('0x7'));var config=require(_0xbf3c('0x8'));var jayson=require(_0xbf3c('0x9'));var client=jayson[_0xbf3c('0xa')][_0xbf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ef500,_0x447cbd,_0x1c4a1d){return new BPromise(function(_0x2d7043,_0x4fd154){return client['request'](_0x1ef500,_0x1c4a1d)['then'](function(_0xe1be9){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x447cbd,_0xbf3c('0xc'));logger['debug'](_0xbf3c('0xd'),_0x447cbd,_0xbf3c('0xc'),JSON[_0xbf3c('0xe')](_0xe1be9));if(_0xe1be9[_0xbf3c('0xf')]){if(_0xe1be9[_0xbf3c('0xf')][_0xbf3c('0x10')]===0x1f4){logger['error'](_0xbf3c('0x11'),_0x447cbd,_0xe1be9[_0xbf3c('0xf')]['message']);return _0x4fd154(_0xe1be9['error'][_0xbf3c('0x12')]);}logger[_0xbf3c('0xf')](_0xbf3c('0x11'),_0x447cbd,_0xe1be9[_0xbf3c('0xf')][_0xbf3c('0x12')]);return _0x2d7043(_0xe1be9['error']['message']);}else{logger[_0xbf3c('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x447cbd,_0xbf3c('0xc'));_0x2d7043(_0xe1be9['result'][_0xbf3c('0x12')]);}})[_0xbf3c('0x14')](function(_0x3c26c6){logger[_0xbf3c('0xf')](_0xbf3c('0x11'),_0x447cbd,_0x3c26c6);_0x4fd154(_0x3c26c6);});});}