cfe978eda6c67425fe3fe93dda6f351d9e36ef9b
[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 _0x3d96=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','message','info','result','catch','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3d96,0x14f));var _0x63d9=function(_0x3e6cf0,_0x17f4b8){_0x3e6cf0=_0x3e6cf0-0x0;var _0x32d4d0=_0x3d96[_0x3e6cf0];return _0x32d4d0;};'use strict';var _=require(_0x63d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x63d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63d9('0x2'));var db=require(_0x63d9('0x3'))['db'];var utils=require(_0x63d9('0x4'));var logger=require(_0x63d9('0x5'))(_0x63d9('0x6'));var config=require(_0x63d9('0x7'));var jayson=require(_0x63d9('0x8'));var client=jayson[_0x63d9('0x9')][_0x63d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d991e,_0x341267,_0x4bf315){return new BPromise(function(_0xa38445,_0x3a6ed3){return client[_0x63d9('0xb')](_0x4d991e,_0x4bf315)[_0x63d9('0xc')](function(_0x3494bb){logger['info'](_0x63d9('0xd'),_0x341267,'request\x20sent');logger[_0x63d9('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x341267,'request\x20sent',JSON[_0x63d9('0xf')](_0x3494bb));if(_0x3494bb[_0x63d9('0x10')]){if(_0x3494bb['error']['code']===0x1f4){logger[_0x63d9('0x10')](_0x63d9('0xd'),_0x341267,_0x3494bb[_0x63d9('0x10')][_0x63d9('0x11')]);return _0x3a6ed3(_0x3494bb['error'][_0x63d9('0x11')]);}logger['error'](_0x63d9('0xd'),_0x341267,_0x3494bb[_0x63d9('0x10')][_0x63d9('0x11')]);return _0xa38445(_0x3494bb[_0x63d9('0x10')]['message']);}else{logger[_0x63d9('0x12')](_0x63d9('0xd'),_0x341267,'request\x20sent');_0xa38445(_0x3494bb[_0x63d9('0x13')][_0x63d9('0x11')]);}})[_0x63d9('0x14')](function(_0x532611){logger[_0x63d9('0x10')](_0x63d9('0xd'),_0x341267,_0x532611);_0x3a6ed3(_0x532611);});});}