Built motion from commit 42801a18.|2.6.28
[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 _0x6c9f=['limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','VoiceDialReport','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','where'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6c9f,0x1c1));var _0xf6c9=function(_0x538593,_0x39c216){_0x538593=_0x538593-0x0;var _0x2aeeb3=_0x6c9f[_0x538593];return _0x2aeeb3;};'use strict';var _=require('lodash');var util=require(_0xf6c9('0x0'));var moment=require(_0xf6c9('0x1'));var BPromise=require(_0xf6c9('0x2'));var rs=require(_0xf6c9('0x3'));var fs=require('fs');var Redis=require(_0xf6c9('0x4'));var db=require(_0xf6c9('0x5'))['db'];var utils=require(_0xf6c9('0x6'));var logger=require(_0xf6c9('0x7'))(_0xf6c9('0x8'));var config=require('../../config/environment');var jayson=require(_0xf6c9('0x9'));var client=jayson[_0xf6c9('0xa')][_0xf6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58972f,_0x51be38,_0x847d8e){return new BPromise(function(_0x357a8a,_0x40440b){return client[_0xf6c9('0xc')](_0x58972f,_0x847d8e)['then'](function(_0xa1cb2e){logger['info'](_0xf6c9('0xd'),_0x51be38,_0xf6c9('0xe'));logger[_0xf6c9('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x51be38,_0xf6c9('0xe'),JSON[_0xf6c9('0x10')](_0xa1cb2e));if(_0xa1cb2e[_0xf6c9('0x11')]){if(_0xa1cb2e[_0xf6c9('0x11')]['code']===0x1f4){logger[_0xf6c9('0x11')](_0xf6c9('0xd'),_0x51be38,_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);return _0x40440b(_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);}logger[_0xf6c9('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x51be38,_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);return _0x357a8a(_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);}else{logger[_0xf6c9('0x13')](_0xf6c9('0xd'),_0x51be38,_0xf6c9('0xe'));_0x357a8a(_0xa1cb2e[_0xf6c9('0x14')][_0xf6c9('0x12')]);}})[_0xf6c9('0x15')](function(_0x543437){logger[_0xf6c9('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x51be38,_0x543437);_0x40440b(_0x543437);});});}exports['CreateVoiceDialReport']=function(_0x1626da){var _0x41402b=this;return new Promise(function(_0x9f7815,_0x3842d5){return db[_0xf6c9('0x16')]['create'](_0x1626da[_0xf6c9('0x17')],{'raw':_0x1626da['options']?_0x1626da[_0xf6c9('0x18')][_0xf6c9('0x19')]===undefined?!![]:![]:!![]})[_0xf6c9('0x1a')](function(_0x5bc89a){logger[_0xf6c9('0x13')](_0xf6c9('0x1b'),_0x1626da);logger[_0xf6c9('0xf')]('CreateVoiceDialReport',_0x1626da,JSON[_0xf6c9('0x10')](_0x5bc89a));_0x9f7815(_0x5bc89a);})[_0xf6c9('0x15')](function(_0x2cd4c7){logger[_0xf6c9('0x11')]('CreateVoiceDialReport',_0x2cd4c7[_0xf6c9('0x12')],_0x1626da);_0x3842d5(_0x41402b[_0xf6c9('0x11')](0x1f4,_0x2cd4c7['message']));});});};exports[_0xf6c9('0x1c')]=function(_0x527503){var _0x28198d=this;return new Promise(function(_0x38734e,_0x4fd431){return db[_0xf6c9('0x16')][_0xf6c9('0x1d')](_0x527503[_0xf6c9('0x17')],{'raw':_0x527503[_0xf6c9('0x18')]?_0x527503['options'][_0xf6c9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x527503[_0xf6c9('0x18')]?_0x527503[_0xf6c9('0x18')][_0xf6c9('0x1e')]||null:null,'attributes':_0x527503[_0xf6c9('0x18')]?_0x527503[_0xf6c9('0x18')]['attributes']||null:null,'limit':_0x527503['options']?_0x527503['options'][_0xf6c9('0x1f')]||null:null})[_0xf6c9('0x1a')](function(_0x314899){logger['info'](_0xf6c9('0x1c'),_0x527503);logger[_0xf6c9('0xf')]('UpdateVoiceDialReport',_0x527503,JSON['stringify'](_0x314899));_0x38734e(_0x314899);})[_0xf6c9('0x15')](function(_0x5962cb){logger[_0xf6c9('0x11')](_0xf6c9('0x1c'),_0x5962cb[_0xf6c9('0x12')],_0x527503);_0x4fd431(_0x28198d[_0xf6c9('0x11')](0x1f4,_0x5962cb[_0xf6c9('0x12')]));});});};