Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / saRequest / saRequest.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 _0xf701=['info','SARequest,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x1bbf43,_0x2f9fa8){var _0x195a04=function(_0x47b476){while(--_0x47b476){_0x1bbf43['push'](_0x1bbf43['shift']());}};_0x195a04(++_0x2f9fa8);}(_0xf701,0x94));var _0x1f70=function(_0x40d979,_0x4bcbfe){_0x40d979=_0x40d979-0x0;var _0x50ccee=_0xf701[_0x40d979];return _0x50ccee;};'use strict';var _=require('lodash');var util=require(_0x1f70('0x0'));var moment=require(_0x1f70('0x1'));var BPromise=require(_0x1f70('0x2'));var rs=require(_0x1f70('0x3'));var fs=require('fs');var Redis=require(_0x1f70('0x4'));var db=require(_0x1f70('0x5'))['db'];var utils=require(_0x1f70('0x6'));var logger=require(_0x1f70('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1f70('0x8'));var client=jayson['client'][_0x1f70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338d6b,_0x12c6cc,_0x45ccdf){return new BPromise(function(_0x4861fd,_0x49d1fa){return client[_0x1f70('0xa')](_0x338d6b,_0x45ccdf)[_0x1f70('0xb')](function(_0x51d6a0){logger[_0x1f70('0xc')](_0x1f70('0xd'),_0x12c6cc,_0x1f70('0xe'));logger['debug']('SARequest,\x20%s,\x20%s,\x20%s',_0x12c6cc,_0x1f70('0xe'),JSON['stringify'](_0x51d6a0));if(_0x51d6a0[_0x1f70('0xf')]){if(_0x51d6a0[_0x1f70('0xf')][_0x1f70('0x10')]===0x1f4){logger[_0x1f70('0xf')](_0x1f70('0xd'),_0x12c6cc,_0x51d6a0[_0x1f70('0xf')]['message']);return _0x49d1fa(_0x51d6a0['error'][_0x1f70('0x11')]);}logger[_0x1f70('0xf')]('SARequest,\x20%s,\x20%s',_0x12c6cc,_0x51d6a0[_0x1f70('0xf')][_0x1f70('0x11')]);return _0x4861fd(_0x51d6a0[_0x1f70('0xf')]['message']);}else{logger[_0x1f70('0xc')](_0x1f70('0xd'),_0x12c6cc,_0x1f70('0xe'));_0x4861fd(_0x51d6a0[_0x1f70('0x12')][_0x1f70('0x11')]);}})[_0x1f70('0x13')](function(_0x4fd061){logger[_0x1f70('0xf')](_0x1f70('0xd'),_0x12c6cc,_0x4fd061);_0x49d1fa(_0x4fd061);});});}