cbfb0056d5e1ac2ab46e6a2ab653be03349ac28b
[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 _0x536f=['code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e8a11,_0x5a0f8f){var _0x3e4bf5=function(_0x265fbb){while(--_0x265fbb){_0x1e8a11['push'](_0x1e8a11['shift']());}};_0x3e4bf5(++_0x5a0f8f);}(_0x536f,0x102));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf536('0x0'));var moment=require(_0xf536('0x1'));var BPromise=require('bluebird');var rs=require(_0xf536('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf536('0x3'))['db'];var utils=require(_0xf536('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf536('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e58eb,_0x4594c3,_0x2895f0){return new BPromise(function(_0x4f3de3,_0xb8c819){return client[_0xf536('0x6')](_0x1e58eb,_0x2895f0)[_0xf536('0x7')](function(_0x3f1f68){logger[_0xf536('0x8')](_0xf536('0x9'),_0x4594c3,_0xf536('0xa'));logger['debug'](_0xf536('0xb'),_0x4594c3,'request\x20sent',JSON[_0xf536('0xc')](_0x3f1f68));if(_0x3f1f68[_0xf536('0xd')]){if(_0x3f1f68[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger[_0xf536('0xd')](_0xf536('0x9'),_0x4594c3,_0x3f1f68[_0xf536('0xd')][_0xf536('0xf')]);return _0xb8c819(_0x3f1f68['error'][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0x9'),_0x4594c3,_0x3f1f68[_0xf536('0xd')][_0xf536('0xf')]);return _0x4f3de3(_0x3f1f68[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x8')](_0xf536('0x9'),_0x4594c3,'request\x20sent');_0x4f3de3(_0x3f1f68['result'][_0xf536('0xf')]);}})[_0xf536('0x10')](function(_0x8796f9){logger[_0xf536('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x4594c3,_0x8796f9);_0xb8c819(_0x8796f9);});});}