Built motion from commit d5e4af8c.|2.6.23
[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 _0x35bf=['jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x19ffee,_0x5abed3){var _0x424a76=function(_0x3b33f0){while(--_0x3b33f0){_0x19ffee['push'](_0x19ffee['shift']());}};_0x424a76(++_0x5abed3);}(_0x35bf,0xa2));var _0xf35b=function(_0x103c7c,_0x1b3d9c){_0x103c7c=_0x103c7c-0x0;var _0x2f343f=_0x35bf[_0x103c7c];return _0x2f343f;};'use strict';var _=require(_0xf35b('0x0'));var util=require(_0xf35b('0x1'));var moment=require(_0xf35b('0x2'));var BPromise=require(_0xf35b('0x3'));var rs=require(_0xf35b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf35b('0x5'))(_0xf35b('0x6'));var config=require(_0xf35b('0x7'));var jayson=require(_0xf35b('0x8'));var client=jayson[_0xf35b('0x9')][_0xf35b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f308f,_0x13c6cc,_0x29b48d){return new BPromise(function(_0x3c5c20,_0x365172){return client[_0xf35b('0xb')](_0x2f308f,_0x29b48d)[_0xf35b('0xc')](function(_0x5aa51c){logger[_0xf35b('0xd')](_0xf35b('0xe'),_0x13c6cc,_0xf35b('0xf'));logger['debug'](_0xf35b('0x10'),_0x13c6cc,_0xf35b('0xf'),JSON[_0xf35b('0x11')](_0x5aa51c));if(_0x5aa51c[_0xf35b('0x12')]){if(_0x5aa51c[_0xf35b('0x12')][_0xf35b('0x13')]===0x1f4){logger[_0xf35b('0x12')](_0xf35b('0xe'),_0x13c6cc,_0x5aa51c[_0xf35b('0x12')][_0xf35b('0x14')]);return _0x365172(_0x5aa51c[_0xf35b('0x12')][_0xf35b('0x14')]);}logger[_0xf35b('0x12')](_0xf35b('0xe'),_0x13c6cc,_0x5aa51c[_0xf35b('0x12')][_0xf35b('0x14')]);return _0x3c5c20(_0x5aa51c[_0xf35b('0x12')]['message']);}else{logger[_0xf35b('0xd')](_0xf35b('0xe'),_0x13c6cc,_0xf35b('0xf'));_0x3c5c20(_0x5aa51c[_0xf35b('0x15')][_0xf35b('0x14')]);}})[_0xf35b('0x16')](function(_0x2c4e1d){logger[_0xf35b('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x13c6cc,_0x2c4e1d);_0x365172(_0x2c4e1d);});});}exports[_0xf35b('0x17')]=function(_0x3f33a3){var _0x3d50c1=this;return new Promise(function(_0x2410dd,_0x32250f){return db['VoiceDialReport'][_0xf35b('0x18')](_0x3f33a3[_0xf35b('0x19')],{'raw':_0x3f33a3['options']?_0x3f33a3[_0xf35b('0x1a')][_0xf35b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xa9e711){logger[_0xf35b('0xd')](_0xf35b('0x17'),_0x3f33a3);logger['debug'](_0xf35b('0x17'),_0x3f33a3,JSON[_0xf35b('0x11')](_0xa9e711));_0x2410dd(_0xa9e711);})[_0xf35b('0x16')](function(_0x26f6d9){logger['error'](_0xf35b('0x17'),_0x26f6d9[_0xf35b('0x14')],_0x3f33a3);_0x32250f(_0x3d50c1[_0xf35b('0x12')](0x1f4,_0x26f6d9['message']));});});};exports[_0xf35b('0x1c')]=function(_0x2617bb){var _0x4e3f0a=this;return new Promise(function(_0x4a3a82,_0x3c6155){return db[_0xf35b('0x1d')][_0xf35b('0x1e')](_0x2617bb[_0xf35b('0x19')],{'raw':_0x2617bb[_0xf35b('0x1a')]?_0x2617bb['options'][_0xf35b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2617bb[_0xf35b('0x1a')]?_0x2617bb['options']['where']||null:null,'attributes':_0x2617bb[_0xf35b('0x1a')]?_0x2617bb['options'][_0xf35b('0x1f')]||null:null,'limit':_0x2617bb[_0xf35b('0x1a')]?_0x2617bb[_0xf35b('0x1a')][_0xf35b('0x20')]||null:null})[_0xf35b('0xc')](function(_0x1f5cc4){logger[_0xf35b('0xd')](_0xf35b('0x1c'),_0x2617bb);logger[_0xf35b('0x21')](_0xf35b('0x1c'),_0x2617bb,JSON[_0xf35b('0x11')](_0x1f5cc4));_0x4a3a82(_0x1f5cc4);})[_0xf35b('0x16')](function(_0x2fb744){logger[_0xf35b('0x12')](_0xf35b('0x1c'),_0x2fb744['message'],_0x2617bb);_0x3c6155(_0x4e3f0a[_0xf35b('0x12')](0x1f4,_0x2fb744[_0xf35b('0x14')]));});});};