Built motion from commit (unavailable).|2.5.31
[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 _0xec1c=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec1c,0x13c));var _0xcec1=function(_0x1740ae,_0x5889d2){_0x1740ae=_0x1740ae-0x0;var _0x2eddc6=_0xec1c[_0x1740ae];return _0x2eddc6;};'use strict';var _=require(_0xcec1('0x0'));var util=require(_0xcec1('0x1'));var moment=require(_0xcec1('0x2'));var BPromise=require(_0xcec1('0x3'));var rs=require(_0xcec1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcec1('0x5'));var logger=require('../../config/logger')(_0xcec1('0x6'));var config=require(_0xcec1('0x7'));var jayson=require(_0xcec1('0x8'));var client=jayson[_0xcec1('0x9')][_0xcec1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c9d9,_0x16dfa2,_0x8268df){return new BPromise(function(_0x17820b,_0x5a16f5){return client['request'](_0x18c9d9,_0x8268df)[_0xcec1('0xb')](function(_0x44d2c5){logger[_0xcec1('0xc')](_0xcec1('0xd'),_0x16dfa2,_0xcec1('0xe'));logger[_0xcec1('0xf')](_0xcec1('0x10'),_0x16dfa2,_0xcec1('0xe'),JSON[_0xcec1('0x11')](_0x44d2c5));if(_0x44d2c5[_0xcec1('0x12')]){if(_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x13')]===0x1f4){logger[_0xcec1('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x14')]);return _0x5a16f5(_0x44d2c5['error'][_0xcec1('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x14')]);return _0x17820b(_0x44d2c5[_0xcec1('0x12')]['message']);}else{logger[_0xcec1('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0xcec1('0xe'));_0x17820b(_0x44d2c5[_0xcec1('0x15')][_0xcec1('0x14')]);}})[_0xcec1('0x16')](function(_0x1316bd){logger['error'](_0xcec1('0xd'),_0x16dfa2,_0x1316bd);_0x5a16f5(_0x1316bd);});});}exports[_0xcec1('0x17')]=function(_0x4ea250){var _0x4292ee=this;return new Promise(function(_0x10ca43,_0x59eef3){return db['VoiceDialReport'][_0xcec1('0x18')](_0x4ea250['body'],{'raw':_0x4ea250['options']?_0x4ea250[_0xcec1('0x19')][_0xcec1('0x1a')]===undefined?!![]:![]:!![]})[_0xcec1('0xb')](function(_0xc9aea3){logger[_0xcec1('0xc')](_0xcec1('0x17'),_0x4ea250);logger['debug']('CreateVoiceDialReport',_0x4ea250,JSON[_0xcec1('0x11')](_0xc9aea3));_0x10ca43(_0xc9aea3);})[_0xcec1('0x16')](function(_0x3de3d2){logger[_0xcec1('0x12')](_0xcec1('0x17'),_0x3de3d2[_0xcec1('0x14')],_0x4ea250);_0x59eef3(_0x4292ee[_0xcec1('0x12')](0x1f4,_0x3de3d2['message']));});});};exports[_0xcec1('0x1b')]=function(_0x28e140){var _0xad64da=this;return new Promise(function(_0x1daacf,_0x3d5ad7){return db['VoiceDialReport'][_0xcec1('0x1c')](_0x28e140[_0xcec1('0x1d')],{'raw':_0x28e140['options']?_0x28e140[_0xcec1('0x19')][_0xcec1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28e140[_0xcec1('0x19')]?_0x28e140[_0xcec1('0x19')][_0xcec1('0x1e')]||null:null,'attributes':_0x28e140[_0xcec1('0x19')]?_0x28e140['options'][_0xcec1('0x1f')]||null:null,'limit':_0x28e140[_0xcec1('0x19')]?_0x28e140[_0xcec1('0x19')][_0xcec1('0x20')]||null:null})['then'](function(_0x6b525){logger['info'](_0xcec1('0x1b'),_0x28e140);logger[_0xcec1('0xf')](_0xcec1('0x1b'),_0x28e140,JSON[_0xcec1('0x11')](_0x6b525));_0x1daacf(_0x6b525);})['catch'](function(_0x2a52fd){logger[_0xcec1('0x12')](_0xcec1('0x1b'),_0x2a52fd['message'],_0x28e140);_0x3d5ad7(_0xad64da['error'](0x1f4,_0x2a52fd[_0xcec1('0x14')]));});});};