d0948176c74bb29fa305a1f998938645b8bde1cf
[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 _0xd445=['body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceTransferReport','create'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0xd445,0x146));var _0x5d44=function(_0x1af11c,_0x24e084){_0x1af11c=_0x1af11c-0x0;var _0x29d074=_0xd445[_0x1af11c];return _0x29d074;};'use strict';var _=require(_0x5d44('0x0'));var util=require('util');var moment=require(_0x5d44('0x1'));var BPromise=require(_0x5d44('0x2'));var rs=require(_0x5d44('0x3'));var fs=require('fs');var Redis=require(_0x5d44('0x4'));var db=require(_0x5d44('0x5'))['db'];var utils=require(_0x5d44('0x6'));var logger=require(_0x5d44('0x7'))(_0x5d44('0x8'));var config=require(_0x5d44('0x9'));var jayson=require(_0x5d44('0xa'));var client=jayson[_0x5d44('0xb')][_0x5d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24f31d,_0x4b3c12,_0x312528){return new BPromise(function(_0x56d376,_0xb346bd){return client[_0x5d44('0xd')](_0x24f31d,_0x312528)['then'](function(_0x4fce15){logger[_0x5d44('0xe')](_0x5d44('0xf'),_0x4b3c12,'request\x20sent');logger[_0x5d44('0x10')](_0x5d44('0x11'),_0x4b3c12,_0x5d44('0x12'),JSON[_0x5d44('0x13')](_0x4fce15));if(_0x4fce15[_0x5d44('0x14')]){if(_0x4fce15['error']['code']===0x1f4){logger[_0x5d44('0x14')](_0x5d44('0xf'),_0x4b3c12,_0x4fce15[_0x5d44('0x14')][_0x5d44('0x15')]);return _0xb346bd(_0x4fce15[_0x5d44('0x14')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x4fce15[_0x5d44('0x14')]['message']);return _0x56d376(_0x4fce15[_0x5d44('0x14')][_0x5d44('0x15')]);}else{logger[_0x5d44('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x5d44('0x12'));_0x56d376(_0x4fce15['result'][_0x5d44('0x15')]);}})[_0x5d44('0x16')](function(_0x24cd7d){logger[_0x5d44('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x24cd7d);_0xb346bd(_0x24cd7d);});});}exports[_0x5d44('0x17')]=function(_0x16bb84){var _0xffc1e8=this;return new Promise(function(_0x1af3ec,_0x51b851){return db['VoiceTransferReport'][_0x5d44('0x18')](_0x16bb84[_0x5d44('0x19')],{'raw':_0x16bb84[_0x5d44('0x1a')]?_0x16bb84[_0x5d44('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd96c4b){logger[_0x5d44('0xe')]('CreateVoiceTransferReport',_0x16bb84);logger['debug'](_0x5d44('0x17'),_0x16bb84,JSON[_0x5d44('0x13')](_0xd96c4b));_0x1af3ec(_0xd96c4b);})[_0x5d44('0x16')](function(_0x301f5a){logger[_0x5d44('0x14')](_0x5d44('0x17'),_0x301f5a['message'],_0x16bb84);_0x51b851(_0xffc1e8['error'](0x1f4,_0x301f5a[_0x5d44('0x15')]));});});};