Built motion from commit 0c5f406c.|2.6.29
[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 _0x9556=['options','raw','then','debug','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create','body'];(function(_0x23b8c3,_0x45fb28){var _0x4a98d9=function(_0x327782){while(--_0x327782){_0x23b8c3['push'](_0x23b8c3['shift']());}};_0x4a98d9(++_0x45fb28);}(_0x9556,0x9a));var _0x6955=function(_0x3c1d51,_0x36fb91){_0x3c1d51=_0x3c1d51-0x0;var _0x4ca9ea=_0x9556[_0x3c1d51];return _0x4ca9ea;};'use strict';var _=require('lodash');var util=require(_0x6955('0x0'));var moment=require(_0x6955('0x1'));var BPromise=require(_0x6955('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6955('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6955('0x4'));var logger=require('../../config/logger')(_0x6955('0x5'));var config=require(_0x6955('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6955('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37a730,_0x1e0123,_0x5ded76){return new BPromise(function(_0x5effa3,_0x2be23a){return client[_0x6955('0x8')](_0x37a730,_0x5ded76)['then'](function(_0x13472f){logger[_0x6955('0x9')](_0x6955('0xa'),_0x1e0123,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1e0123,_0x6955('0xb'),JSON[_0x6955('0xc')](_0x13472f));if(_0x13472f[_0x6955('0xd')]){if(_0x13472f[_0x6955('0xd')][_0x6955('0xe')]===0x1f4){logger[_0x6955('0xd')](_0x6955('0xa'),_0x1e0123,_0x13472f[_0x6955('0xd')][_0x6955('0xf')]);return _0x2be23a(_0x13472f[_0x6955('0xd')]['message']);}logger[_0x6955('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e0123,_0x13472f['error'][_0x6955('0xf')]);return _0x5effa3(_0x13472f['error'][_0x6955('0xf')]);}else{logger[_0x6955('0x9')](_0x6955('0xa'),_0x1e0123,_0x6955('0xb'));_0x5effa3(_0x13472f[_0x6955('0x10')]['message']);}})[_0x6955('0x11')](function(_0x329005){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1e0123,_0x329005);_0x2be23a(_0x329005);});});}exports[_0x6955('0x12')]=function(_0x2194f2){var _0x3e299d=this;return new Promise(function(_0x381061,_0x442d83){return db['VoiceTransferReport'][_0x6955('0x13')](_0x2194f2[_0x6955('0x14')],{'raw':_0x2194f2[_0x6955('0x15')]?_0x2194f2['options'][_0x6955('0x16')]===undefined?!![]:![]:!![]})[_0x6955('0x17')](function(_0x347832){logger[_0x6955('0x9')](_0x6955('0x12'),_0x2194f2);logger[_0x6955('0x18')](_0x6955('0x12'),_0x2194f2,JSON['stringify'](_0x347832));_0x381061(_0x347832);})[_0x6955('0x11')](function(_0x4f31dd){logger[_0x6955('0xd')](_0x6955('0x12'),_0x4f31dd['message'],_0x2194f2);_0x442d83(_0x3e299d[_0x6955('0xd')](0x1f4,_0x4f31dd[_0x6955('0xf')]));});});};