f2bee0d76f42f100742f83021f527fe9deae60f6
[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 _0xba1e=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','body','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x352096,_0x3b02b0){var _0x3de2f6=function(_0xa46902){while(--_0xa46902){_0x352096['push'](_0x352096['shift']());}};_0x3de2f6(++_0x3b02b0);}(_0xba1e,0x198));var _0xeba1=function(_0x1f707f,_0xb97d26){_0x1f707f=_0x1f707f-0x0;var _0x30368b=_0xba1e[_0x1f707f];return _0x30368b;};'use strict';var _=require('lodash');var util=require(_0xeba1('0x0'));var moment=require(_0xeba1('0x1'));var BPromise=require('bluebird');var rs=require(_0xeba1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeba1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeba1('0x4'))('rpc');var config=require(_0xeba1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeba1('0x6')][_0xeba1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a99ad,_0x1acdfd,_0x48d98d){return new BPromise(function(_0x1c81aa,_0x5c7e47){return client[_0xeba1('0x8')](_0x4a99ad,_0x48d98d)[_0xeba1('0x9')](function(_0x17bd4f){logger['info'](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));logger[_0xeba1('0xc')](_0xeba1('0xd'),_0x1acdfd,'request\x20sent',JSON['stringify'](_0x17bd4f));if(_0x17bd4f[_0xeba1('0xe')]){if(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0xf')]===0x1f4){logger[_0xeba1('0xe')](_0xeba1('0xa'),_0x1acdfd,_0x17bd4f['error']['message']);return _0x5c7e47(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1acdfd,_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);return _0x1c81aa(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}else{logger[_0xeba1('0x11')](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));_0x1c81aa(_0x17bd4f['result'][_0xeba1('0x10')]);}})['catch'](function(_0x265e63){logger['error'](_0xeba1('0xa'),_0x1acdfd,_0x265e63);_0x5c7e47(_0x265e63);});});}exports[_0xeba1('0x12')]=function(_0x28222e){var _0x31b9bc=this;return new Promise(function(_0x2a6ff2,_0x125430){return db[_0xeba1('0x13')][_0xeba1('0x14')](_0x28222e['body'],{'raw':_0x28222e[_0xeba1('0x15')]?_0x28222e['options'][_0xeba1('0x16')]===undefined?!![]:![]:!![]})[_0xeba1('0x9')](function(_0x3b1982){logger[_0xeba1('0x11')](_0xeba1('0x12'),_0x28222e);logger['debug'](_0xeba1('0x12'),_0x28222e,JSON[_0xeba1('0x17')](_0x3b1982));_0x2a6ff2(_0x3b1982);})[_0xeba1('0x18')](function(_0x1a35c3){logger['error']('CreateVoiceDialReport',_0x1a35c3[_0xeba1('0x10')],_0x28222e);_0x125430(_0x31b9bc['error'](0x1f4,_0x1a35c3[_0xeba1('0x10')]));});});};exports[_0xeba1('0x19')]=function(_0x1333a3){var _0x3eb44e=this;return new Promise(function(_0x3a63bb,_0x439298){return db[_0xeba1('0x13')]['update'](_0x1333a3[_0xeba1('0x1a')],{'raw':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1333a3[_0xeba1('0x15')]?_0x1333a3['options'][_0xeba1('0x1b')]||null:null,'attributes':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1c')]||null:null,'limit':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1d')]||null:null})[_0xeba1('0x9')](function(_0x17edbd){logger[_0xeba1('0x11')]('UpdateVoiceDialReport',_0x1333a3);logger['debug'](_0xeba1('0x19'),_0x1333a3,JSON[_0xeba1('0x17')](_0x17edbd));_0x3a63bb(_0x17edbd);})[_0xeba1('0x18')](function(_0x4ccd54){logger[_0xeba1('0xe')](_0xeba1('0x19'),_0x4ccd54[_0xeba1('0x10')],_0x1333a3);_0x439298(_0x3eb44e['error'](0x1f4,_0x4ccd54[_0xeba1('0x10')]));});});};