d52d6f9cb17fc60a8d98364012b9009a4fdbabf7
[motion2.git] / server / api / faxTransferReport / faxTransferReport.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 _0xfbbb=['lodash','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3a7b78,_0x585543){var _0xa36bdd=function(_0xdf3aa1){while(--_0xdf3aa1){_0x3a7b78['push'](_0x3a7b78['shift']());}};_0xa36bdd(++_0x585543);}(_0xfbbb,0x10e));var _0xbfbb=function(_0x2b03c2,_0x1e21dc){_0x2b03c2=_0x2b03c2-0x0;var _0x160b8e=_0xfbbb[_0x2b03c2];return _0x160b8e;};'use strict';var _=require(_0xbfbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbfbb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfbb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfbb('0x3'))('rpc');var config=require(_0xbfbb('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xbfbb('0x5')][_0xbfbb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1492ec,_0x2a748b,_0x3a4b01){return new BPromise(function(_0xe51ed4,_0x422168){return client[_0xbfbb('0x7')](_0x1492ec,_0x3a4b01)[_0xbfbb('0x8')](function(_0x58ba16){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2a748b,'request\x20sent');logger[_0xbfbb('0x9')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2a748b,_0xbfbb('0xa'),JSON[_0xbfbb('0xb')](_0x58ba16));if(_0x58ba16[_0xbfbb('0xc')]){if(_0x58ba16['error']['code']===0x1f4){logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);return _0x422168(_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);}logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);return _0xe51ed4(_0x58ba16[_0xbfbb('0xc')][_0xbfbb('0xe')]);}else{logger[_0xbfbb('0xf')](_0xbfbb('0xd'),_0x2a748b,_0xbfbb('0xa'));_0xe51ed4(_0x58ba16[_0xbfbb('0x10')]['message']);}})[_0xbfbb('0x11')](function(_0x5ea1d4){logger[_0xbfbb('0xc')](_0xbfbb('0xd'),_0x2a748b,_0x5ea1d4);_0x422168(_0x5ea1d4);});});}