Built motion from commit 0900f080.|2.5.45
[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 _0x3159=['result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x3718b4,_0x278960){var _0x38531a=function(_0x28da80){while(--_0x28da80){_0x3718b4['push'](_0x3718b4['shift']());}};_0x38531a(++_0x278960);}(_0x3159,0x13d));var _0x9315=function(_0x25c9d6,_0x589d97){_0x25c9d6=_0x25c9d6-0x0;var _0x464a11=_0x3159[_0x25c9d6];return _0x464a11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9315('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9315('0x1'));var db=require(_0x9315('0x2'))['db'];var utils=require(_0x9315('0x3'));var logger=require(_0x9315('0x4'))(_0x9315('0x5'));var config=require(_0x9315('0x6'));var jayson=require(_0x9315('0x7'));var client=jayson[_0x9315('0x8')][_0x9315('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a4a5,_0x36c49c,_0x5ae538){return new BPromise(function(_0x25b5fe,_0xeca61d){return client['request'](_0x46a4a5,_0x5ae538)[_0x9315('0xa')](function(_0xf10591){logger[_0x9315('0xb')](_0x9315('0xc'),_0x36c49c,'request\x20sent');logger[_0x9315('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x36c49c,_0x9315('0xe'),JSON[_0x9315('0xf')](_0xf10591));if(_0xf10591[_0x9315('0x10')]){if(_0xf10591[_0x9315('0x10')][_0x9315('0x11')]===0x1f4){logger['error'](_0x9315('0xc'),_0x36c49c,_0xf10591['error'][_0x9315('0x12')]);return _0xeca61d(_0xf10591[_0x9315('0x10')][_0x9315('0x12')]);}logger[_0x9315('0x10')](_0x9315('0xc'),_0x36c49c,_0xf10591[_0x9315('0x10')][_0x9315('0x12')]);return _0x25b5fe(_0xf10591['error']['message']);}else{logger[_0x9315('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x36c49c,_0x9315('0xe'));_0x25b5fe(_0xf10591[_0x9315('0x13')][_0x9315('0x12')]);}})[_0x9315('0x14')](function(_0x2b2ac7){logger['error'](_0x9315('0xc'),_0x36c49c,_0x2b2ac7);_0xeca61d(_0x2b2ac7);});});}