b9504a38748e0714ae63d26c828d6d3d31b898b7
[motion2.git] / server / api / voiceTransferReport / voiceTransferReport.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 _0xa764=['request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa764,0x1a4));var _0x4a76=function(_0xe36276,_0x52f69e){_0xe36276=_0xe36276-0x0;var _0x4fdde2=_0xa764[_0xe36276];return _0x4fdde2;};'use strict';var _=require(_0x4a76('0x0'));var util=require(_0x4a76('0x1'));var moment=require(_0x4a76('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a76('0x3'));var fs=require('fs');var Redis=require(_0x4a76('0x4'));var db=require(_0x4a76('0x5'))['db'];var utils=require(_0x4a76('0x6'));var logger=require(_0x4a76('0x7'))(_0x4a76('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a76('0x9'));var client=jayson[_0x4a76('0xa')][_0x4a76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x598438,_0x15417e,_0x190b59){return new BPromise(function(_0x5005f0,_0x4bfaa8){return client[_0x4a76('0xc')](_0x598438,_0x190b59)['then'](function(_0x5c5ca2){logger[_0x4a76('0xd')](_0x4a76('0xe'),_0x15417e,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x15417e,_0x4a76('0xf'),JSON[_0x4a76('0x10')](_0x5c5ca2));if(_0x5c5ca2[_0x4a76('0x11')]){if(_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x12')]===0x1f4){logger[_0x4a76('0x11')](_0x4a76('0xe'),_0x15417e,_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x13')]);return _0x4bfaa8(_0x5c5ca2['error'][_0x4a76('0x13')]);}logger['error'](_0x4a76('0xe'),_0x15417e,_0x5c5ca2[_0x4a76('0x11')]['message']);return _0x5005f0(_0x5c5ca2[_0x4a76('0x11')][_0x4a76('0x13')]);}else{logger[_0x4a76('0xd')](_0x4a76('0xe'),_0x15417e,_0x4a76('0xf'));_0x5005f0(_0x5c5ca2['result'][_0x4a76('0x13')]);}})[_0x4a76('0x14')](function(_0x229318){logger[_0x4a76('0x11')](_0x4a76('0xe'),_0x15417e,_0x229318);_0x4bfaa8(_0x229318);});});}exports['CreateVoiceTransferReport']=function(_0xeb25d7){var _0x4b6335=this;return new Promise(function(_0x2251d5,_0xf05555){return db[_0x4a76('0x15')][_0x4a76('0x16')](_0xeb25d7[_0x4a76('0x17')],{'raw':_0xeb25d7[_0x4a76('0x18')]?_0xeb25d7['options'][_0x4a76('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48c0fe){logger[_0x4a76('0xd')]('CreateVoiceTransferReport',_0xeb25d7);logger[_0x4a76('0x1a')]('CreateVoiceTransferReport',_0xeb25d7,JSON['stringify'](_0x48c0fe));_0x2251d5(_0x48c0fe);})['catch'](function(_0x5de819){logger[_0x4a76('0x11')]('CreateVoiceTransferReport',_0x5de819[_0x4a76('0x13')],_0xeb25d7);_0xf05555(_0x4b6335[_0x4a76('0x11')](0x1f4,_0x5de819[_0x4a76('0x13')]));});});};