Built motion from commit (unavailable).|2.1.0
[motion2.git] / server / api / action / action.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 _0xa5ca=['request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','Action,\x20%s,\x20%s'];(function(_0x5a633a,_0x4e8830){var _0x4a9df=function(_0x1a6732){while(--_0x1a6732){_0x5a633a['push'](_0x5a633a['shift']());}};_0x4a9df(++_0x4e8830);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xa5ca[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var moment=require(_0xaa5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa5c('0x3'));var db=require(_0xaa5c('0x4'))['db'];var utils=require(_0xaa5c('0x5'));var logger=require(_0xaa5c('0x6'))(_0xaa5c('0x7'));var config=require(_0xaa5c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41b86b,_0x10bee5,_0x283bc5){return new BPromise(function(_0x5b39a7,_0x496243){return client[_0xaa5c('0x9')](_0x41b86b,_0x283bc5)[_0xaa5c('0xa')](function(_0x170d3b){logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));logger[_0xaa5c('0xd')](_0xaa5c('0xe'),_0x10bee5,_0xaa5c('0xc'),JSON[_0xaa5c('0xf')](_0x170d3b));if(_0x170d3b[_0xaa5c('0x10')]){if(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x11')]===0x1f4){logger[_0xaa5c('0x10')](_0xaa5c('0xb'),_0x10bee5,_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);return _0x496243(_0x170d3b['error'][_0xaa5c('0x12')]);}logger['error']('Action,\x20%s,\x20%s',_0x10bee5,_0x170d3b['error'][_0xaa5c('0x12')]);return _0x5b39a7(_0x170d3b[_0xaa5c('0x10')][_0xaa5c('0x12')]);}else{logger['info'](_0xaa5c('0xb'),_0x10bee5,_0xaa5c('0xc'));_0x5b39a7(_0x170d3b[_0xaa5c('0x13')][_0xaa5c('0x12')]);}})[_0xaa5c('0x14')](function(_0x272d06){logger['error']('Action,\x20%s,\x20%s',_0x10bee5,_0x272d06);_0x496243(_0x272d06);});});}