f4c4adcf3228993a893d59e5548598ac4638b282
[motion2.git] / server / api / voiceDialReport / voiceDialReport.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 _0x2b47=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x520481,_0x44fa8e){var _0x2e9eed=function(_0x58ec88){while(--_0x58ec88){_0x520481['push'](_0x520481['shift']());}};_0x2e9eed(++_0x44fa8e);}(_0x2b47,0x1d1));var _0x72b4=function(_0x180143,_0x523d84){_0x180143=_0x180143-0x0;var _0x9aa6ed=_0x2b47[_0x180143];return _0x9aa6ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72b4('0x0'));var BPromise=require(_0x72b4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72b4('0x2'));var db=require(_0x72b4('0x3'))['db'];var utils=require(_0x72b4('0x4'));var logger=require('../../config/logger')(_0x72b4('0x5'));var config=require('../../config/environment');var jayson=require(_0x72b4('0x6'));var client=jayson[_0x72b4('0x7')][_0x72b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4163f7,_0x591a29,_0x3f37b9){return new BPromise(function(_0x212abf,_0x48ed3d){return client[_0x72b4('0x9')](_0x4163f7,_0x3f37b9)[_0x72b4('0xa')](function(_0x14ccee){logger[_0x72b4('0xb')](_0x72b4('0xc'),_0x591a29,_0x72b4('0xd'));logger[_0x72b4('0xe')](_0x72b4('0xf'),_0x591a29,_0x72b4('0xd'),JSON[_0x72b4('0x10')](_0x14ccee));if(_0x14ccee[_0x72b4('0x11')]){if(_0x14ccee[_0x72b4('0x11')][_0x72b4('0x12')]===0x1f4){logger['error'](_0x72b4('0xc'),_0x591a29,_0x14ccee[_0x72b4('0x11')][_0x72b4('0x13')]);return _0x48ed3d(_0x14ccee[_0x72b4('0x11')][_0x72b4('0x13')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x591a29,_0x14ccee[_0x72b4('0x11')][_0x72b4('0x13')]);return _0x212abf(_0x14ccee[_0x72b4('0x11')][_0x72b4('0x13')]);}else{logger[_0x72b4('0xb')](_0x72b4('0xc'),_0x591a29,_0x72b4('0xd'));_0x212abf(_0x14ccee[_0x72b4('0x14')][_0x72b4('0x13')]);}})[_0x72b4('0x15')](function(_0x5c9820){logger[_0x72b4('0x11')](_0x72b4('0xc'),_0x591a29,_0x5c9820);_0x48ed3d(_0x5c9820);});});}exports[_0x72b4('0x16')]=function(_0x4bb926){var _0xfcc363=this;return new Promise(function(_0x10acb0,_0x1edf57){return db[_0x72b4('0x17')][_0x72b4('0x18')](_0x4bb926['body'],{'raw':_0x4bb926[_0x72b4('0x19')]?_0x4bb926['options'][_0x72b4('0x1a')]===undefined?!![]:![]:!![]})[_0x72b4('0xa')](function(_0x7378c7){logger[_0x72b4('0xb')](_0x72b4('0x16'),_0x4bb926);logger[_0x72b4('0xe')](_0x72b4('0x16'),_0x4bb926,JSON['stringify'](_0x7378c7));_0x10acb0(_0x7378c7);})[_0x72b4('0x15')](function(_0x2840b4){logger['error'](_0x72b4('0x16'),_0x2840b4[_0x72b4('0x13')],_0x4bb926);_0x1edf57(_0xfcc363[_0x72b4('0x11')](0x1f4,_0x2840b4['message']));});});};exports[_0x72b4('0x1b')]=function(_0x2c9c45){var _0x3d7502=this;return new Promise(function(_0x3c28f8,_0x199f44){return db['VoiceDialReport']['update'](_0x2c9c45['body'],{'raw':_0x2c9c45[_0x72b4('0x19')]?_0x2c9c45['options'][_0x72b4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9c45[_0x72b4('0x19')]?_0x2c9c45[_0x72b4('0x19')]['where']||null:null,'attributes':_0x2c9c45[_0x72b4('0x19')]?_0x2c9c45[_0x72b4('0x19')]['attributes']||null:null,'limit':_0x2c9c45['options']?_0x2c9c45[_0x72b4('0x19')]['limit']||null:null})[_0x72b4('0xa')](function(_0x111a9b){logger[_0x72b4('0xb')](_0x72b4('0x1b'),_0x2c9c45);logger[_0x72b4('0xe')](_0x72b4('0x1b'),_0x2c9c45,JSON['stringify'](_0x111a9b));_0x3c28f8(_0x111a9b);})[_0x72b4('0x15')](function(_0x365273){logger[_0x72b4('0x11')](_0x72b4('0x1b'),_0x365273[_0x72b4('0x13')],_0x2c9c45);_0x199f44(_0x3d7502['error'](0x1f4,_0x365273['message']));});});};