2764f4bcbcea40da7c551fdf8e460b11985ddcd6
[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 _0x94a5=['code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','then','body','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x205e5b,_0x3d9293){var _0x2e60db=function(_0x2e2620){while(--_0x2e2620){_0x205e5b['push'](_0x205e5b['shift']());}};_0x2e60db(++_0x3d9293);}(_0x94a5,0x1ef));var _0x594a=function(_0x9a3c82,_0x39b592){_0x9a3c82=_0x9a3c82-0x0;var _0x52a746=_0x94a5[_0x9a3c82];return _0x52a746;};'use strict';var _=require(_0x594a('0x0'));var util=require(_0x594a('0x1'));var moment=require('moment');var BPromise=require(_0x594a('0x2'));var rs=require(_0x594a('0x3'));var fs=require('fs');var Redis=require(_0x594a('0x4'));var db=require(_0x594a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x594a('0x6'));var config=require(_0x594a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x594a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f450,_0x3e7410,_0x3bde48){return new BPromise(function(_0x314c89,_0x2433c0){return client[_0x594a('0x9')](_0x35f450,_0x3bde48)['then'](function(_0xc6009c){logger['info'](_0x594a('0xa'),_0x3e7410,_0x594a('0xb'));logger[_0x594a('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3e7410,_0x594a('0xb'),JSON[_0x594a('0xd')](_0xc6009c));if(_0xc6009c[_0x594a('0xe')]){if(_0xc6009c[_0x594a('0xe')][_0x594a('0xf')]===0x1f4){logger['error'](_0x594a('0xa'),_0x3e7410,_0xc6009c[_0x594a('0xe')][_0x594a('0x10')]);return _0x2433c0(_0xc6009c['error'][_0x594a('0x10')]);}logger[_0x594a('0xe')](_0x594a('0xa'),_0x3e7410,_0xc6009c[_0x594a('0xe')][_0x594a('0x10')]);return _0x314c89(_0xc6009c[_0x594a('0xe')][_0x594a('0x10')]);}else{logger[_0x594a('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3e7410,'request\x20sent');_0x314c89(_0xc6009c[_0x594a('0x12')]['message']);}})[_0x594a('0x13')](function(_0x3766ea){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3e7410,_0x3766ea);_0x2433c0(_0x3766ea);});});}exports[_0x594a('0x14')]=function(_0x2a591e){var _0x5d9d67=this;return new Promise(function(_0x45a23c,_0x506a3f){return db[_0x594a('0x15')][_0x594a('0x16')](_0x2a591e['body'],{'raw':_0x2a591e[_0x594a('0x17')]?_0x2a591e['options'][_0x594a('0x18')]===undefined?!![]:![]:!![]})[_0x594a('0x19')](function(_0x48411a){logger[_0x594a('0x11')](_0x594a('0x14'),_0x2a591e);logger['debug'](_0x594a('0x14'),_0x2a591e,JSON[_0x594a('0xd')](_0x48411a));_0x45a23c(_0x48411a);})[_0x594a('0x13')](function(_0x59b4db){logger[_0x594a('0xe')](_0x594a('0x14'),_0x59b4db['message'],_0x2a591e);_0x506a3f(_0x5d9d67[_0x594a('0xe')](0x1f4,_0x59b4db[_0x594a('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x448f00){var _0x46f3f1=this;return new Promise(function(_0x40436b,_0x1819d0){return db['VoiceDialReport']['update'](_0x448f00[_0x594a('0x1a')],{'raw':_0x448f00[_0x594a('0x17')]?_0x448f00[_0x594a('0x17')][_0x594a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448f00[_0x594a('0x17')]?_0x448f00[_0x594a('0x17')]['where']||null:null,'attributes':_0x448f00[_0x594a('0x17')]?_0x448f00[_0x594a('0x17')][_0x594a('0x1b')]||null:null,'limit':_0x448f00[_0x594a('0x17')]?_0x448f00[_0x594a('0x17')][_0x594a('0x1c')]||null:null})[_0x594a('0x19')](function(_0x413e23){logger[_0x594a('0x11')](_0x594a('0x1d'),_0x448f00);logger[_0x594a('0xc')](_0x594a('0x1d'),_0x448f00,JSON[_0x594a('0xd')](_0x413e23));_0x40436b(_0x413e23);})[_0x594a('0x13')](function(_0x5a0cf4){logger[_0x594a('0xe')](_0x594a('0x1d'),_0x5a0cf4[_0x594a('0x10')],_0x448f00);_0x1819d0(_0x46f3f1[_0x594a('0xe')](0x1f4,_0x5a0cf4[_0x594a('0x10')]));});});};