Built motion from commit ddca4d0d.|2.5.47
[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 _0x441b=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x335a68,_0x536293){var _0x5d26d8=function(_0x1533e3){while(--_0x1533e3){_0x335a68['push'](_0x335a68['shift']());}};_0x5d26d8(++_0x536293);}(_0x441b,0x197));var _0xb441=function(_0x3cb8e3,_0x58376d){_0x3cb8e3=_0x3cb8e3-0x0;var _0x1cb9d2=_0x441b[_0x3cb8e3];return _0x1cb9d2;};'use strict';var _=require('lodash');var util=require(_0xb441('0x0'));var moment=require(_0xb441('0x1'));var BPromise=require(_0xb441('0x2'));var rs=require(_0xb441('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb441('0x4'));var logger=require(_0xb441('0x5'))(_0xb441('0x6'));var config=require(_0xb441('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb441('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb572,_0x3fbafe,_0x47ca98){return new BPromise(function(_0x1f8f9d,_0x18b49c){return client[_0xb441('0x9')](_0x5eb572,_0x47ca98)[_0xb441('0xa')](function(_0x162265){logger[_0xb441('0xb')](_0xb441('0xc'),_0x3fbafe,_0xb441('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3fbafe,_0xb441('0xd'),JSON[_0xb441('0xe')](_0x162265));if(_0x162265['error']){if(_0x162265[_0xb441('0xf')][_0xb441('0x10')]===0x1f4){logger[_0xb441('0xf')](_0xb441('0xc'),_0x3fbafe,_0x162265[_0xb441('0xf')][_0xb441('0x11')]);return _0x18b49c(_0x162265[_0xb441('0xf')]['message']);}logger[_0xb441('0xf')](_0xb441('0xc'),_0x3fbafe,_0x162265[_0xb441('0xf')][_0xb441('0x11')]);return _0x1f8f9d(_0x162265['error']['message']);}else{logger[_0xb441('0xb')](_0xb441('0xc'),_0x3fbafe,_0xb441('0xd'));_0x1f8f9d(_0x162265['result'][_0xb441('0x11')]);}})[_0xb441('0x12')](function(_0x41873e){logger[_0xb441('0xf')](_0xb441('0xc'),_0x3fbafe,_0x41873e);_0x18b49c(_0x41873e);});});}