Built motion from commit (unavailable).|2.3.4
[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 _0x8128=['message','VoiceDialReport','create','options','raw','then','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','body','where','attributes','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42e8f3,_0x5c8dba){var _0x47feab=function(_0x35fbf7){while(--_0x35fbf7){_0x42e8f3['push'](_0x42e8f3['shift']());}};_0x47feab(++_0x5c8dba);}(_0x8128,0x1b1));var _0x8812=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8128[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8812('0x1'));var rs=require(_0x8812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8812('0x3'));var logger=require(_0x8812('0x4'))(_0x8812('0x5'));var config=require('../../config/environment');var jayson=require(_0x8812('0x6'));var client=jayson[_0x8812('0x7')][_0x8812('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16bafa,_0x480d1f,_0xfdd696){return new BPromise(function(_0x3d030b,_0x4e5012){return client['request'](_0x16bafa,_0xfdd696)['then'](function(_0x2bc882){logger[_0x8812('0x9')](_0x8812('0xa'),_0x480d1f,_0x8812('0xb'));logger[_0x8812('0xc')](_0x8812('0xd'),_0x480d1f,_0x8812('0xb'),JSON[_0x8812('0xe')](_0x2bc882));if(_0x2bc882[_0x8812('0xf')]){if(_0x2bc882['error'][_0x8812('0x10')]===0x1f4){logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')][_0x8812('0x11')]);return _0x4e5012(_0x2bc882[_0x8812('0xf')]['message']);}logger[_0x8812('0xf')](_0x8812('0xa'),_0x480d1f,_0x2bc882[_0x8812('0xf')]['message']);return _0x3d030b(_0x2bc882['error'][_0x8812('0x11')]);}else{logger[_0x8812('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x480d1f,'request\x20sent');_0x3d030b(_0x2bc882['result']['message']);}})['catch'](function(_0xa2a8cc){logger['error'](_0x8812('0xa'),_0x480d1f,_0xa2a8cc);_0x4e5012(_0xa2a8cc);});});}exports['CreateVoiceDialReport']=function(_0x447f9b){var _0x38a8ad=this;return new Promise(function(_0x4ae563,_0x23c224){return db[_0x8812('0x12')][_0x8812('0x13')](_0x447f9b['body'],{'raw':_0x447f9b['options']?_0x447f9b[_0x8812('0x14')][_0x8812('0x15')]===undefined?!![]:![]:!![]})[_0x8812('0x16')](function(_0x38a2df){logger[_0x8812('0x9')](_0x8812('0x17'),_0x447f9b);logger['debug'](_0x8812('0x17'),_0x447f9b,JSON[_0x8812('0xe')](_0x38a2df));_0x4ae563(_0x38a2df);})[_0x8812('0x18')](function(_0x5e2280){logger[_0x8812('0xf')](_0x8812('0x17'),_0x5e2280['message'],_0x447f9b);_0x23c224(_0x38a8ad[_0x8812('0xf')](0x1f4,_0x5e2280['message']));});});};exports[_0x8812('0x19')]=function(_0x16e486){var _0x8871d0=this;return new Promise(function(_0x50fb13,_0x22fb2d){return db[_0x8812('0x12')][_0x8812('0x1a')](_0x16e486[_0x8812('0x1b')],{'raw':_0x16e486['options']?_0x16e486[_0x8812('0x14')][_0x8812('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16e486[_0x8812('0x14')]?_0x16e486[_0x8812('0x14')][_0x8812('0x1c')]||null:null,'attributes':_0x16e486[_0x8812('0x14')]?_0x16e486[_0x8812('0x14')][_0x8812('0x1d')]||null:null,'limit':_0x16e486[_0x8812('0x14')]?_0x16e486[_0x8812('0x14')]['limit']||null:null})['then'](function(_0x584bcf){logger['info'](_0x8812('0x19'),_0x16e486);logger[_0x8812('0xc')](_0x8812('0x19'),_0x16e486,JSON[_0x8812('0xe')](_0x584bcf));_0x50fb13(_0x584bcf);})[_0x8812('0x18')](function(_0x54bec0){logger[_0x8812('0xf')](_0x8812('0x19'),_0x54bec0[_0x8812('0x11')],_0x16e486);_0x22fb2d(_0x8871d0[_0x8812('0xf')](0x1f4,_0x54bec0['message']));});});};