3c31784a4ea81d36b8b3ddd2a38fce102b24b75d
[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 _0xa594=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x20622d,_0x3efc23){var _0x148ca5=function(_0x1d19ac){while(--_0x1d19ac){_0x20622d['push'](_0x20622d['shift']());}};_0x148ca5(++_0x3efc23);}(_0xa594,0x164));var _0x4a59=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xa594[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x4a59('0x0'));var util=require(_0x4a59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a59('0x2'));var fs=require('fs');var Redis=require(_0x4a59('0x3'));var db=require(_0x4a59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a59('0x5'))('rpc');var config=require(_0x4a59('0x6'));var jayson=require(_0x4a59('0x7'));var client=jayson['client'][_0x4a59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x366233,_0x1919c8,_0x30957b){return new BPromise(function(_0xf2afe2,_0x1d9341){return client['request'](_0x366233,_0x30957b)[_0x4a59('0x9')](function(_0x2e1a2f){logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,'request\x20sent');logger[_0x4a59('0xc')](_0x4a59('0xd'),_0x1919c8,_0x4a59('0xe'),JSON['stringify'](_0x2e1a2f));if(_0x2e1a2f[_0x4a59('0xf')]){if(_0x2e1a2f[_0x4a59('0xf')]['code']===0x1f4){logger[_0x4a59('0xf')](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);return _0x1d9341(_0x2e1a2f['error'][_0x4a59('0x10')]);}logger['error'](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f['error'][_0x4a59('0x10')]);return _0xf2afe2(_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);}else{logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,_0x4a59('0xe'));_0xf2afe2(_0x2e1a2f['result'][_0x4a59('0x10')]);}})[_0x4a59('0x11')](function(_0x407fc9){logger[_0x4a59('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x1919c8,_0x407fc9);_0x1d9341(_0x407fc9);});});}exports[_0x4a59('0x12')]=function(_0x4d587c){var _0x523a3f=this;return new Promise(function(_0x11f593,_0x16d85a){return db[_0x4a59('0x13')][_0x4a59('0x14')](_0x4d587c['body'],{'raw':_0x4d587c[_0x4a59('0x15')]?_0x4d587c[_0x4a59('0x15')][_0x4a59('0x16')]===undefined?!![]:![]:!![]})[_0x4a59('0x9')](function(_0x450a5a){logger[_0x4a59('0xa')](_0x4a59('0x12'),_0x4d587c);logger[_0x4a59('0xc')]('CreateVoiceDialReport',_0x4d587c,JSON[_0x4a59('0x17')](_0x450a5a));_0x11f593(_0x450a5a);})[_0x4a59('0x11')](function(_0x24caf8){logger[_0x4a59('0xf')](_0x4a59('0x12'),_0x24caf8[_0x4a59('0x10')],_0x4d587c);_0x16d85a(_0x523a3f[_0x4a59('0xf')](0x1f4,_0x24caf8[_0x4a59('0x10')]));});});};exports[_0x4a59('0x18')]=function(_0xe1d463){var _0x4d1703=this;return new Promise(function(_0x5dfda8,_0x44bf0e){return db[_0x4a59('0x13')][_0x4a59('0x19')](_0xe1d463[_0x4a59('0x1a')],{'raw':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe1d463['options']?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1b')]||null:null,'attributes':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1c')]||null:null,'limit':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1d')]||null:null})[_0x4a59('0x9')](function(_0x2832fa){logger[_0x4a59('0xa')]('UpdateVoiceDialReport',_0xe1d463);logger[_0x4a59('0xc')](_0x4a59('0x18'),_0xe1d463,JSON['stringify'](_0x2832fa));_0x5dfda8(_0x2832fa);})[_0x4a59('0x11')](function(_0x5e4fcf){logger[_0x4a59('0xf')]('UpdateVoiceDialReport',_0x5e4fcf['message'],_0xe1d463);_0x44bf0e(_0x4d1703[_0x4a59('0xf')](0x1f4,_0x5e4fcf['message']));});});};