Built motion from commit 47436d59.|2.6.7
[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 _0x4f4c=['http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceTransferReport','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52d7df,_0x5d5742){var _0x6163fc=function(_0x79d617){while(--_0x79d617){_0x52d7df['push'](_0x52d7df['shift']());}};_0x6163fc(++_0x5d5742);}(_0x4f4c,0xef));var _0xc4f4=function(_0x36a34f,_0x204b6a){_0x36a34f=_0x36a34f-0x0;var _0x15fc45=_0x4f4c[_0x36a34f];return _0x15fc45;};'use strict';var _=require(_0xc4f4('0x0'));var util=require(_0xc4f4('0x1'));var moment=require(_0xc4f4('0x2'));var BPromise=require(_0xc4f4('0x3'));var rs=require(_0xc4f4('0x4'));var fs=require('fs');var Redis=require(_0xc4f4('0x5'));var db=require(_0xc4f4('0x6'))['db'];var utils=require(_0xc4f4('0x7'));var logger=require(_0xc4f4('0x8'))(_0xc4f4('0x9'));var config=require(_0xc4f4('0xa'));var jayson=require(_0xc4f4('0xb'));var client=jayson[_0xc4f4('0xc')][_0xc4f4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5900df,_0x1c740d,_0x1eb77b){return new BPromise(function(_0x4a725b,_0x5a2983){return client['request'](_0x5900df,_0x1eb77b)[_0xc4f4('0xe')](function(_0x2cd19e){logger[_0xc4f4('0xf')](_0xc4f4('0x10'),_0x1c740d,_0xc4f4('0x11'));logger[_0xc4f4('0x12')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1c740d,_0xc4f4('0x11'),JSON[_0xc4f4('0x13')](_0x2cd19e));if(_0x2cd19e[_0xc4f4('0x14')]){if(_0x2cd19e['error'][_0xc4f4('0x15')]===0x1f4){logger['error'](_0xc4f4('0x10'),_0x1c740d,_0x2cd19e[_0xc4f4('0x14')][_0xc4f4('0x16')]);return _0x5a2983(_0x2cd19e[_0xc4f4('0x14')][_0xc4f4('0x16')]);}logger[_0xc4f4('0x14')](_0xc4f4('0x10'),_0x1c740d,_0x2cd19e[_0xc4f4('0x14')][_0xc4f4('0x16')]);return _0x4a725b(_0x2cd19e['error']['message']);}else{logger[_0xc4f4('0xf')](_0xc4f4('0x10'),_0x1c740d,_0xc4f4('0x11'));_0x4a725b(_0x2cd19e['result']['message']);}})[_0xc4f4('0x17')](function(_0x58c484){logger['error'](_0xc4f4('0x10'),_0x1c740d,_0x58c484);_0x5a2983(_0x58c484);});});}exports[_0xc4f4('0x18')]=function(_0x2788a5){var _0x4911a2=this;return new Promise(function(_0x4074ed,_0x4ab9ca){return db['VoiceTransferReport']['create'](_0x2788a5[_0xc4f4('0x19')],{'raw':_0x2788a5[_0xc4f4('0x1a')]?_0x2788a5[_0xc4f4('0x1a')][_0xc4f4('0x1b')]===undefined?!![]:![]:!![]})[_0xc4f4('0xe')](function(_0x3eb7b9){logger['info'](_0xc4f4('0x18'),_0x2788a5);logger[_0xc4f4('0x12')](_0xc4f4('0x18'),_0x2788a5,JSON['stringify'](_0x3eb7b9));_0x4074ed(_0x3eb7b9);})[_0xc4f4('0x17')](function(_0x3e2375){logger[_0xc4f4('0x14')](_0xc4f4('0x18'),_0x3e2375[_0xc4f4('0x16')],_0x2788a5);_0x4ab9ca(_0x4911a2['error'](0x1f4,_0x3e2375[_0xc4f4('0x16')]));});});};