bf283eca3392a821caa07e1eedc9e04c375b9a1b
[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 _0xf91e=['request\x20sent','debug','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','UserFaxQueue,\x20%s,\x20%s'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xf91e,0x73));var _0xef91=function(_0x328af4,_0x2c985a){_0x328af4=_0x328af4-0x0;var _0x1048a6=_0xf91e[_0x328af4];return _0x1048a6;};'use strict';var _=require(_0xef91('0x0'));var util=require('util');var moment=require(_0xef91('0x1'));var BPromise=require('bluebird');var rs=require(_0xef91('0x2'));var fs=require('fs');var Redis=require(_0xef91('0x3'));var db=require(_0xef91('0x4'))['db'];var utils=require(_0xef91('0x5'));var logger=require(_0xef91('0x6'))('rpc');var config=require(_0xef91('0x7'));var jayson=require(_0xef91('0x8'));var client=jayson['client'][_0xef91('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcf5889,_0xde9285,_0x358a88){return new BPromise(function(_0x5a32c1,_0x3e23a8){return client['request'](_0xcf5889,_0x358a88)['then'](function(_0x278a32){logger['info'](_0xef91('0xa'),_0xde9285,_0xef91('0xb'));logger[_0xef91('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xde9285,_0xef91('0xb'),JSON[_0xef91('0xd')](_0x278a32));if(_0x278a32[_0xef91('0xe')]){if(_0x278a32[_0xef91('0xe')][_0xef91('0xf')]===0x1f4){logger[_0xef91('0xe')](_0xef91('0xa'),_0xde9285,_0x278a32[_0xef91('0xe')][_0xef91('0x10')]);return _0x3e23a8(_0x278a32['error']['message']);}logger['error'](_0xef91('0xa'),_0xde9285,_0x278a32['error'][_0xef91('0x10')]);return _0x5a32c1(_0x278a32['error'][_0xef91('0x10')]);}else{logger['info'](_0xef91('0xa'),_0xde9285,'request\x20sent');_0x5a32c1(_0x278a32[_0xef91('0x11')][_0xef91('0x10')]);}})['catch'](function(_0x40fa3f){logger['error'](_0xef91('0xa'),_0xde9285,_0x40fa3f);_0x3e23a8(_0x40fa3f);});});}