d3ee6fc5f3b6a9710650de14afc9843a85ad45dc
[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 _0xfb32=['../../config/logger','rpc','client','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','UpdateVoiceDialReport','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x31d5f1,_0x535889){var _0x2d2f21=function(_0x27867d){while(--_0x27867d){_0x31d5f1['push'](_0x31d5f1['shift']());}};_0x2d2f21(++_0x535889);}(_0xfb32,0xea));var _0x2fb3=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xfb32[_0x5b740b];return _0x6f8f4e;};'use strict';var _=require(_0x2fb3('0x0'));var util=require(_0x2fb3('0x1'));var moment=require('moment');var BPromise=require(_0x2fb3('0x2'));var rs=require(_0x2fb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fb3('0x4'))['db'];var utils=require(_0x2fb3('0x5'));var logger=require(_0x2fb3('0x6'))(_0x2fb3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2fb3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26bd53,_0x171dd8,_0x122dc6){return new BPromise(function(_0x5780a8,_0x4ee417){return client[_0x2fb3('0x9')](_0x26bd53,_0x122dc6)[_0x2fb3('0xa')](function(_0x4d5b10){logger['info'](_0x2fb3('0xb'),_0x171dd8,_0x2fb3('0xc'));logger[_0x2fb3('0xd')](_0x2fb3('0xe'),_0x171dd8,_0x2fb3('0xc'),JSON[_0x2fb3('0xf')](_0x4d5b10));if(_0x4d5b10[_0x2fb3('0x10')]){if(_0x4d5b10[_0x2fb3('0x10')][_0x2fb3('0x11')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x171dd8,_0x4d5b10[_0x2fb3('0x10')]['message']);return _0x4ee417(_0x4d5b10[_0x2fb3('0x10')][_0x2fb3('0x12')]);}logger[_0x2fb3('0x10')](_0x2fb3('0xb'),_0x171dd8,_0x4d5b10[_0x2fb3('0x10')]['message']);return _0x5780a8(_0x4d5b10[_0x2fb3('0x10')][_0x2fb3('0x12')]);}else{logger[_0x2fb3('0x13')](_0x2fb3('0xb'),_0x171dd8,_0x2fb3('0xc'));_0x5780a8(_0x4d5b10[_0x2fb3('0x14')][_0x2fb3('0x12')]);}})[_0x2fb3('0x15')](function(_0x492512){logger[_0x2fb3('0x10')](_0x2fb3('0xb'),_0x171dd8,_0x492512);_0x4ee417(_0x492512);});});}exports[_0x2fb3('0x16')]=function(_0x3b5f57){var _0x5e6533=this;return new Promise(function(_0x77b79,_0xbdef6d){return db[_0x2fb3('0x17')]['create'](_0x3b5f57['body'],{'raw':_0x3b5f57[_0x2fb3('0x18')]?_0x3b5f57[_0x2fb3('0x18')][_0x2fb3('0x19')]===undefined?!![]:![]:!![]})[_0x2fb3('0xa')](function(_0x40116b){logger[_0x2fb3('0x13')](_0x2fb3('0x16'),_0x3b5f57);logger[_0x2fb3('0xd')](_0x2fb3('0x16'),_0x3b5f57,JSON[_0x2fb3('0xf')](_0x40116b));_0x77b79(_0x40116b);})['catch'](function(_0x15fa44){logger[_0x2fb3('0x10')](_0x2fb3('0x16'),_0x15fa44['message'],_0x3b5f57);_0xbdef6d(_0x5e6533['error'](0x1f4,_0x15fa44[_0x2fb3('0x12')]));});});};exports[_0x2fb3('0x1a')]=function(_0x3efc95){var _0x41495c=this;return new Promise(function(_0xf65b89,_0x6e3ef7){return db['VoiceDialReport']['update'](_0x3efc95['body'],{'raw':_0x3efc95[_0x2fb3('0x18')]?_0x3efc95['options'][_0x2fb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efc95[_0x2fb3('0x18')]?_0x3efc95[_0x2fb3('0x18')][_0x2fb3('0x1b')]||null:null,'attributes':_0x3efc95[_0x2fb3('0x18')]?_0x3efc95[_0x2fb3('0x18')][_0x2fb3('0x1c')]||null:null,'limit':_0x3efc95[_0x2fb3('0x18')]?_0x3efc95[_0x2fb3('0x18')][_0x2fb3('0x1d')]||null:null})[_0x2fb3('0xa')](function(_0x30fe6d){logger[_0x2fb3('0x13')](_0x2fb3('0x1a'),_0x3efc95);logger['debug'](_0x2fb3('0x1a'),_0x3efc95,JSON[_0x2fb3('0xf')](_0x30fe6d));_0xf65b89(_0x30fe6d);})['catch'](function(_0x280d92){logger[_0x2fb3('0x10')]('UpdateVoiceDialReport',_0x280d92[_0x2fb3('0x12')],_0x3efc95);_0x6e3ef7(_0x41495c[_0x2fb3('0x10')](0x1f4,_0x280d92[_0x2fb3('0x12')]));});});};