Built motion from commit da24aabd.|2.6.20
[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 _0xeda4=['request\x20sent','debug','stringify','code','message','error','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xeda4,0x1f4));var _0x4eda=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xeda4[_0x2d4661];return _0x42ed1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4eda('0x0'));var BPromise=require(_0x4eda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eda('0x2'));var db=require(_0x4eda('0x3'))['db'];var utils=require(_0x4eda('0x4'));var logger=require('../../config/logger')(_0x4eda('0x5'));var config=require(_0x4eda('0x6'));var jayson=require(_0x4eda('0x7'));var client=jayson[_0x4eda('0x8')][_0x4eda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf0f4a,_0x419b20,_0x2e6059){return new BPromise(function(_0x3c6ea4,_0x155e87){return client['request'](_0xbf0f4a,_0x2e6059)[_0x4eda('0xa')](function(_0x18bbbd){logger[_0x4eda('0xb')](_0x4eda('0xc'),_0x419b20,_0x4eda('0xd'));logger[_0x4eda('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x419b20,_0x4eda('0xd'),JSON[_0x4eda('0xf')](_0x18bbbd));if(_0x18bbbd['error']){if(_0x18bbbd['error'][_0x4eda('0x10')]===0x1f4){logger['error'](_0x4eda('0xc'),_0x419b20,_0x18bbbd['error'][_0x4eda('0x11')]);return _0x155e87(_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);}logger[_0x4eda('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x419b20,_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);return _0x3c6ea4(_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);}else{logger[_0x4eda('0xb')](_0x4eda('0xc'),_0x419b20,'request\x20sent');_0x3c6ea4(_0x18bbbd[_0x4eda('0x13')][_0x4eda('0x11')]);}})[_0x4eda('0x14')](function(_0x4ce221){logger[_0x4eda('0x12')](_0x4eda('0xc'),_0x419b20,_0x4ce221);_0x155e87(_0x4ce221);});});}exports[_0x4eda('0x15')]=function(_0x5b547a){var _0x1f6e8d=this;return new Promise(function(_0x192f31,_0x2fe041){return db[_0x4eda('0x16')][_0x4eda('0x17')](_0x5b547a[_0x4eda('0x18')],{'raw':_0x5b547a[_0x4eda('0x19')]?_0x5b547a['options'][_0x4eda('0x1a')]===undefined?!![]:![]:!![]})[_0x4eda('0xa')](function(_0x25fa5f){logger['info']('CreateVoiceTransferReport',_0x5b547a);logger['debug'](_0x4eda('0x15'),_0x5b547a,JSON[_0x4eda('0xf')](_0x25fa5f));_0x192f31(_0x25fa5f);})['catch'](function(_0x4cda3d){logger[_0x4eda('0x12')](_0x4eda('0x15'),_0x4cda3d['message'],_0x5b547a);_0x2fe041(_0x1f6e8d[_0x4eda('0x12')](0x1f4,_0x4cda3d[_0x4eda('0x11')]));});});};