e6cc14d5c8c8ca61395a8587c98a56b868ed5bb3
[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 _0xa657=['code','UserFaxQueue,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x530f50,_0x5da7d6){var _0x373031=function(_0x23ccf6){while(--_0x23ccf6){_0x530f50['push'](_0x530f50['shift']());}};_0x373031(++_0x5da7d6);}(_0xa657,0xbd));var _0x7a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa657[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7a65('0x0'));var moment=require(_0x7a65('0x1'));var BPromise=require(_0x7a65('0x2'));var rs=require(_0x7a65('0x3'));var fs=require('fs');var Redis=require(_0x7a65('0x4'));var db=require(_0x7a65('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a65('0x6'))(_0x7a65('0x7'));var config=require(_0x7a65('0x8'));var jayson=require(_0x7a65('0x9'));var client=jayson[_0x7a65('0xa')][_0x7a65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a91bb,_0x510801,_0x4ad3a5){return new BPromise(function(_0x5cdd10,_0x4f439b){return client[_0x7a65('0xc')](_0x3a91bb,_0x4ad3a5)[_0x7a65('0xd')](function(_0x4d542c){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x510801,_0x7a65('0xe'));logger[_0x7a65('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x510801,_0x7a65('0xe'),JSON[_0x7a65('0x10')](_0x4d542c));if(_0x4d542c[_0x7a65('0x11')]){if(_0x4d542c['error'][_0x7a65('0x12')]===0x1f4){logger['error'](_0x7a65('0x13'),_0x510801,_0x4d542c['error'][_0x7a65('0x14')]);return _0x4f439b(_0x4d542c[_0x7a65('0x11')]['message']);}logger[_0x7a65('0x11')](_0x7a65('0x13'),_0x510801,_0x4d542c[_0x7a65('0x11')][_0x7a65('0x14')]);return _0x5cdd10(_0x4d542c['error'][_0x7a65('0x14')]);}else{logger[_0x7a65('0x15')](_0x7a65('0x13'),_0x510801,_0x7a65('0xe'));_0x5cdd10(_0x4d542c[_0x7a65('0x16')][_0x7a65('0x14')]);}})['catch'](function(_0x2f5894){logger[_0x7a65('0x11')](_0x7a65('0x13'),_0x510801,_0x2f5894);_0x4f439b(_0x2f5894);});});}