51ab08059d732c0af2e883aa57d95b4b8f637acc
[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 _0x6f12=['../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f12,0x86));var _0x26f1=function(_0x4bbc76,_0x9401ed){_0x4bbc76=_0x4bbc76-0x0;var _0x228f3b=_0x6f12[_0x4bbc76];return _0x228f3b;};'use strict';var _=require(_0x26f1('0x0'));var util=require('util');var moment=require(_0x26f1('0x1'));var BPromise=require(_0x26f1('0x2'));var rs=require(_0x26f1('0x3'));var fs=require('fs');var Redis=require(_0x26f1('0x4'));var db=require(_0x26f1('0x5'))['db'];var utils=require(_0x26f1('0x6'));var logger=require(_0x26f1('0x7'))(_0x26f1('0x8'));var config=require(_0x26f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x26f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa5c21d,_0x2da597,_0x5047d8){return new BPromise(function(_0x43f47d,_0x4883ad){return client['request'](_0xa5c21d,_0x5047d8)['then'](function(_0x245122){logger[_0x26f1('0xb')](_0x26f1('0xc'),_0x2da597,'request\x20sent');logger[_0x26f1('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2da597,_0x26f1('0xe'),JSON[_0x26f1('0xf')](_0x245122));if(_0x245122['error']){if(_0x245122[_0x26f1('0x10')]['code']===0x1f4){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x4883ad(_0x245122['error'][_0x26f1('0x11')]);}logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x43f47d(_0x245122[_0x26f1('0x10')]['message']);}else{logger['info'](_0x26f1('0xc'),_0x2da597,_0x26f1('0xe'));_0x43f47d(_0x245122[_0x26f1('0x12')][_0x26f1('0x11')]);}})[_0x26f1('0x13')](function(_0x16989){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x16989);_0x4883ad(_0x16989);});});}