19f4a1c31923fc46da11a0da82a9bb7f69b3a65a
[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 _0xaac5=['options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0xaac5,0x1b5));var _0x5aac=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xaac5[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x5aac('0x0'));var moment=require(_0x5aac('0x1'));var BPromise=require(_0x5aac('0x2'));var rs=require(_0x5aac('0x3'));var fs=require('fs');var Redis=require(_0x5aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aac('0x5'));var logger=require(_0x5aac('0x6'))(_0x5aac('0x7'));var config=require(_0x5aac('0x8'));var jayson=require(_0x5aac('0x9'));var client=jayson[_0x5aac('0xa')][_0x5aac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26dc95,_0x5d9764,_0x153a2c){return new BPromise(function(_0x347f0b,_0x275c4b){return client[_0x5aac('0xc')](_0x26dc95,_0x153a2c)[_0x5aac('0xd')](function(_0x2f3d4c){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5d9764,_0x5aac('0xe'));logger['debug'](_0x5aac('0xf'),_0x5d9764,_0x5aac('0xe'),JSON[_0x5aac('0x10')](_0x2f3d4c));if(_0x2f3d4c[_0x5aac('0x11')]){if(_0x2f3d4c[_0x5aac('0x11')][_0x5aac('0x12')]===0x1f4){logger[_0x5aac('0x11')](_0x5aac('0x13'),_0x5d9764,_0x2f3d4c['error'][_0x5aac('0x14')]);return _0x275c4b(_0x2f3d4c[_0x5aac('0x11')][_0x5aac('0x14')]);}logger[_0x5aac('0x11')](_0x5aac('0x13'),_0x5d9764,_0x2f3d4c[_0x5aac('0x11')][_0x5aac('0x14')]);return _0x347f0b(_0x2f3d4c['error'][_0x5aac('0x14')]);}else{logger[_0x5aac('0x15')](_0x5aac('0x13'),_0x5d9764,_0x5aac('0xe'));_0x347f0b(_0x2f3d4c[_0x5aac('0x16')][_0x5aac('0x14')]);}})[_0x5aac('0x17')](function(_0x5da719){logger[_0x5aac('0x11')](_0x5aac('0x13'),_0x5d9764,_0x5da719);_0x275c4b(_0x5da719);});});}exports[_0x5aac('0x18')]=function(_0xef5217){var _0x992b1a=this;return new Promise(function(_0x58b08f,_0xf46d5b){return db[_0x5aac('0x19')][_0x5aac('0x1a')](_0xef5217[_0x5aac('0x1b')],{'raw':_0xef5217[_0x5aac('0x1c')]?_0xef5217[_0x5aac('0x1c')][_0x5aac('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x22645e){logger[_0x5aac('0x15')]('CreateVoiceTransferReport',_0xef5217);logger[_0x5aac('0x1e')](_0x5aac('0x18'),_0xef5217,JSON[_0x5aac('0x10')](_0x22645e));_0x58b08f(_0x22645e);})[_0x5aac('0x17')](function(_0x46536b){logger[_0x5aac('0x11')](_0x5aac('0x18'),_0x46536b[_0x5aac('0x14')],_0xef5217);_0xf46d5b(_0x992b1a[_0x5aac('0x11')](0x1f4,_0x46536b['message']));});});};