45577ed6c093bf09c25a2a89bbca94c2f5eb8270
[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 _0xb570=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s'];(function(_0x40c25c,_0x25e8eb){var _0x43b5de=function(_0x2c053f){while(--_0x2c053f){_0x40c25c['push'](_0x40c25c['shift']());}};_0x43b5de(++_0x25e8eb);}(_0xb570,0x1a6));var _0x0b57=function(_0x3558ec,_0x1bced9){_0x3558ec=_0x3558ec-0x0;var _0xf2fe09=_0xb570[_0x3558ec];return _0xf2fe09;};'use strict';var _=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var moment=require(_0x0b57('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b57('0x3'));var fs=require('fs');var Redis=require(_0x0b57('0x4'));var db=require(_0x0b57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b57('0x6'))(_0x0b57('0x7'));var config=require(_0x0b57('0x8'));var jayson=require(_0x0b57('0x9'));var client=jayson[_0x0b57('0xa')][_0x0b57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4beea2,_0x43a2a5,_0x1d3cc8){return new BPromise(function(_0x1fc48b,_0x2371a5){return client[_0x0b57('0xc')](_0x4beea2,_0x1d3cc8)[_0x0b57('0xd')](function(_0x24905f){logger['info'](_0x0b57('0xe'),_0x43a2a5,_0x0b57('0xf'));logger[_0x0b57('0x10')](_0x0b57('0x11'),_0x43a2a5,_0x0b57('0xf'),JSON[_0x0b57('0x12')](_0x24905f));if(_0x24905f[_0x0b57('0x13')]){if(_0x24905f['error']['code']===0x1f4){logger[_0x0b57('0x13')](_0x0b57('0xe'),_0x43a2a5,_0x24905f[_0x0b57('0x13')][_0x0b57('0x14')]);return _0x2371a5(_0x24905f[_0x0b57('0x13')][_0x0b57('0x14')]);}logger[_0x0b57('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x43a2a5,_0x24905f[_0x0b57('0x13')][_0x0b57('0x14')]);return _0x1fc48b(_0x24905f[_0x0b57('0x13')][_0x0b57('0x14')]);}else{logger[_0x0b57('0x15')](_0x0b57('0xe'),_0x43a2a5,_0x0b57('0xf'));_0x1fc48b(_0x24905f[_0x0b57('0x16')][_0x0b57('0x14')]);}})['catch'](function(_0x22e65c){logger['error'](_0x0b57('0xe'),_0x43a2a5,_0x22e65c);_0x2371a5(_0x22e65c);});});}