d00a63879e31b8203f648c7ad99f4f2e13cacaa8
[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 _0xec79=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4a2d35,_0x4f2020){var _0xad896e=function(_0x3edc87){while(--_0x3edc87){_0x4a2d35['push'](_0x4a2d35['shift']());}};_0xad896e(++_0x4f2020);}(_0xec79,0xf9));var _0x9ec7=function(_0x5df82a,_0x4d4d2e){_0x5df82a=_0x5df82a-0x0;var _0x3178dc=_0xec79[_0x5df82a];return _0x3178dc;};'use strict';var _=require(_0x9ec7('0x0'));var util=require(_0x9ec7('0x1'));var moment=require(_0x9ec7('0x2'));var BPromise=require(_0x9ec7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ec7('0x4'));var db=require(_0x9ec7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ec7('0x6'));var config=require(_0x9ec7('0x7'));var jayson=require(_0x9ec7('0x8'));var client=jayson[_0x9ec7('0x9')][_0x9ec7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406d36,_0x43397e,_0x4f306e){return new BPromise(function(_0x191c1e,_0x472d0f){return client[_0x9ec7('0xb')](_0x406d36,_0x4f306e)[_0x9ec7('0xc')](function(_0x18f6ca){logger[_0x9ec7('0xd')](_0x9ec7('0xe'),_0x43397e,_0x9ec7('0xf'));logger[_0x9ec7('0x10')](_0x9ec7('0x11'),_0x43397e,_0x9ec7('0xf'),JSON[_0x9ec7('0x12')](_0x18f6ca));if(_0x18f6ca[_0x9ec7('0x13')]){if(_0x18f6ca[_0x9ec7('0x13')][_0x9ec7('0x14')]===0x1f4){logger[_0x9ec7('0x13')](_0x9ec7('0xe'),_0x43397e,_0x18f6ca[_0x9ec7('0x13')][_0x9ec7('0x15')]);return _0x472d0f(_0x18f6ca[_0x9ec7('0x13')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x43397e,_0x18f6ca['error'][_0x9ec7('0x15')]);return _0x191c1e(_0x18f6ca['error']['message']);}else{logger[_0x9ec7('0xd')](_0x9ec7('0xe'),_0x43397e,_0x9ec7('0xf'));_0x191c1e(_0x18f6ca['result'][_0x9ec7('0x15')]);}})['catch'](function(_0x5f3b50){logger[_0x9ec7('0x13')](_0x9ec7('0xe'),_0x43397e,_0x5f3b50);_0x472d0f(_0x5f3b50);});});}