Built motion from commit 19a84241.|2.5.34
[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 _0xeb15=['message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x27c2b5,_0x2b8164){var _0x3bb0e2=function(_0x22ae9a){while(--_0x22ae9a){_0x27c2b5['push'](_0x27c2b5['shift']());}};_0x3bb0e2(++_0x2b8164);}(_0xeb15,0x9a));var _0x5eb1=function(_0x3dc1c6,_0x8529a1){_0x3dc1c6=_0x3dc1c6-0x0;var _0x3c82ce=_0xeb15[_0x3dc1c6];return _0x3c82ce;};'use strict';var _=require('lodash');var util=require(_0x5eb1('0x0'));var moment=require(_0x5eb1('0x1'));var BPromise=require('bluebird');var rs=require(_0x5eb1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5eb1('0x3'))['db'];var utils=require(_0x5eb1('0x4'));var logger=require(_0x5eb1('0x5'))(_0x5eb1('0x6'));var config=require(_0x5eb1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5eb1('0x8')][_0x5eb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a22e,_0x23cdb7,_0x1faedf){return new BPromise(function(_0x1db37f,_0x2daf1f){return client['request'](_0x24a22e,_0x1faedf)[_0x5eb1('0xa')](function(_0x360fcc){logger[_0x5eb1('0xb')](_0x5eb1('0xc'),_0x23cdb7,_0x5eb1('0xd'));logger['debug'](_0x5eb1('0xe'),_0x23cdb7,_0x5eb1('0xd'),JSON['stringify'](_0x360fcc));if(_0x360fcc[_0x5eb1('0xf')]){if(_0x360fcc[_0x5eb1('0xf')][_0x5eb1('0x10')]===0x1f4){logger[_0x5eb1('0xf')](_0x5eb1('0xc'),_0x23cdb7,_0x360fcc[_0x5eb1('0xf')][_0x5eb1('0x11')]);return _0x2daf1f(_0x360fcc[_0x5eb1('0xf')][_0x5eb1('0x11')]);}logger[_0x5eb1('0xf')](_0x5eb1('0xc'),_0x23cdb7,_0x360fcc[_0x5eb1('0xf')]['message']);return _0x1db37f(_0x360fcc[_0x5eb1('0xf')][_0x5eb1('0x11')]);}else{logger[_0x5eb1('0xb')](_0x5eb1('0xc'),_0x23cdb7,'request\x20sent');_0x1db37f(_0x360fcc[_0x5eb1('0x12')][_0x5eb1('0x11')]);}})['catch'](function(_0x4e0fb5){logger[_0x5eb1('0xf')](_0x5eb1('0xc'),_0x23cdb7,_0x4e0fb5);_0x2daf1f(_0x4e0fb5);});});}