Built motion from commit (unavailable).|2.5.4
[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 _0x1918=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','info'];(function(_0x578349,_0x5b30f7){var _0x267797=function(_0x5634f2){while(--_0x5634f2){_0x578349['push'](_0x578349['shift']());}};_0x267797(++_0x5b30f7);}(_0x1918,0x1dd));var _0x8191=function(_0x10a6fe,_0x5abc85){_0x10a6fe=_0x10a6fe-0x0;var _0x3da6e6=_0x1918[_0x10a6fe];return _0x3da6e6;};'use strict';var _=require('lodash');var util=require(_0x8191('0x0'));var moment=require(_0x8191('0x1'));var BPromise=require('bluebird');var rs=require(_0x8191('0x2'));var fs=require('fs');var Redis=require(_0x8191('0x3'));var db=require(_0x8191('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8191('0x5'))(_0x8191('0x6'));var config=require(_0x8191('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8191('0x8')][_0x8191('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d6875,_0xb13ab7,_0x327e99){return new BPromise(function(_0x43afca,_0x146176){return client['request'](_0x4d6875,_0x327e99)['then'](function(_0x2e34b9){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0xb13ab7,_0x8191('0xa'));logger['debug'](_0x8191('0xb'),_0xb13ab7,'request\x20sent',JSON['stringify'](_0x2e34b9));if(_0x2e34b9['error']){if(_0x2e34b9[_0x8191('0xc')][_0x8191('0xd')]===0x1f4){logger[_0x8191('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0xb13ab7,_0x2e34b9['error']['message']);return _0x146176(_0x2e34b9[_0x8191('0xc')]['message']);}logger[_0x8191('0xc')](_0x8191('0xe'),_0xb13ab7,_0x2e34b9[_0x8191('0xc')][_0x8191('0xf')]);return _0x43afca(_0x2e34b9['error'][_0x8191('0xf')]);}else{logger[_0x8191('0x10')](_0x8191('0xe'),_0xb13ab7,_0x8191('0xa'));_0x43afca(_0x2e34b9[_0x8191('0x11')][_0x8191('0xf')]);}})[_0x8191('0x12')](function(_0x564af4){logger['error'](_0x8191('0xe'),_0xb13ab7,_0x564af4);_0x146176(_0x564af4);});});}