1f1b5ddd3bce86c5068463a60bba4bbf6be8ca92
[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 _0x2ccf=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','lodash'];(function(_0x200152,_0x2c9a47){var _0xdbba14=function(_0x349a75){while(--_0x349a75){_0x200152['push'](_0x200152['shift']());}};_0xdbba14(++_0x2c9a47);}(_0x2ccf,0x1b1));var _0xf2cc=function(_0x1ce11c,_0x1e57aa){_0x1ce11c=_0x1ce11c-0x0;var _0x1c87c4=_0x2ccf[_0x1ce11c];return _0x1c87c4;};'use strict';var _=require(_0xf2cc('0x0'));var util=require(_0xf2cc('0x1'));var moment=require('moment');var BPromise=require(_0xf2cc('0x2'));var rs=require(_0xf2cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2cc('0x5'))(_0xf2cc('0x6'));var config=require(_0xf2cc('0x7'));var jayson=require(_0xf2cc('0x8'));var client=jayson['client'][_0xf2cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25bc47,_0x353db1,_0x402739){return new BPromise(function(_0x8afdf5,_0x4913bf){return client['request'](_0x25bc47,_0x402739)[_0xf2cc('0xa')](function(_0x58d36a){logger[_0xf2cc('0xb')](_0xf2cc('0xc'),_0x353db1,_0xf2cc('0xd'));logger[_0xf2cc('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x353db1,'request\x20sent',JSON[_0xf2cc('0xf')](_0x58d36a));if(_0x58d36a[_0xf2cc('0x10')]){if(_0x58d36a['error']['code']===0x1f4){logger[_0xf2cc('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x353db1,_0x58d36a[_0xf2cc('0x10')][_0xf2cc('0x11')]);return _0x4913bf(_0x58d36a[_0xf2cc('0x10')]['message']);}logger['error'](_0xf2cc('0xc'),_0x353db1,_0x58d36a[_0xf2cc('0x10')][_0xf2cc('0x11')]);return _0x8afdf5(_0x58d36a[_0xf2cc('0x10')][_0xf2cc('0x11')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x353db1,_0xf2cc('0xd'));_0x8afdf5(_0x58d36a[_0xf2cc('0x12')][_0xf2cc('0x11')]);}})[_0xf2cc('0x13')](function(_0x129a3e){logger[_0xf2cc('0x10')](_0xf2cc('0xc'),_0x353db1,_0x129a3e);_0x4913bf(_0x129a3e);});});}exports[_0xf2cc('0x14')]=function(_0xb9dbc4){var _0x386492=this;return new Promise(function(_0x3ac955,_0x19a06d){return db[_0xf2cc('0x15')][_0xf2cc('0x16')](_0xb9dbc4[_0xf2cc('0x17')],{'raw':_0xb9dbc4[_0xf2cc('0x18')]?_0xb9dbc4['options'][_0xf2cc('0x19')]===undefined?!![]:![]:!![]})[_0xf2cc('0xa')](function(_0x1f2a27){logger[_0xf2cc('0xb')]('CreateVoiceDialReport',_0xb9dbc4);logger['debug'](_0xf2cc('0x14'),_0xb9dbc4,JSON[_0xf2cc('0xf')](_0x1f2a27));_0x3ac955(_0x1f2a27);})[_0xf2cc('0x13')](function(_0x45c8bc){logger['error'](_0xf2cc('0x14'),_0x45c8bc[_0xf2cc('0x11')],_0xb9dbc4);_0x19a06d(_0x386492[_0xf2cc('0x10')](0x1f4,_0x45c8bc[_0xf2cc('0x11')]));});});};exports[_0xf2cc('0x1a')]=function(_0x5aa7ac){var _0x4991a6=this;return new Promise(function(_0x5c022c,_0x45bc16){return db[_0xf2cc('0x15')][_0xf2cc('0x1b')](_0x5aa7ac[_0xf2cc('0x17')],{'raw':_0x5aa7ac['options']?_0x5aa7ac[_0xf2cc('0x18')][_0xf2cc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aa7ac['options']?_0x5aa7ac[_0xf2cc('0x18')][_0xf2cc('0x1c')]||null:null,'attributes':_0x5aa7ac[_0xf2cc('0x18')]?_0x5aa7ac[_0xf2cc('0x18')][_0xf2cc('0x1d')]||null:null,'limit':_0x5aa7ac[_0xf2cc('0x18')]?_0x5aa7ac['options'][_0xf2cc('0x1e')]||null:null})[_0xf2cc('0xa')](function(_0x56a6f2){logger[_0xf2cc('0xb')](_0xf2cc('0x1a'),_0x5aa7ac);logger[_0xf2cc('0xe')](_0xf2cc('0x1a'),_0x5aa7ac,JSON['stringify'](_0x56a6f2));_0x5c022c(_0x56a6f2);})['catch'](function(_0x431042){logger[_0xf2cc('0x10')]('UpdateVoiceDialReport',_0x431042['message'],_0x5aa7ac);_0x45bc16(_0x4991a6[_0xf2cc('0x10')](0x1f4,_0x431042[_0xf2cc('0x11')]));});});};