Built motion from commit (unavailable).|2.5.1
[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 _0x9155=['catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x292ecc,_0x2ed340){var _0x59aabc=function(_0x35aa5a){while(--_0x35aa5a){_0x292ecc['push'](_0x292ecc['shift']());}};_0x59aabc(++_0x2ed340);}(_0x9155,0x1ab));var _0x5915=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x9155[_0x134d5e];return _0x1e166a;};'use strict';var _=require('lodash');var util=require(_0x5915('0x0'));var moment=require(_0x5915('0x1'));var BPromise=require(_0x5915('0x2'));var rs=require(_0x5915('0x3'));var fs=require('fs');var Redis=require(_0x5915('0x4'));var db=require(_0x5915('0x5'))['db'];var utils=require(_0x5915('0x6'));var logger=require(_0x5915('0x7'))(_0x5915('0x8'));var config=require('../../config/environment');var jayson=require(_0x5915('0x9'));var client=jayson['client'][_0x5915('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38603c,_0x368b70,_0x4be4c4){return new BPromise(function(_0x19e1a4,_0x5620ec){return client[_0x5915('0xb')](_0x38603c,_0x4be4c4)[_0x5915('0xc')](function(_0x335863){logger[_0x5915('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x5915('0xe'));logger['debug'](_0x5915('0xf'),_0x368b70,_0x5915('0xe'),JSON[_0x5915('0x10')](_0x335863));if(_0x335863[_0x5915('0x11')]){if(_0x335863[_0x5915('0x11')][_0x5915('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x335863['error']['message']);return _0x5620ec(_0x335863[_0x5915('0x11')][_0x5915('0x13')]);}logger[_0x5915('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x368b70,_0x335863['error'][_0x5915('0x13')]);return _0x19e1a4(_0x335863[_0x5915('0x11')][_0x5915('0x13')]);}else{logger[_0x5915('0xd')](_0x5915('0x14'),_0x368b70,_0x5915('0xe'));_0x19e1a4(_0x335863['result']['message']);}})[_0x5915('0x15')](function(_0x2b211f){logger[_0x5915('0x11')](_0x5915('0x14'),_0x368b70,_0x2b211f);_0x5620ec(_0x2b211f);});});}exports['CreateVoiceTransferReport']=function(_0x21b898){var _0x18593a=this;return new Promise(function(_0x59ff87,_0x40f6e0){return db[_0x5915('0x16')][_0x5915('0x17')](_0x21b898[_0x5915('0x18')],{'raw':_0x21b898[_0x5915('0x19')]?_0x21b898['options']['raw']===undefined?!![]:![]:!![]})[_0x5915('0xc')](function(_0x4a456d){logger[_0x5915('0xd')](_0x5915('0x1a'),_0x21b898);logger[_0x5915('0x1b')]('CreateVoiceTransferReport',_0x21b898,JSON[_0x5915('0x10')](_0x4a456d));_0x59ff87(_0x4a456d);})['catch'](function(_0x379430){logger[_0x5915('0x11')](_0x5915('0x1a'),_0x379430[_0x5915('0x13')],_0x21b898);_0x40f6e0(_0x18593a[_0x5915('0x11')](0x1f4,_0x379430[_0x5915('0x13')]));});});};