Built motion from commit fe909640.|2.6.8
[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 _0xcf3e=['result','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x29030a,_0x1ad4ce){var _0x16596f=function(_0x3c9bc7){while(--_0x3c9bc7){_0x29030a['push'](_0x29030a['shift']());}};_0x16596f(++_0x1ad4ce);}(_0xcf3e,0x17d));var _0xecf3=function(_0x2e60eb,_0x40d8bc){_0x2e60eb=_0x2e60eb-0x0;var _0x23e3c6=_0xcf3e[_0x2e60eb];return _0x23e3c6;};'use strict';var _=require(_0xecf3('0x0'));var util=require('util');var moment=require(_0xecf3('0x1'));var BPromise=require(_0xecf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecf3('0x4'))(_0xecf3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecf3('0x6')][_0xecf3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d73c7,_0x3ccf30,_0x52b449){return new BPromise(function(_0x2a21e9,_0x1070f4){return client[_0xecf3('0x8')](_0x3d73c7,_0x52b449)[_0xecf3('0x9')](function(_0x4aa602){logger[_0xecf3('0xa')](_0xecf3('0xb'),_0x3ccf30,_0xecf3('0xc'));logger[_0xecf3('0xd')](_0xecf3('0xe'),_0x3ccf30,_0xecf3('0xc'),JSON[_0xecf3('0xf')](_0x4aa602));if(_0x4aa602[_0xecf3('0x10')]){if(_0x4aa602[_0xecf3('0x10')][_0xecf3('0x11')]===0x1f4){logger['error'](_0xecf3('0xb'),_0x3ccf30,_0x4aa602['error'][_0xecf3('0x12')]);return _0x1070f4(_0x4aa602[_0xecf3('0x10')][_0xecf3('0x12')]);}logger[_0xecf3('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x3ccf30,_0x4aa602[_0xecf3('0x10')][_0xecf3('0x12')]);return _0x2a21e9(_0x4aa602[_0xecf3('0x10')][_0xecf3('0x12')]);}else{logger[_0xecf3('0xa')](_0xecf3('0xb'),_0x3ccf30,_0xecf3('0xc'));_0x2a21e9(_0x4aa602[_0xecf3('0x13')][_0xecf3('0x12')]);}})['catch'](function(_0x4528c3){logger['error'](_0xecf3('0xb'),_0x3ccf30,_0x4528c3);_0x1070f4(_0x4528c3);});});}exports['CreateVoiceTransferReport']=function(_0x3b30c0){var _0x29c299=this;return new Promise(function(_0x2743c1,_0x1701f1){return db[_0xecf3('0x14')][_0xecf3('0x15')](_0x3b30c0[_0xecf3('0x16')],{'raw':_0x3b30c0[_0xecf3('0x17')]?_0x3b30c0['options']['raw']===undefined?!![]:![]:!![]})[_0xecf3('0x9')](function(_0x4e106f){logger[_0xecf3('0xa')](_0xecf3('0x18'),_0x3b30c0);logger['debug']('CreateVoiceTransferReport',_0x3b30c0,JSON[_0xecf3('0xf')](_0x4e106f));_0x2743c1(_0x4e106f);})['catch'](function(_0x155e4e){logger[_0xecf3('0x10')]('CreateVoiceTransferReport',_0x155e4e[_0xecf3('0x12')],_0x3b30c0);_0x1701f1(_0x29c299['error'](0x1f4,_0x155e4e[_0xecf3('0x12')]));});});};