c266a0e318ed6ce6d833241fdfccb4d8488435da
[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 _0xdbb7=['jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','then','UpdateVoiceDialReport','VoiceDialReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x557b49,_0x365211){var _0x462edf=function(_0x4bf6ef){while(--_0x4bf6ef){_0x557b49['push'](_0x557b49['shift']());}};_0x462edf(++_0x365211);}(_0xdbb7,0xe4));var _0x7dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7dbb('0x0'));var util=require(_0x7dbb('0x1'));var moment=require(_0x7dbb('0x2'));var BPromise=require(_0x7dbb('0x3'));var rs=require(_0x7dbb('0x4'));var fs=require('fs');var Redis=require(_0x7dbb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dbb('0x6'));var logger=require(_0x7dbb('0x7'))(_0x7dbb('0x8'));var config=require(_0x7dbb('0x9'));var jayson=require(_0x7dbb('0xa'));var client=jayson['client'][_0x7dbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33df44,_0x2f9f82,_0x354b8c){return new BPromise(function(_0x2c76ae,_0x112efa){return client[_0x7dbb('0xc')](_0x33df44,_0x354b8c)['then'](function(_0x42bcdc){logger[_0x7dbb('0xd')](_0x7dbb('0xe'),_0x2f9f82,_0x7dbb('0xf'));logger[_0x7dbb('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2f9f82,_0x7dbb('0xf'),JSON[_0x7dbb('0x11')](_0x42bcdc));if(_0x42bcdc[_0x7dbb('0x12')]){if(_0x42bcdc[_0x7dbb('0x12')][_0x7dbb('0x13')]===0x1f4){logger[_0x7dbb('0x12')](_0x7dbb('0xe'),_0x2f9f82,_0x42bcdc[_0x7dbb('0x12')]['message']);return _0x112efa(_0x42bcdc[_0x7dbb('0x12')]['message']);}logger[_0x7dbb('0x12')](_0x7dbb('0xe'),_0x2f9f82,_0x42bcdc[_0x7dbb('0x12')][_0x7dbb('0x14')]);return _0x2c76ae(_0x42bcdc['error'][_0x7dbb('0x14')]);}else{logger[_0x7dbb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x2f9f82,_0x7dbb('0xf'));_0x2c76ae(_0x42bcdc[_0x7dbb('0x15')]['message']);}})[_0x7dbb('0x16')](function(_0x1dbf1d){logger[_0x7dbb('0x12')](_0x7dbb('0xe'),_0x2f9f82,_0x1dbf1d);_0x112efa(_0x1dbf1d);});});}exports[_0x7dbb('0x17')]=function(_0x25e433){var _0x5a51cb=this;return new Promise(function(_0x395c6b,_0x1b4099){return db['VoiceDialReport'][_0x7dbb('0x18')](_0x25e433[_0x7dbb('0x19')],{'raw':_0x25e433[_0x7dbb('0x1a')]?_0x25e433[_0x7dbb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7dbb('0x1b')](function(_0x46620c){logger[_0x7dbb('0xd')](_0x7dbb('0x17'),_0x25e433);logger[_0x7dbb('0x10')](_0x7dbb('0x17'),_0x25e433,JSON[_0x7dbb('0x11')](_0x46620c));_0x395c6b(_0x46620c);})[_0x7dbb('0x16')](function(_0x2543fe){logger['error']('CreateVoiceDialReport',_0x2543fe[_0x7dbb('0x14')],_0x25e433);_0x1b4099(_0x5a51cb[_0x7dbb('0x12')](0x1f4,_0x2543fe[_0x7dbb('0x14')]));});});};exports[_0x7dbb('0x1c')]=function(_0x197dc5){var _0x34be77=this;return new Promise(function(_0x2d67c8,_0x5e30de){return db[_0x7dbb('0x1d')][_0x7dbb('0x1e')](_0x197dc5[_0x7dbb('0x19')],{'raw':_0x197dc5[_0x7dbb('0x1a')]?_0x197dc5[_0x7dbb('0x1a')][_0x7dbb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197dc5[_0x7dbb('0x1a')]?_0x197dc5[_0x7dbb('0x1a')]['where']||null:null,'attributes':_0x197dc5[_0x7dbb('0x1a')]?_0x197dc5[_0x7dbb('0x1a')][_0x7dbb('0x20')]||null:null,'limit':_0x197dc5[_0x7dbb('0x1a')]?_0x197dc5['options'][_0x7dbb('0x21')]||null:null})[_0x7dbb('0x1b')](function(_0x3f230a){logger[_0x7dbb('0xd')](_0x7dbb('0x1c'),_0x197dc5);logger['debug'](_0x7dbb('0x1c'),_0x197dc5,JSON[_0x7dbb('0x11')](_0x3f230a));_0x2d67c8(_0x3f230a);})['catch'](function(_0x18898e){logger[_0x7dbb('0x12')](_0x7dbb('0x1c'),_0x18898e[_0x7dbb('0x14')],_0x197dc5);_0x5e30de(_0x34be77['error'](0x1f4,_0x18898e[_0x7dbb('0x14')]));});});};