b5d7e32c4eb39b4baf2dc4a5c1b3c7c66126d02e
[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 _0x34a5=['stringify','error','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34a5,0xc2));var _0x534a=function(_0x3897dc,_0x4d89ec){_0x3897dc=_0x3897dc-0x0;var _0x2a93b7=_0x34a5[_0x3897dc];return _0x2a93b7;};'use strict';var _=require(_0x534a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x534a('0x1'));var fs=require('fs');var Redis=require(_0x534a('0x2'));var db=require(_0x534a('0x3'))['db'];var utils=require(_0x534a('0x4'));var logger=require(_0x534a('0x5'))(_0x534a('0x6'));var config=require(_0x534a('0x7'));var jayson=require(_0x534a('0x8'));var client=jayson[_0x534a('0x9')][_0x534a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b2cd,_0x31a4e7,_0x167ea5){return new BPromise(function(_0x3c85e8,_0x10ebcc){return client['request'](_0x27b2cd,_0x167ea5)[_0x534a('0xb')](function(_0x3d86ff){logger['info'](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));logger[_0x534a('0xe')](_0x534a('0xf'),_0x31a4e7,_0x534a('0xd'),JSON[_0x534a('0x10')](_0x3d86ff));if(_0x3d86ff[_0x534a('0x11')]){if(_0x3d86ff[_0x534a('0x11')]['code']===0x1f4){logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x10ebcc(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x3c85e8(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}else{logger[_0x534a('0x13')](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));_0x3c85e8(_0x3d86ff[_0x534a('0x14')][_0x534a('0x12')]);}})['catch'](function(_0x4f2a7d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x31a4e7,_0x4f2a7d);_0x10ebcc(_0x4f2a7d);});});}