Built motion from commit (unavailable).|2.5.4
[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 _0x4d34=['stringify','code','error','message','body','options','raw','then','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4d34,0x16e));var _0x44d3=function(_0x1b5de6,_0x5dd31a){_0x1b5de6=_0x1b5de6-0x0;var _0x348cac=_0x4d34[_0x1b5de6];return _0x348cac;};'use strict';var _=require(_0x44d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44d3('0x1'));var fs=require('fs');var Redis=require(_0x44d3('0x2'));var db=require(_0x44d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x44d3('0x4'))('rpc');var config=require(_0x44d3('0x5'));var jayson=require(_0x44d3('0x6'));var client=jayson['client'][_0x44d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e63f5,_0x48944d,_0x52a60e){return new BPromise(function(_0x1869cf,_0x3709a3){return client['request'](_0x5e63f5,_0x52a60e)['then'](function(_0x6f4d33){logger[_0x44d3('0x8')](_0x44d3('0x9'),_0x48944d,_0x44d3('0xa'));logger[_0x44d3('0xb')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x48944d,'request\x20sent',JSON[_0x44d3('0xc')](_0x6f4d33));if(_0x6f4d33['error']){if(_0x6f4d33['error'][_0x44d3('0xd')]===0x1f4){logger['error'](_0x44d3('0x9'),_0x48944d,_0x6f4d33[_0x44d3('0xe')][_0x44d3('0xf')]);return _0x3709a3(_0x6f4d33[_0x44d3('0xe')]['message']);}logger[_0x44d3('0xe')](_0x44d3('0x9'),_0x48944d,_0x6f4d33['error']['message']);return _0x1869cf(_0x6f4d33[_0x44d3('0xe')][_0x44d3('0xf')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x48944d,'request\x20sent');_0x1869cf(_0x6f4d33['result'][_0x44d3('0xf')]);}})['catch'](function(_0x4ba566){logger[_0x44d3('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x48944d,_0x4ba566);_0x3709a3(_0x4ba566);});});}exports['CreateVoiceTransferReport']=function(_0x2b3ded){var _0xb69de6=this;return new Promise(function(_0x25f6f1,_0x38502a){return db['VoiceTransferReport']['create'](_0x2b3ded[_0x44d3('0x10')],{'raw':_0x2b3ded['options']?_0x2b3ded[_0x44d3('0x11')][_0x44d3('0x12')]===undefined?!![]:![]:!![]})[_0x44d3('0x13')](function(_0x15a626){logger[_0x44d3('0x8')]('CreateVoiceTransferReport',_0x2b3ded);logger[_0x44d3('0xb')]('CreateVoiceTransferReport',_0x2b3ded,JSON[_0x44d3('0xc')](_0x15a626));_0x25f6f1(_0x15a626);})[_0x44d3('0x14')](function(_0x15e3d6){logger['error']('CreateVoiceTransferReport',_0x15e3d6[_0x44d3('0xf')],_0x2b3ded);_0x38502a(_0xb69de6[_0x44d3('0xe')](0x1f4,_0x15e3d6[_0x44d3('0xf')]));});});};