e9c2046e9d67d89f13f7341ce93516cd0b121a26
[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 _0x7a38=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateVoiceTransferReport','body','options','raw','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1941fa,_0x2d487e){var _0x4a2d4e=function(_0x52b787){while(--_0x52b787){_0x1941fa['push'](_0x1941fa['shift']());}};_0x4a2d4e(++_0x2d487e);}(_0x7a38,0x186));var _0x87a3=function(_0xc2f1c4,_0x538ea4){_0xc2f1c4=_0xc2f1c4-0x0;var _0x2a3ba7=_0x7a38[_0xc2f1c4];return _0x2a3ba7;};'use strict';var _=require('lodash');var util=require(_0x87a3('0x0'));var moment=require('moment');var BPromise=require(_0x87a3('0x1'));var rs=require(_0x87a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87a3('0x3'))['db'];var utils=require(_0x87a3('0x4'));var logger=require(_0x87a3('0x5'))('rpc');var config=require(_0x87a3('0x6'));var jayson=require(_0x87a3('0x7'));var client=jayson[_0x87a3('0x8')][_0x87a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e13d6,_0x39e172,_0x205706){return new BPromise(function(_0x1592e0,_0x3730fa){return client[_0x87a3('0xa')](_0x3e13d6,_0x205706)[_0x87a3('0xb')](function(_0x3133a3){logger[_0x87a3('0xc')](_0x87a3('0xd'),_0x39e172,_0x87a3('0xe'));logger[_0x87a3('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x39e172,_0x87a3('0xe'),JSON['stringify'](_0x3133a3));if(_0x3133a3['error']){if(_0x3133a3[_0x87a3('0x10')]['code']===0x1f4){logger[_0x87a3('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x39e172,_0x3133a3[_0x87a3('0x10')][_0x87a3('0x11')]);return _0x3730fa(_0x3133a3[_0x87a3('0x10')][_0x87a3('0x11')]);}logger[_0x87a3('0x10')](_0x87a3('0xd'),_0x39e172,_0x3133a3[_0x87a3('0x10')]['message']);return _0x1592e0(_0x3133a3[_0x87a3('0x10')]['message']);}else{logger[_0x87a3('0xc')](_0x87a3('0xd'),_0x39e172,_0x87a3('0xe'));_0x1592e0(_0x3133a3[_0x87a3('0x12')]['message']);}})[_0x87a3('0x13')](function(_0x58aeea){logger['error'](_0x87a3('0xd'),_0x39e172,_0x58aeea);_0x3730fa(_0x58aeea);});});}exports[_0x87a3('0x14')]=function(_0x46425c){var _0x172f68=this;return new Promise(function(_0x34515b,_0x21cbd7){return db['VoiceTransferReport']['create'](_0x46425c[_0x87a3('0x15')],{'raw':_0x46425c['options']?_0x46425c[_0x87a3('0x16')][_0x87a3('0x17')]===undefined?!![]:![]:!![]})[_0x87a3('0xb')](function(_0x4f6c20){logger[_0x87a3('0xc')]('CreateVoiceTransferReport',_0x46425c);logger[_0x87a3('0xf')](_0x87a3('0x14'),_0x46425c,JSON[_0x87a3('0x18')](_0x4f6c20));_0x34515b(_0x4f6c20);})[_0x87a3('0x13')](function(_0x42e43a){logger[_0x87a3('0x10')](_0x87a3('0x14'),_0x42e43a[_0x87a3('0x11')],_0x46425c);_0x21cbd7(_0x172f68[_0x87a3('0x10')](0x1f4,_0x42e43a['message']));});});};