dae9c91dc352ef140f92453175b0f2b607a2ef7c
[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 _0x5a34=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','moment','bluebird','randomstring','ioredis'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x5a34,0x6c));var _0x45a3=function(_0x2164dd,_0x481d8d){_0x2164dd=_0x2164dd-0x0;var _0x20d0d7=_0x5a34[_0x2164dd];return _0x20d0d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x45a3('0x0'));var BPromise=require(_0x45a3('0x1'));var rs=require(_0x45a3('0x2'));var fs=require('fs');var Redis=require(_0x45a3('0x3'));var db=require(_0x45a3('0x4'))['db'];var utils=require(_0x45a3('0x5'));var logger=require(_0x45a3('0x6'))(_0x45a3('0x7'));var config=require(_0x45a3('0x8'));var jayson=require(_0x45a3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebd5f,_0x481c11,_0x1f4808){return new BPromise(function(_0x5dae87,_0x311246){return client[_0x45a3('0xa')](_0x1ebd5f,_0x1f4808)[_0x45a3('0xb')](function(_0xcc1ac8){logger[_0x45a3('0xc')](_0x45a3('0xd'),_0x481c11,_0x45a3('0xe'));logger[_0x45a3('0xf')](_0x45a3('0x10'),_0x481c11,_0x45a3('0xe'),JSON[_0x45a3('0x11')](_0xcc1ac8));if(_0xcc1ac8['error']){if(_0xcc1ac8[_0x45a3('0x12')][_0x45a3('0x13')]===0x1f4){logger[_0x45a3('0x12')](_0x45a3('0xd'),_0x481c11,_0xcc1ac8[_0x45a3('0x12')]['message']);return _0x311246(_0xcc1ac8[_0x45a3('0x12')][_0x45a3('0x14')]);}logger[_0x45a3('0x12')](_0x45a3('0xd'),_0x481c11,_0xcc1ac8[_0x45a3('0x12')][_0x45a3('0x14')]);return _0x5dae87(_0xcc1ac8[_0x45a3('0x12')][_0x45a3('0x14')]);}else{logger['info'](_0x45a3('0xd'),_0x481c11,_0x45a3('0xe'));_0x5dae87(_0xcc1ac8['result'][_0x45a3('0x14')]);}})[_0x45a3('0x15')](function(_0x24027e){logger['error'](_0x45a3('0xd'),_0x481c11,_0x24027e);_0x311246(_0x24027e);});});}exports['CreateVoiceTransferReport']=function(_0x2d0640){var _0x1ec235=this;return new Promise(function(_0x59435d,_0x5ab21b){return db[_0x45a3('0x16')][_0x45a3('0x17')](_0x2d0640[_0x45a3('0x18')],{'raw':_0x2d0640[_0x45a3('0x19')]?_0x2d0640[_0x45a3('0x19')][_0x45a3('0x1a')]===undefined?!![]:![]:!![]})[_0x45a3('0xb')](function(_0x2f8527){logger[_0x45a3('0xc')](_0x45a3('0x1b'),_0x2d0640);logger[_0x45a3('0xf')]('CreateVoiceTransferReport',_0x2d0640,JSON[_0x45a3('0x11')](_0x2f8527));_0x59435d(_0x2f8527);})['catch'](function(_0x4ef791){logger[_0x45a3('0x12')]('CreateVoiceTransferReport',_0x4ef791[_0x45a3('0x14')],_0x2d0640);_0x5ab21b(_0x1ec235[_0x45a3('0x12')](0x1f4,_0x4ef791[_0x45a3('0x14')]));});});};