ad4363613a7902faa39874e3beb755909570899a
[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 _0x758a=['bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment'];(function(_0x36e586,_0x238b7e){var _0xc45bf5=function(_0x3316be){while(--_0x3316be){_0x36e586['push'](_0x36e586['shift']());}};_0xc45bf5(++_0x238b7e);}(_0x758a,0x1d1));var _0xa758=function(_0x13093c,_0xe2a105){_0x13093c=_0x13093c-0x0;var _0x53743d=_0x758a[_0x13093c];return _0x53743d;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var moment=require(_0xa758('0x2'));var BPromise=require(_0xa758('0x3'));var rs=require(_0xa758('0x4'));var fs=require('fs');var Redis=require(_0xa758('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa758('0x6'));var config=require('../../config/environment');var jayson=require(_0xa758('0x7'));var client=jayson[_0xa758('0x8')][_0xa758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57bdd1,_0x4b0de4,_0x6c8d0c){return new BPromise(function(_0x377e5e,_0x7bfa2c){return client[_0xa758('0xa')](_0x57bdd1,_0x6c8d0c)[_0xa758('0xb')](function(_0x44098b){logger['info'](_0xa758('0xc'),_0x4b0de4,'request\x20sent');logger['debug'](_0xa758('0xd'),_0x4b0de4,_0xa758('0xe'),JSON['stringify'](_0x44098b));if(_0x44098b[_0xa758('0xf')]){if(_0x44098b[_0xa758('0xf')][_0xa758('0x10')]===0x1f4){logger[_0xa758('0xf')](_0xa758('0xc'),_0x4b0de4,_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);return _0x7bfa2c(_0x44098b['error']['message']);}logger[_0xa758('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x4b0de4,_0x44098b['error'][_0xa758('0x11')]);return _0x377e5e(_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4b0de4,_0xa758('0xe'));_0x377e5e(_0x44098b['result'][_0xa758('0x11')]);}})['catch'](function(_0x1da460){logger['error'](_0xa758('0xc'),_0x4b0de4,_0x1da460);_0x7bfa2c(_0x1da460);});});}