Built motion from commit (unavailable).|2.5.22
[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 _0x1c0a=['catch','CreateVoiceTransferReport','VoiceTransferReport','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x534b5a,_0x2ed076){_0x534b5a=_0x534b5a-0x0;var _0x311184=_0x1c0a[_0x534b5a];return _0x311184;};'use strict';var _=require('lodash');var util=require(_0xa1c0('0x0'));var moment=require(_0xa1c0('0x1'));var BPromise=require(_0xa1c0('0x2'));var rs=require(_0xa1c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1c0('0x4'))['db'];var utils=require(_0xa1c0('0x5'));var logger=require(_0xa1c0('0x6'))('rpc');var config=require(_0xa1c0('0x7'));var jayson=require(_0xa1c0('0x8'));var client=jayson[_0xa1c0('0x9')][_0xa1c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f5cf,_0x38a9d4,_0xff6c60){return new BPromise(function(_0x2818a4,_0x5e7146){return client['request'](_0x50f5cf,_0xff6c60)['then'](function(_0x5d386c){logger[_0xa1c0('0xb')](_0xa1c0('0xc'),_0x38a9d4,'request\x20sent');logger[_0xa1c0('0xd')](_0xa1c0('0xe'),_0x38a9d4,'request\x20sent',JSON[_0xa1c0('0xf')](_0x5d386c));if(_0x5d386c['error']){if(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x11')]===0x1f4){logger[_0xa1c0('0x10')](_0xa1c0('0xc'),_0x38a9d4,_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);return _0x5e7146(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);}logger[_0xa1c0('0x10')](_0xa1c0('0xc'),_0x38a9d4,_0x5d386c[_0xa1c0('0x10')]['message']);return _0x2818a4(_0x5d386c[_0xa1c0('0x10')][_0xa1c0('0x12')]);}else{logger[_0xa1c0('0xb')](_0xa1c0('0xc'),_0x38a9d4,_0xa1c0('0x13'));_0x2818a4(_0x5d386c[_0xa1c0('0x14')][_0xa1c0('0x12')]);}})[_0xa1c0('0x15')](function(_0x5c74ba){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x38a9d4,_0x5c74ba);_0x5e7146(_0x5c74ba);});});}exports[_0xa1c0('0x16')]=function(_0x8e871b){var _0x4215c1=this;return new Promise(function(_0x1de2b1,_0x49da8b){return db[_0xa1c0('0x17')]['create'](_0x8e871b['body'],{'raw':_0x8e871b['options']?_0x8e871b[_0xa1c0('0x18')][_0xa1c0('0x19')]===undefined?!![]:![]:!![]})[_0xa1c0('0x1a')](function(_0x122915){logger[_0xa1c0('0xb')](_0xa1c0('0x16'),_0x8e871b);logger[_0xa1c0('0xd')](_0xa1c0('0x16'),_0x8e871b,JSON[_0xa1c0('0xf')](_0x122915));_0x1de2b1(_0x122915);})['catch'](function(_0x51625b){logger[_0xa1c0('0x10')]('CreateVoiceTransferReport',_0x51625b[_0xa1c0('0x12')],_0x8e871b);_0x49da8b(_0x4215c1[_0xa1c0('0x10')](0x1f4,_0x51625b[_0xa1c0('0x12')]));});});};