Built motion from commit (unavailable).|2.5.0
[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 _0xb31a=['create','body','options','raw','debug','update','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb31a,0xd4));var _0xab31=function(_0x3efb62,_0x521e4b){_0x3efb62=_0x3efb62-0x0;var _0x852069=_0xb31a[_0x3efb62];return _0x852069;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var moment=require(_0xab31('0x2'));var BPromise=require(_0xab31('0x3'));var rs=require(_0xab31('0x4'));var fs=require('fs');var Redis=require(_0xab31('0x5'));var db=require(_0xab31('0x6'))['db'];var utils=require(_0xab31('0x7'));var logger=require(_0xab31('0x8'))(_0xab31('0x9'));var config=require(_0xab31('0xa'));var jayson=require(_0xab31('0xb'));var client=jayson[_0xab31('0xc')][_0xab31('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b8f95,_0x53ee8e,_0x45b0ef){return new BPromise(function(_0x1eaa9c,_0x48be26){return client[_0xab31('0xe')](_0x2b8f95,_0x45b0ef)[_0xab31('0xf')](function(_0xfcbafd){logger[_0xab31('0x10')](_0xab31('0x11'),_0x53ee8e,_0xab31('0x12'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x53ee8e,_0xab31('0x12'),JSON[_0xab31('0x13')](_0xfcbafd));if(_0xfcbafd['error']){if(_0xfcbafd[_0xab31('0x14')][_0xab31('0x15')]===0x1f4){logger[_0xab31('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x53ee8e,_0xfcbafd['error'][_0xab31('0x16')]);return _0x48be26(_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);}logger[_0xab31('0x14')](_0xab31('0x11'),_0x53ee8e,_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);return _0x1eaa9c(_0xfcbafd[_0xab31('0x14')][_0xab31('0x16')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x53ee8e,_0xab31('0x12'));_0x1eaa9c(_0xfcbafd['result'][_0xab31('0x16')]);}})[_0xab31('0x17')](function(_0x3b803d){logger[_0xab31('0x14')](_0xab31('0x11'),_0x53ee8e,_0x3b803d);_0x48be26(_0x3b803d);});});}exports[_0xab31('0x18')]=function(_0x1b3f47){var _0x4c7d92=this;return new Promise(function(_0x2015cd,_0x3c56a6){return db[_0xab31('0x19')][_0xab31('0x1a')](_0x1b3f47[_0xab31('0x1b')],{'raw':_0x1b3f47['options']?_0x1b3f47[_0xab31('0x1c')][_0xab31('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x483e73){logger[_0xab31('0x10')](_0xab31('0x18'),_0x1b3f47);logger[_0xab31('0x1e')]('CreateVoiceDialReport',_0x1b3f47,JSON[_0xab31('0x13')](_0x483e73));_0x2015cd(_0x483e73);})[_0xab31('0x17')](function(_0x4a723c){logger['error'](_0xab31('0x18'),_0x4a723c[_0xab31('0x16')],_0x1b3f47);_0x3c56a6(_0x4c7d92[_0xab31('0x14')](0x1f4,_0x4a723c[_0xab31('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x3a9997){var _0x5db7fd=this;return new Promise(function(_0x192f44,_0x1ceba6){return db['VoiceDialReport'][_0xab31('0x1f')](_0x3a9997['body'],{'raw':_0x3a9997[_0xab31('0x1c')]?_0x3a9997[_0xab31('0x1c')][_0xab31('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9997['options']?_0x3a9997[_0xab31('0x1c')]['where']||null:null,'attributes':_0x3a9997['options']?_0x3a9997[_0xab31('0x1c')]['attributes']||null:null,'limit':_0x3a9997[_0xab31('0x1c')]?_0x3a9997['options'][_0xab31('0x20')]||null:null})[_0xab31('0xf')](function(_0x30473c){logger[_0xab31('0x10')](_0xab31('0x21'),_0x3a9997);logger[_0xab31('0x1e')](_0xab31('0x21'),_0x3a9997,JSON[_0xab31('0x13')](_0x30473c));_0x192f44(_0x30473c);})[_0xab31('0x17')](function(_0x95a4b9){logger[_0xab31('0x14')](_0xab31('0x21'),_0x95a4b9[_0xab31('0x16')],_0x3a9997);_0x1ceba6(_0x5db7fd['error'](0x1f4,_0x95a4b9[_0xab31('0x16')]));});});};