89290cab16b91863d732a8843569526d1ebbb262
[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 _0x328e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x328e,0xbe));var _0xe328=function(_0x28c3fc,_0x47ef1a){_0x28c3fc=_0x28c3fc-0x0;var _0x40a168=_0x328e[_0x28c3fc];return _0x40a168;};'use strict';var _=require(_0xe328('0x0'));var util=require(_0xe328('0x1'));var moment=require(_0xe328('0x2'));var BPromise=require(_0xe328('0x3'));var rs=require(_0xe328('0x4'));var fs=require('fs');var Redis=require(_0xe328('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe328('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe328('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe328('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac421,_0x5601b3,_0x4dc0a5){return new BPromise(function(_0x20c048,_0x1fc465){return client[_0xe328('0x9')](_0x2ac421,_0x4dc0a5)['then'](function(_0x4b4e29){logger[_0xe328('0xa')](_0xe328('0xb'),_0x5601b3,_0xe328('0xc'));logger[_0xe328('0xd')](_0xe328('0xe'),_0x5601b3,_0xe328('0xc'),JSON[_0xe328('0xf')](_0x4b4e29));if(_0x4b4e29[_0xe328('0x10')]){if(_0x4b4e29[_0xe328('0x10')][_0xe328('0x11')]===0x1f4){logger[_0xe328('0x10')](_0xe328('0xb'),_0x5601b3,_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);return _0x1fc465(_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);}logger[_0xe328('0x10')](_0xe328('0xb'),_0x5601b3,_0x4b4e29[_0xe328('0x10')]['message']);return _0x20c048(_0x4b4e29[_0xe328('0x10')][_0xe328('0x12')]);}else{logger['info'](_0xe328('0xb'),_0x5601b3,_0xe328('0xc'));_0x20c048(_0x4b4e29[_0xe328('0x13')]['message']);}})[_0xe328('0x14')](function(_0x12f317){logger['error'](_0xe328('0xb'),_0x5601b3,_0x12f317);_0x1fc465(_0x12f317);});});}