78677fa4d76907e71fcd4397891b5af558b8ce3e
[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 _0x38b9=['bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','where','attributes','lodash'];(function(_0x127e8a,_0x4030e5){var _0x4ea6db=function(_0x54867c){while(--_0x54867c){_0x127e8a['push'](_0x127e8a['shift']());}};_0x4ea6db(++_0x4030e5);}(_0x38b9,0x77));var _0x938b=function(_0x130cbd,_0xf3dc56){_0x130cbd=_0x130cbd-0x0;var _0x1de72d=_0x38b9[_0x130cbd];return _0x1de72d;};'use strict';var _=require(_0x938b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x938b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x938b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x938b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x938b('0x4'));var jayson=require(_0x938b('0x5'));var client=jayson[_0x938b('0x6')][_0x938b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1eeaaf,_0x13de24,_0xb797d0){return new BPromise(function(_0x35048b,_0x3c1daa){return client[_0x938b('0x8')](_0x1eeaaf,_0xb797d0)[_0x938b('0x9')](function(_0x277dbd){logger[_0x938b('0xa')](_0x938b('0xb'),_0x13de24,_0x938b('0xc'));logger[_0x938b('0xd')](_0x938b('0xe'),_0x13de24,_0x938b('0xc'),JSON[_0x938b('0xf')](_0x277dbd));if(_0x277dbd[_0x938b('0x10')]){if(_0x277dbd[_0x938b('0x10')][_0x938b('0x11')]===0x1f4){logger[_0x938b('0x10')](_0x938b('0xb'),_0x13de24,_0x277dbd[_0x938b('0x10')][_0x938b('0x12')]);return _0x3c1daa(_0x277dbd[_0x938b('0x10')][_0x938b('0x12')]);}logger[_0x938b('0x10')](_0x938b('0xb'),_0x13de24,_0x277dbd[_0x938b('0x10')][_0x938b('0x12')]);return _0x35048b(_0x277dbd[_0x938b('0x10')][_0x938b('0x12')]);}else{logger['info'](_0x938b('0xb'),_0x13de24,_0x938b('0xc'));_0x35048b(_0x277dbd[_0x938b('0x13')][_0x938b('0x12')]);}})[_0x938b('0x14')](function(_0x5091c8){logger[_0x938b('0x10')](_0x938b('0xb'),_0x13de24,_0x5091c8);_0x3c1daa(_0x5091c8);});});}exports[_0x938b('0x15')]=function(_0x3bec12){var _0x1d6560=this;return new Promise(function(_0x4bcafd,_0x38a900){return db[_0x938b('0x16')][_0x938b('0x17')](_0x3bec12[_0x938b('0x18')],{'raw':_0x3bec12[_0x938b('0x19')]?_0x3bec12['options']['raw']===undefined?!![]:![]:!![]})[_0x938b('0x9')](function(_0x13f372){logger[_0x938b('0xa')](_0x938b('0x15'),_0x3bec12);logger[_0x938b('0xd')](_0x938b('0x15'),_0x3bec12,JSON[_0x938b('0xf')](_0x13f372));_0x4bcafd(_0x13f372);})[_0x938b('0x14')](function(_0xa13ebd){logger['error']('CreateVoiceDialReport',_0xa13ebd[_0x938b('0x12')],_0x3bec12);_0x38a900(_0x1d6560[_0x938b('0x10')](0x1f4,_0xa13ebd[_0x938b('0x12')]));});});};exports[_0x938b('0x1a')]=function(_0x355479){var _0x125587=this;return new Promise(function(_0x22f8d7,_0x44b686){return db[_0x938b('0x16')][_0x938b('0x1b')](_0x355479[_0x938b('0x18')],{'raw':_0x355479[_0x938b('0x19')]?_0x355479[_0x938b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355479[_0x938b('0x19')]?_0x355479[_0x938b('0x19')][_0x938b('0x1c')]||null:null,'attributes':_0x355479[_0x938b('0x19')]?_0x355479[_0x938b('0x19')][_0x938b('0x1d')]||null:null,'limit':_0x355479[_0x938b('0x19')]?_0x355479[_0x938b('0x19')]['limit']||null:null})[_0x938b('0x9')](function(_0x917751){logger['info'](_0x938b('0x1a'),_0x355479);logger[_0x938b('0xd')]('UpdateVoiceDialReport',_0x355479,JSON['stringify'](_0x917751));_0x22f8d7(_0x917751);})[_0x938b('0x14')](function(_0x3bea08){logger[_0x938b('0x10')](_0x938b('0x1a'),_0x3bea08[_0x938b('0x12')],_0x355479);_0x44b686(_0x125587[_0x938b('0x10')](0x1f4,_0x3bea08[_0x938b('0x12')]));});});};