c7ecb18dcee31dae833c727b275ef2ba085a2127
[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 _0x4202=['raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','options'];(function(_0x1792f6,_0x296726){var _0x216d94=function(_0x2a4835){while(--_0x2a4835){_0x1792f6['push'](_0x1792f6['shift']());}};_0x216d94(++_0x296726);}(_0x4202,0x178));var _0x2420=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x4202[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require('lodash');var util=require(_0x2420('0x0'));var moment=require(_0x2420('0x1'));var BPromise=require(_0x2420('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2420('0x3'));var db=require(_0x2420('0x4'))['db'];var utils=require(_0x2420('0x5'));var logger=require('../../config/logger')(_0x2420('0x6'));var config=require('../../config/environment');var jayson=require(_0x2420('0x7'));var client=jayson[_0x2420('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2aa2,_0x509d83,_0x1865ac){return new BPromise(function(_0xf6255a,_0x531665){return client[_0x2420('0x9')](_0x2b2aa2,_0x1865ac)[_0x2420('0xa')](function(_0x4627ee){logger[_0x2420('0xb')](_0x2420('0xc'),_0x509d83,_0x2420('0xd'));logger[_0x2420('0xe')](_0x2420('0xf'),_0x509d83,_0x2420('0xd'),JSON[_0x2420('0x10')](_0x4627ee));if(_0x4627ee[_0x2420('0x11')]){if(_0x4627ee[_0x2420('0x11')][_0x2420('0x12')]===0x1f4){logger[_0x2420('0x11')](_0x2420('0xc'),_0x509d83,_0x4627ee[_0x2420('0x11')][_0x2420('0x13')]);return _0x531665(_0x4627ee['error'][_0x2420('0x13')]);}logger[_0x2420('0x11')](_0x2420('0xc'),_0x509d83,_0x4627ee[_0x2420('0x11')][_0x2420('0x13')]);return _0xf6255a(_0x4627ee[_0x2420('0x11')]['message']);}else{logger[_0x2420('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x509d83,_0x2420('0xd'));_0xf6255a(_0x4627ee[_0x2420('0x14')][_0x2420('0x13')]);}})[_0x2420('0x15')](function(_0x36c069){logger[_0x2420('0x11')](_0x2420('0xc'),_0x509d83,_0x36c069);_0x531665(_0x36c069);});});}exports[_0x2420('0x16')]=function(_0x5d4e88){var _0x41ed90=this;return new Promise(function(_0x17f929,_0x39d1e3){return db['VoiceTransferReport']['create'](_0x5d4e88['body'],{'raw':_0x5d4e88[_0x2420('0x17')]?_0x5d4e88[_0x2420('0x17')][_0x2420('0x18')]===undefined?!![]:![]:!![]})[_0x2420('0xa')](function(_0x2d3778){logger[_0x2420('0xb')](_0x2420('0x16'),_0x5d4e88);logger[_0x2420('0xe')](_0x2420('0x16'),_0x5d4e88,JSON['stringify'](_0x2d3778));_0x17f929(_0x2d3778);})[_0x2420('0x15')](function(_0x5e9cd){logger[_0x2420('0x11')](_0x2420('0x16'),_0x5e9cd[_0x2420('0x13')],_0x5d4e88);_0x39d1e3(_0x41ed90[_0x2420('0x11')](0x1f4,_0x5e9cd[_0x2420('0x13')]));});});};