46be29d489646ff9fa0722d5e6f94825e0ef432f
[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 _0xbc57=['code','message','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x111a9d,_0x401ebf){var _0x52e632=function(_0x573703){while(--_0x573703){_0x111a9d['push'](_0x111a9d['shift']());}};_0x52e632(++_0x401ebf);}(_0xbc57,0x10d));var _0x7bc5=function(_0x110596,_0x1faae7){_0x110596=_0x110596-0x0;var _0x51fef2=_0xbc57[_0x110596];return _0x51fef2;};'use strict';var _=require('lodash');var util=require(_0x7bc5('0x0'));var moment=require('moment');var BPromise=require(_0x7bc5('0x1'));var rs=require(_0x7bc5('0x2'));var fs=require('fs');var Redis=require(_0x7bc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc5('0x4'))(_0x7bc5('0x5'));var config=require(_0x7bc5('0x6'));var jayson=require(_0x7bc5('0x7'));var client=jayson['client'][_0x7bc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x342c1b,_0x5b1cb5,_0x46b80a){return new BPromise(function(_0x267234,_0x2d140b){return client[_0x7bc5('0x9')](_0x342c1b,_0x46b80a)[_0x7bc5('0xa')](function(_0x194988){logger[_0x7bc5('0xb')](_0x7bc5('0xc'),_0x5b1cb5,_0x7bc5('0xd'));logger[_0x7bc5('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5b1cb5,'request\x20sent',JSON['stringify'](_0x194988));if(_0x194988[_0x7bc5('0xf')]){if(_0x194988['error'][_0x7bc5('0x10')]===0x1f4){logger['error'](_0x7bc5('0xc'),_0x5b1cb5,_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);return _0x2d140b(_0x194988[_0x7bc5('0xf')]['message']);}logger[_0x7bc5('0xf')](_0x7bc5('0xc'),_0x5b1cb5,_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);return _0x267234(_0x194988[_0x7bc5('0xf')][_0x7bc5('0x11')]);}else{logger[_0x7bc5('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x5b1cb5,_0x7bc5('0xd'));_0x267234(_0x194988['result'][_0x7bc5('0x11')]);}})[_0x7bc5('0x12')](function(_0x2540d3){logger[_0x7bc5('0xf')](_0x7bc5('0xc'),_0x5b1cb5,_0x2540d3);_0x2d140b(_0x2540d3);});});}