dfe4130c1295bd38f27f846a73e310be88a4bd17
[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 _0x9999=['../../config/logger','rpc','../../config/environment','http','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x169d44,_0x2ab72b){var _0x28e91a=function(_0x944404){while(--_0x944404){_0x169d44['push'](_0x169d44['shift']());}};_0x28e91a(++_0x2ab72b);}(_0x9999,0xaf));var _0x9999=function(_0x54734a,_0x461676){_0x54734a=_0x54734a-0x0;var _0x3e1e93=_0x9999[_0x54734a];return _0x3e1e93;};'use strict';var _=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var moment=require('moment');var BPromise=require(_0x9999('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9999('0x3'));var db=require(_0x9999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9999('0x5'))(_0x9999('0x6'));var config=require(_0x9999('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9999('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16d823,_0x5207ac,_0x12c713){return new BPromise(function(_0x1caca1,_0x5c4d58){return client['request'](_0x16d823,_0x12c713)['then'](function(_0x5cde71){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5207ac,'request\x20sent');logger['debug'](_0x9999('0x9'),_0x5207ac,_0x9999('0xa'),JSON['stringify'](_0x5cde71));if(_0x5cde71['error']){if(_0x5cde71[_0x9999('0xb')][_0x9999('0xc')]===0x1f4){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x5c4d58(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x1caca1(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}else{logger[_0x9999('0xf')](_0x9999('0xd'),_0x5207ac,_0x9999('0xa'));_0x1caca1(_0x5cde71[_0x9999('0x10')][_0x9999('0xe')]);}})[_0x9999('0x11')](function(_0x2693a2){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x2693a2);_0x5c4d58(_0x2693a2);});});}