d2e2ae797abdd4d7e288e18b5016d0be868f5308
[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 _0x5e98=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird'];(function(_0x1c5fd8,_0x2e0884){var _0x26de4d=function(_0x3a6543){while(--_0x3a6543){_0x1c5fd8['push'](_0x1c5fd8['shift']());}};_0x26de4d(++_0x2e0884);}(_0x5e98,0x128));var _0x85e9=function(_0xcb481e,_0x4d6aa8){_0xcb481e=_0xcb481e-0x0;var _0x4c6fbd=_0x5e98[_0xcb481e];return _0x4c6fbd;};'use strict';var _=require('lodash');var util=require(_0x85e9('0x0'));var moment=require(_0x85e9('0x1'));var BPromise=require(_0x85e9('0x2'));var rs=require(_0x85e9('0x3'));var fs=require('fs');var Redis=require(_0x85e9('0x4'));var db=require(_0x85e9('0x5'))['db'];var utils=require(_0x85e9('0x6'));var logger=require(_0x85e9('0x7'))(_0x85e9('0x8'));var config=require(_0x85e9('0x9'));var jayson=require(_0x85e9('0xa'));var client=jayson[_0x85e9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174b2e,_0x536df3,_0x157c7d){return new BPromise(function(_0x272234,_0x1176a3){return client[_0x85e9('0xc')](_0x174b2e,_0x157c7d)[_0x85e9('0xd')](function(_0x220879){logger[_0x85e9('0xe')](_0x85e9('0xf'),_0x536df3,'request\x20sent');logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x536df3,'request\x20sent',JSON[_0x85e9('0x10')](_0x220879));if(_0x220879[_0x85e9('0x11')]){if(_0x220879[_0x85e9('0x11')][_0x85e9('0x12')]===0x1f4){logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x220879[_0x85e9('0x11')][_0x85e9('0x13')]);return _0x1176a3(_0x220879[_0x85e9('0x11')]['message']);}logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x220879['error']['message']);return _0x272234(_0x220879[_0x85e9('0x11')][_0x85e9('0x13')]);}else{logger['info'](_0x85e9('0xf'),_0x536df3,_0x85e9('0x14'));_0x272234(_0x220879[_0x85e9('0x15')][_0x85e9('0x13')]);}})[_0x85e9('0x16')](function(_0x3013d9){logger[_0x85e9('0x11')](_0x85e9('0xf'),_0x536df3,_0x3013d9);_0x1176a3(_0x3013d9);});});}