Built motion from commit (unavailable).|2.3.6
[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 _0xc66a=['client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3d5ac1,_0x578155){var _0x3d2604=function(_0x4f0503){while(--_0x4f0503){_0x3d5ac1['push'](_0x3d5ac1['shift']());}};_0x3d2604(++_0x578155);}(_0xc66a,0x186));var _0xac66=function(_0x253088,_0x294072){_0x253088=_0x253088-0x0;var _0x3950f0=_0xc66a[_0x253088];return _0x3950f0;};'use strict';var _=require(_0xac66('0x0'));var util=require(_0xac66('0x1'));var moment=require(_0xac66('0x2'));var BPromise=require('bluebird');var rs=require(_0xac66('0x3'));var fs=require('fs');var Redis=require(_0xac66('0x4'));var db=require(_0xac66('0x5'))['db'];var utils=require(_0xac66('0x6'));var logger=require(_0xac66('0x7'))(_0xac66('0x8'));var config=require('../../config/environment');var jayson=require(_0xac66('0x9'));var client=jayson[_0xac66('0xa')][_0xac66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5553f1,_0x1345dd,_0x556b69){return new BPromise(function(_0x489314,_0x10645e){return client['request'](_0x5553f1,_0x556b69)[_0xac66('0xc')](function(_0x4a59de){logger[_0xac66('0xd')](_0xac66('0xe'),_0x1345dd,_0xac66('0xf'));logger[_0xac66('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1345dd,_0xac66('0xf'),JSON[_0xac66('0x11')](_0x4a59de));if(_0x4a59de[_0xac66('0x12')]){if(_0x4a59de[_0xac66('0x12')]['code']===0x1f4){logger[_0xac66('0x12')](_0xac66('0xe'),_0x1345dd,_0x4a59de['error']['message']);return _0x10645e(_0x4a59de[_0xac66('0x12')]['message']);}logger[_0xac66('0x12')](_0xac66('0xe'),_0x1345dd,_0x4a59de[_0xac66('0x12')][_0xac66('0x13')]);return _0x489314(_0x4a59de[_0xac66('0x12')]['message']);}else{logger[_0xac66('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x1345dd,_0xac66('0xf'));_0x489314(_0x4a59de[_0xac66('0x14')][_0xac66('0x13')]);}})[_0xac66('0x15')](function(_0x3c922d){logger[_0xac66('0x12')](_0xac66('0xe'),_0x1345dd,_0x3c922d);_0x10645e(_0x3c922d);});});}exports[_0xac66('0x16')]=function(_0x46d099){var _0x53613d=this;return new Promise(function(_0x31180d,_0xe8dcfc){return db[_0xac66('0x17')]['create'](_0x46d099['body'],{'raw':_0x46d099['options']?_0x46d099['options'][_0xac66('0x18')]===undefined?!![]:![]:!![]})[_0xac66('0xc')](function(_0x33bf33){logger[_0xac66('0xd')](_0xac66('0x16'),_0x46d099);logger['debug'](_0xac66('0x16'),_0x46d099,JSON[_0xac66('0x11')](_0x33bf33));_0x31180d(_0x33bf33);})[_0xac66('0x15')](function(_0x471930){logger['error'](_0xac66('0x16'),_0x471930[_0xac66('0x13')],_0x46d099);_0xe8dcfc(_0x53613d[_0xac66('0x12')](0x1f4,_0x471930[_0xac66('0x13')]));});});};