Built motion from commit 9d0783e6.|2.6.13
[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 _0x5908=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x11f7fc,_0x1545da){var _0x445244=function(_0x4ef0a5){while(--_0x4ef0a5){_0x11f7fc['push'](_0x11f7fc['shift']());}};_0x445244(++_0x1545da);}(_0x5908,0x117));var _0x8590=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5908[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var moment=require('moment');var BPromise=require(_0x8590('0x2'));var rs=require(_0x8590('0x3'));var fs=require('fs');var Redis=require(_0x8590('0x4'));var db=require(_0x8590('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8590('0x6'));var jayson=require(_0x8590('0x7'));var client=jayson[_0x8590('0x8')][_0x8590('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e715,_0x5ab846,_0x1cba4e){return new BPromise(function(_0x1f6653,_0x165e84){return client['request'](_0x44e715,_0x1cba4e)[_0x8590('0xa')](function(_0x4ffd84){logger[_0x8590('0xb')](_0x8590('0xc'),_0x5ab846,_0x8590('0xd'));logger['debug'](_0x8590('0xe'),_0x5ab846,_0x8590('0xd'),JSON[_0x8590('0xf')](_0x4ffd84));if(_0x4ffd84[_0x8590('0x10')]){if(_0x4ffd84[_0x8590('0x10')][_0x8590('0x11')]===0x1f4){logger[_0x8590('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x5ab846,_0x4ffd84[_0x8590('0x10')]['message']);return _0x165e84(_0x4ffd84[_0x8590('0x10')][_0x8590('0x12')]);}logger['error'](_0x8590('0xc'),_0x5ab846,_0x4ffd84['error'][_0x8590('0x12')]);return _0x1f6653(_0x4ffd84['error'][_0x8590('0x12')]);}else{logger[_0x8590('0xb')](_0x8590('0xc'),_0x5ab846,_0x8590('0xd'));_0x1f6653(_0x4ffd84[_0x8590('0x13')][_0x8590('0x12')]);}})['catch'](function(_0x31c310){logger[_0x8590('0x10')](_0x8590('0xc'),_0x5ab846,_0x31c310);_0x165e84(_0x31c310);});});}