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 _0x6b22=['body','options','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceTransferReport'];(function(_0x1b79cd,_0x1e5671){var _0x5cd8b7=function(_0x134fc0){while(--_0x134fc0){_0x1b79cd['push'](_0x1b79cd['shift']());}};_0x5cd8b7(++_0x1e5671);}(_0x6b22,0x183));var _0x26b2=function(_0x1b7786,_0x4d76c2){_0x1b7786=_0x1b7786-0x0;var _0x487abd=_0x6b22[_0x1b7786];return _0x487abd;};'use strict';var _=require('lodash');var util=require(_0x26b2('0x0'));var moment=require(_0x26b2('0x1'));var BPromise=require(_0x26b2('0x2'));var rs=require(_0x26b2('0x3'));var fs=require('fs');var Redis=require(_0x26b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x26b2('0x6'));var client=jayson[_0x26b2('0x7')][_0x26b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x494291,_0x2e4506,_0x18eacd){return new BPromise(function(_0xca55bf,_0x361127){return client[_0x26b2('0x9')](_0x494291,_0x18eacd)[_0x26b2('0xa')](function(_0x5981fa){logger[_0x26b2('0xb')](_0x26b2('0xc'),_0x2e4506,_0x26b2('0xd'));logger[_0x26b2('0xe')](_0x26b2('0xf'),_0x2e4506,'request\x20sent',JSON[_0x26b2('0x10')](_0x5981fa));if(_0x5981fa[_0x26b2('0x11')]){if(_0x5981fa['error']['code']===0x1f4){logger[_0x26b2('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e4506,_0x5981fa['error'][_0x26b2('0x12')]);return _0x361127(_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);}logger['error'](_0x26b2('0xc'),_0x2e4506,_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);return _0xca55bf(_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);}else{logger[_0x26b2('0xb')](_0x26b2('0xc'),_0x2e4506,_0x26b2('0xd'));_0xca55bf(_0x5981fa['result']['message']);}})[_0x26b2('0x13')](function(_0x1cc549){logger[_0x26b2('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e4506,_0x1cc549);_0x361127(_0x1cc549);});});}exports['CreateVoiceTransferReport']=function(_0x134c4c){var _0x306e9=this;return new Promise(function(_0x1eb88a,_0x3ab902){return db[_0x26b2('0x14')]['create'](_0x134c4c[_0x26b2('0x15')],{'raw':_0x134c4c[_0x26b2('0x16')]?_0x134c4c[_0x26b2('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x14dd25){logger[_0x26b2('0xb')](_0x26b2('0x17'),_0x134c4c);logger['debug'](_0x26b2('0x17'),_0x134c4c,JSON[_0x26b2('0x10')](_0x14dd25));_0x1eb88a(_0x14dd25);})[_0x26b2('0x13')](function(_0x57320c){logger[_0x26b2('0x11')](_0x26b2('0x17'),_0x57320c[_0x26b2('0x12')],_0x134c4c);_0x3ab902(_0x306e9[_0x26b2('0x11')](0x1f4,_0x57320c[_0x26b2('0x12')]));});});};