Built motion from commit da617fac.|2.6.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 _0xca76=['then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateVoiceTransferReport','body','options','raw'];(function(_0x39691f,_0x24849b){var _0xbf563b=function(_0x3b942d){while(--_0x3b942d){_0x39691f['push'](_0x39691f['shift']());}};_0xbf563b(++_0x24849b);}(_0xca76,0x1b5));var _0x6ca7=function(_0x5b7ce8,_0x596ff7){_0x5b7ce8=_0x5b7ce8-0x0;var _0x1d5354=_0xca76[_0x5b7ce8];return _0x1d5354;};'use strict';var _=require(_0x6ca7('0x0'));var util=require(_0x6ca7('0x1'));var moment=require(_0x6ca7('0x2'));var BPromise=require(_0x6ca7('0x3'));var rs=require(_0x6ca7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ca7('0x5'))['db'];var utils=require(_0x6ca7('0x6'));var logger=require(_0x6ca7('0x7'))(_0x6ca7('0x8'));var config=require(_0x6ca7('0x9'));var jayson=require(_0x6ca7('0xa'));var client=jayson[_0x6ca7('0xb')][_0x6ca7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x110c67,_0xb380e5,_0x4fc5de){return new BPromise(function(_0x664f96,_0x32dad1){return client[_0x6ca7('0xd')](_0x110c67,_0x4fc5de)['then'](function(_0x218e46){logger[_0x6ca7('0xe')](_0x6ca7('0xf'),_0xb380e5,'request\x20sent');logger[_0x6ca7('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xb380e5,_0x6ca7('0x11'),JSON[_0x6ca7('0x12')](_0x218e46));if(_0x218e46[_0x6ca7('0x13')]){if(_0x218e46[_0x6ca7('0x13')][_0x6ca7('0x14')]===0x1f4){logger[_0x6ca7('0x13')](_0x6ca7('0xf'),_0xb380e5,_0x218e46[_0x6ca7('0x13')][_0x6ca7('0x15')]);return _0x32dad1(_0x218e46[_0x6ca7('0x13')]['message']);}logger[_0x6ca7('0x13')](_0x6ca7('0xf'),_0xb380e5,_0x218e46[_0x6ca7('0x13')][_0x6ca7('0x15')]);return _0x664f96(_0x218e46[_0x6ca7('0x13')][_0x6ca7('0x15')]);}else{logger[_0x6ca7('0xe')](_0x6ca7('0xf'),_0xb380e5,_0x6ca7('0x11'));_0x664f96(_0x218e46[_0x6ca7('0x16')][_0x6ca7('0x15')]);}})['catch'](function(_0x3b9418){logger[_0x6ca7('0x13')](_0x6ca7('0xf'),_0xb380e5,_0x3b9418);_0x32dad1(_0x3b9418);});});}exports[_0x6ca7('0x17')]=function(_0x59ff3f){var _0x2e17e8=this;return new Promise(function(_0x164701,_0x2c0c42){return db['VoiceTransferReport']['create'](_0x59ff3f[_0x6ca7('0x18')],{'raw':_0x59ff3f[_0x6ca7('0x19')]?_0x59ff3f['options'][_0x6ca7('0x1a')]===undefined?!![]:![]:!![]})[_0x6ca7('0x1b')](function(_0x58c51f){logger[_0x6ca7('0xe')](_0x6ca7('0x17'),_0x59ff3f);logger[_0x6ca7('0x10')](_0x6ca7('0x17'),_0x59ff3f,JSON[_0x6ca7('0x12')](_0x58c51f));_0x164701(_0x58c51f);})[_0x6ca7('0x1c')](function(_0x32da96){logger['error'](_0x6ca7('0x17'),_0x32da96[_0x6ca7('0x15')],_0x59ff3f);_0x2c0c42(_0x2e17e8[_0x6ca7('0x13')](0x1f4,_0x32da96[_0x6ca7('0x15')]));});});};