ead41532782efb1a61559beae009da659c1c84c9
[motion2.git] / server / api / userFaxQueue / userFaxQueue.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 _0x2a23=['jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/environment'];(function(_0x4bf83e,_0x429223){var _0x5647c9=function(_0x195bae){while(--_0x195bae){_0x4bf83e['push'](_0x4bf83e['shift']());}};_0x5647c9(++_0x429223);}(_0x2a23,0x8b));var _0x32a2=function(_0xe76ecb,_0xb6a9e){_0xe76ecb=_0xe76ecb-0x0;var _0x3fcbd9=_0x2a23[_0xe76ecb];return _0x3fcbd9;};'use strict';var _=require(_0x32a2('0x0'));var util=require('util');var moment=require(_0x32a2('0x1'));var BPromise=require(_0x32a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x32a2('0x4'));var jayson=require(_0x32a2('0x5'));var client=jayson[_0x32a2('0x6')][_0x32a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c56db,_0x291076,_0x28e369){return new BPromise(function(_0x51373e,_0x20b3f1){return client['request'](_0x3c56db,_0x28e369)[_0x32a2('0x8')](function(_0x21780b){logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,_0x32a2('0xb'));logger['debug'](_0x32a2('0xc'),_0x291076,_0x32a2('0xb'),JSON['stringify'](_0x21780b));if(_0x21780b[_0x32a2('0xd')]){if(_0x21780b[_0x32a2('0xd')][_0x32a2('0xe')]===0x1f4){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b['error'][_0x32a2('0xf')]);return _0x20b3f1(_0x21780b['error'][_0x32a2('0xf')]);}logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);return _0x51373e(_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);}else{logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,'request\x20sent');_0x51373e(_0x21780b[_0x32a2('0x10')][_0x32a2('0xf')]);}})[_0x32a2('0x11')](function(_0x467c3a){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x467c3a);_0x20b3f1(_0x467c3a);});});}