Built motion from commit 953226e6.|2.6.32
[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 _0x8693=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4768c6,_0xff55d6){var _0x41b439=function(_0x9b758c){while(--_0x9b758c){_0x4768c6['push'](_0x4768c6['shift']());}};_0x41b439(++_0xff55d6);}(_0x8693,0x18d));var _0x3869=function(_0x542823,_0x1cf8b2){_0x542823=_0x542823-0x0;var _0x385050=_0x8693[_0x542823];return _0x385050;};'use strict';var _=require(_0x3869('0x0'));var util=require(_0x3869('0x1'));var moment=require(_0x3869('0x2'));var BPromise=require(_0x3869('0x3'));var rs=require(_0x3869('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3869('0x5'));var logger=require(_0x3869('0x6'))('rpc');var config=require(_0x3869('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3869('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x133ac2,_0x4f48ab,_0x2a5c3d){return new BPromise(function(_0x46cb4b,_0x2b4143){return client[_0x3869('0x9')](_0x133ac2,_0x2a5c3d)[_0x3869('0xa')](function(_0x5ee9d0){logger[_0x3869('0xb')](_0x3869('0xc'),_0x4f48ab,_0x3869('0xd'));logger[_0x3869('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4f48ab,'request\x20sent',JSON[_0x3869('0xf')](_0x5ee9d0));if(_0x5ee9d0[_0x3869('0x10')]){if(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x11')]===0x1f4){logger[_0x3869('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f48ab,_0x5ee9d0['error'][_0x3869('0x12')]);return _0x2b4143(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x12')]);}logger['error'](_0x3869('0xc'),_0x4f48ab,_0x5ee9d0[_0x3869('0x10')]['message']);return _0x46cb4b(_0x5ee9d0[_0x3869('0x10')][_0x3869('0x12')]);}else{logger[_0x3869('0xb')](_0x3869('0xc'),_0x4f48ab,_0x3869('0xd'));_0x46cb4b(_0x5ee9d0[_0x3869('0x13')][_0x3869('0x12')]);}})[_0x3869('0x14')](function(_0x3b496a){logger[_0x3869('0x10')](_0x3869('0xc'),_0x4f48ab,_0x3b496a);_0x2b4143(_0x3b496a);});});}exports[_0x3869('0x15')]=function(_0x3c3295){var _0xa4f4c0=this;return new Promise(function(_0xa92dff,_0x1dcfe1){return db[_0x3869('0x16')]['create'](_0x3c3295[_0x3869('0x17')],{'raw':_0x3c3295[_0x3869('0x18')]?_0x3c3295[_0x3869('0x18')][_0x3869('0x19')]===undefined?!![]:![]:!![]})[_0x3869('0xa')](function(_0x23ed08){logger['info'](_0x3869('0x15'),_0x3c3295);logger[_0x3869('0xe')](_0x3869('0x15'),_0x3c3295,JSON[_0x3869('0xf')](_0x23ed08));_0xa92dff(_0x23ed08);})[_0x3869('0x14')](function(_0x4e84cb){logger['error'](_0x3869('0x15'),_0x4e84cb[_0x3869('0x12')],_0x3c3295);_0x1dcfe1(_0xa4f4c0['error'](0x1f4,_0x4e84cb['message']));});});};