Built motion from commit (unavailable).|2.5.21
[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 _0xe489=['error','code','message','result','catch','CreateVoiceTransferReport','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x526342,_0x2bb5b4){var _0x1b4281=function(_0x4fd58a){while(--_0x4fd58a){_0x526342['push'](_0x526342['shift']());}};_0x1b4281(++_0x2bb5b4);}(_0xe489,0x9e));var _0x9e48=function(_0x4761e1,_0xc5aa43){_0x4761e1=_0x4761e1-0x0;var _0x257752=_0xe489[_0x4761e1];return _0x257752;};'use strict';var _=require(_0x9e48('0x0'));var util=require(_0x9e48('0x1'));var moment=require('moment');var BPromise=require(_0x9e48('0x2'));var rs=require(_0x9e48('0x3'));var fs=require('fs');var Redis=require(_0x9e48('0x4'));var db=require(_0x9e48('0x5'))['db'];var utils=require(_0x9e48('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e48('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9e48('0x8')][_0x9e48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x131ac9,_0x2aebbc,_0x4b9d5e){return new BPromise(function(_0xe2bf21,_0x2bd87b){return client[_0x9e48('0xa')](_0x131ac9,_0x4b9d5e)[_0x9e48('0xb')](function(_0x66b4f9){logger['info'](_0x9e48('0xc'),_0x2aebbc,_0x9e48('0xd'));logger[_0x9e48('0xe')](_0x9e48('0xf'),_0x2aebbc,'request\x20sent',JSON[_0x9e48('0x10')](_0x66b4f9));if(_0x66b4f9[_0x9e48('0x11')]){if(_0x66b4f9[_0x9e48('0x11')][_0x9e48('0x12')]===0x1f4){logger[_0x9e48('0x11')](_0x9e48('0xc'),_0x2aebbc,_0x66b4f9[_0x9e48('0x11')][_0x9e48('0x13')]);return _0x2bd87b(_0x66b4f9[_0x9e48('0x11')]['message']);}logger['error'](_0x9e48('0xc'),_0x2aebbc,_0x66b4f9[_0x9e48('0x11')]['message']);return _0xe2bf21(_0x66b4f9['error'][_0x9e48('0x13')]);}else{logger['info'](_0x9e48('0xc'),_0x2aebbc,'request\x20sent');_0xe2bf21(_0x66b4f9[_0x9e48('0x14')][_0x9e48('0x13')]);}})[_0x9e48('0x15')](function(_0xb54af7){logger['error'](_0x9e48('0xc'),_0x2aebbc,_0xb54af7);_0x2bd87b(_0xb54af7);});});}exports[_0x9e48('0x16')]=function(_0x55b9ec){var _0x12c133=this;return new Promise(function(_0x882523,_0x18a632){return db['VoiceTransferReport']['create'](_0x55b9ec[_0x9e48('0x17')],{'raw':_0x55b9ec[_0x9e48('0x18')]?_0x55b9ec[_0x9e48('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9e48('0xb')](function(_0x50b310){logger['info'](_0x9e48('0x16'),_0x55b9ec);logger[_0x9e48('0xe')](_0x9e48('0x16'),_0x55b9ec,JSON[_0x9e48('0x10')](_0x50b310));_0x882523(_0x50b310);})[_0x9e48('0x15')](function(_0x572a63){logger[_0x9e48('0x11')](_0x9e48('0x16'),_0x572a63[_0x9e48('0x13')],_0x55b9ec);_0x18a632(_0x12c133[_0x9e48('0x11')](0x1f4,_0x572a63[_0x9e48('0x13')]));});});};