Built motion from commit fe909640.|2.6.8
[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 _0x052a=['jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','moment','bluebird','randomstring','rpc'];(function(_0x9be3f0,_0x628568){var _0x96930b=function(_0x58855e){while(--_0x58855e){_0x9be3f0['push'](_0x9be3f0['shift']());}};_0x96930b(++_0x628568);}(_0x052a,0x6c));var _0xa052=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x052a[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa052('0x0'));var BPromise=require(_0xa052('0x1'));var rs=require(_0xa052('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa052('0x3'));var config=require('../../config/environment');var jayson=require(_0xa052('0x4'));var client=jayson[_0xa052('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458cf5,_0x23fabe,_0x50a2fa){return new BPromise(function(_0x3a08ec,_0x51cb9a){return client[_0xa052('0x6')](_0x458cf5,_0x50a2fa)[_0xa052('0x7')](function(_0x4f32e6){logger[_0xa052('0x8')](_0xa052('0x9'),_0x23fabe,'request\x20sent');logger[_0xa052('0xa')](_0xa052('0xb'),_0x23fabe,_0xa052('0xc'),JSON[_0xa052('0xd')](_0x4f32e6));if(_0x4f32e6['error']){if(_0x4f32e6[_0xa052('0xe')][_0xa052('0xf')]===0x1f4){logger[_0xa052('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x23fabe,_0x4f32e6['error'][_0xa052('0x10')]);return _0x51cb9a(_0x4f32e6[_0xa052('0xe')]['message']);}logger['error'](_0xa052('0x9'),_0x23fabe,_0x4f32e6[_0xa052('0xe')][_0xa052('0x10')]);return _0x3a08ec(_0x4f32e6['error'][_0xa052('0x10')]);}else{logger[_0xa052('0x8')](_0xa052('0x9'),_0x23fabe,'request\x20sent');_0x3a08ec(_0x4f32e6[_0xa052('0x11')][_0xa052('0x10')]);}})[_0xa052('0x12')](function(_0x9374ea){logger[_0xa052('0xe')](_0xa052('0x9'),_0x23fabe,_0x9374ea);_0x51cb9a(_0x9374ea);});});}exports[_0xa052('0x13')]=function(_0x5ef882){var _0x2583b0=this;return new Promise(function(_0x33589e,_0x1aa679){return db[_0xa052('0x14')]['create'](_0x5ef882['body'],{'raw':_0x5ef882[_0xa052('0x15')]?_0x5ef882[_0xa052('0x15')][_0xa052('0x16')]===undefined?!![]:![]:!![]})[_0xa052('0x7')](function(_0x59ff72){logger[_0xa052('0x8')](_0xa052('0x13'),_0x5ef882);logger[_0xa052('0xa')](_0xa052('0x13'),_0x5ef882,JSON[_0xa052('0xd')](_0x59ff72));_0x33589e(_0x59ff72);})['catch'](function(_0x273ecc){logger[_0xa052('0xe')](_0xa052('0x13'),_0x273ecc['message'],_0x5ef882);_0x1aa679(_0x2583b0['error'](0x1f4,_0x273ecc[_0xa052('0x10')]));});});};exports[_0xa052('0x17')]=function(_0x253561){var _0x112421=this;return new Promise(function(_0x577544,_0x5b2486){return db[_0xa052('0x14')][_0xa052('0x18')](_0x253561['body'],{'raw':_0x253561[_0xa052('0x15')]?_0x253561[_0xa052('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253561[_0xa052('0x15')]?_0x253561[_0xa052('0x15')][_0xa052('0x19')]||null:null,'attributes':_0x253561['options']?_0x253561[_0xa052('0x15')][_0xa052('0x1a')]||null:null,'limit':_0x253561['options']?_0x253561['options'][_0xa052('0x1b')]||null:null})[_0xa052('0x7')](function(_0x4c2cae){logger['info'](_0xa052('0x17'),_0x253561);logger[_0xa052('0xa')]('UpdateVoiceDialReport',_0x253561,JSON[_0xa052('0xd')](_0x4c2cae));_0x577544(_0x4c2cae);})[_0xa052('0x12')](function(_0x10d01a){logger[_0xa052('0xe')](_0xa052('0x17'),_0x10d01a['message'],_0x253561);_0x5b2486(_0x112421[_0xa052('0xe')](0x1f4,_0x10d01a[_0xa052('0x10')]));});});};