Built motion from commit 3c2ce842.|2.6.31
[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 _0x08f9=['message','info','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x278b11,_0xf762a5){var _0x14235c=function(_0x3bc57e){while(--_0x3bc57e){_0x278b11['push'](_0x278b11['shift']());}};_0x14235c(++_0xf762a5);}(_0x08f9,0x191));var _0x908f=function(_0x5caa38,_0x7c4a6c){_0x5caa38=_0x5caa38-0x0;var _0x5b3b8d=_0x08f9[_0x5caa38];return _0x5b3b8d;};'use strict';var _=require(_0x908f('0x0'));var util=require(_0x908f('0x1'));var moment=require('moment');var BPromise=require(_0x908f('0x2'));var rs=require(_0x908f('0x3'));var fs=require('fs');var Redis=require(_0x908f('0x4'));var db=require(_0x908f('0x5'))['db'];var utils=require(_0x908f('0x6'));var logger=require('../../config/logger')(_0x908f('0x7'));var config=require('../../config/environment');var jayson=require(_0x908f('0x8'));var client=jayson[_0x908f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cd744,_0x32aa99,_0x47e8d8){return new BPromise(function(_0x31f11c,_0x20185e){return client[_0x908f('0xa')](_0x5cd744,_0x47e8d8)[_0x908f('0xb')](function(_0x1b9913){logger['info'](_0x908f('0xc'),_0x32aa99,_0x908f('0xd'));logger[_0x908f('0xe')](_0x908f('0xf'),_0x32aa99,_0x908f('0xd'),JSON[_0x908f('0x10')](_0x1b9913));if(_0x1b9913[_0x908f('0x11')]){if(_0x1b9913[_0x908f('0x11')][_0x908f('0x12')]===0x1f4){logger[_0x908f('0x11')](_0x908f('0xc'),_0x32aa99,_0x1b9913[_0x908f('0x11')]['message']);return _0x20185e(_0x1b9913[_0x908f('0x11')][_0x908f('0x13')]);}logger[_0x908f('0x11')](_0x908f('0xc'),_0x32aa99,_0x1b9913[_0x908f('0x11')]['message']);return _0x31f11c(_0x1b9913[_0x908f('0x11')]['message']);}else{logger[_0x908f('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x32aa99,_0x908f('0xd'));_0x31f11c(_0x1b9913['result'][_0x908f('0x13')]);}})[_0x908f('0x15')](function(_0x32f7ca){logger[_0x908f('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x32aa99,_0x32f7ca);_0x20185e(_0x32f7ca);});});}exports['CreateVoiceTransferReport']=function(_0x61a4b4){var _0x12e51d=this;return new Promise(function(_0x278127,_0xd04871){return db[_0x908f('0x16')][_0x908f('0x17')](_0x61a4b4[_0x908f('0x18')],{'raw':_0x61a4b4[_0x908f('0x19')]?_0x61a4b4[_0x908f('0x19')][_0x908f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1797cd){logger['info']('CreateVoiceTransferReport',_0x61a4b4);logger[_0x908f('0xe')]('CreateVoiceTransferReport',_0x61a4b4,JSON[_0x908f('0x10')](_0x1797cd));_0x278127(_0x1797cd);})[_0x908f('0x15')](function(_0x59c436){logger[_0x908f('0x11')](_0x908f('0x1b'),_0x59c436[_0x908f('0x13')],_0x61a4b4);_0xd04871(_0x12e51d[_0x908f('0x11')](0x1f4,_0x59c436[_0x908f('0x13')]));});});};