2b73342d3f33233f98a9e091cd5366e3b3dde0d8
[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 _0xe0a8=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1a2dd9,_0x1647af){var _0x259a02=function(_0x319c50){while(--_0x319c50){_0x1a2dd9['push'](_0x1a2dd9['shift']());}};_0x259a02(++_0x1647af);}(_0xe0a8,0x161));var _0x8e0a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe0a8[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x8e0a('0x0'));var moment=require(_0x8e0a('0x1'));var BPromise=require(_0x8e0a('0x2'));var rs=require(_0x8e0a('0x3'));var fs=require('fs');var Redis=require(_0x8e0a('0x4'));var db=require(_0x8e0a('0x5'))['db'];var utils=require(_0x8e0a('0x6'));var logger=require(_0x8e0a('0x7'))(_0x8e0a('0x8'));var config=require(_0x8e0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e0a('0xa')][_0x8e0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21c28e,_0x5a43b2,_0x476742){return new BPromise(function(_0x5b5fc4,_0x16c16a){return client[_0x8e0a('0xc')](_0x21c28e,_0x476742)[_0x8e0a('0xd')](function(_0x46cb3b){logger[_0x8e0a('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5a43b2,_0x8e0a('0xf'));logger[_0x8e0a('0x10')](_0x8e0a('0x11'),_0x5a43b2,_0x8e0a('0xf'),JSON['stringify'](_0x46cb3b));if(_0x46cb3b['error']){if(_0x46cb3b[_0x8e0a('0x12')][_0x8e0a('0x13')]===0x1f4){logger[_0x8e0a('0x12')](_0x8e0a('0x14'),_0x5a43b2,_0x46cb3b[_0x8e0a('0x12')]['message']);return _0x16c16a(_0x46cb3b[_0x8e0a('0x12')]['message']);}logger['error'](_0x8e0a('0x14'),_0x5a43b2,_0x46cb3b[_0x8e0a('0x12')]['message']);return _0x5b5fc4(_0x46cb3b['error']['message']);}else{logger[_0x8e0a('0xe')](_0x8e0a('0x14'),_0x5a43b2,'request\x20sent');_0x5b5fc4(_0x46cb3b['result'][_0x8e0a('0x15')]);}})[_0x8e0a('0x16')](function(_0x88a22b){logger[_0x8e0a('0x12')](_0x8e0a('0x14'),_0x5a43b2,_0x88a22b);_0x16c16a(_0x88a22b);});});}