Built motion from commit 7158bc59.|2.5.42
[motion2.git] / server / api / voiceTransferReport / voiceTransferReport.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 _0xaf47=['info','result','catch','create','body','options','raw','CreateVoiceTransferReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3618b5,_0x3ee41b){var _0x141a4d=function(_0x1edac4){while(--_0x1edac4){_0x3618b5['push'](_0x3618b5['shift']());}};_0x141a4d(++_0x3ee41b);}(_0xaf47,0xcc));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7af4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7af4('0x1'));var rs=require(_0x7af4('0x2'));var fs=require('fs');var Redis=require(_0x7af4('0x3'));var db=require(_0x7af4('0x4'))['db'];var utils=require(_0x7af4('0x5'));var logger=require(_0x7af4('0x6'))(_0x7af4('0x7'));var config=require(_0x7af4('0x8'));var jayson=require(_0x7af4('0x9'));var client=jayson[_0x7af4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38a10d,_0x440bfa,_0x30e7e7){return new BPromise(function(_0x2fb3c1,_0x363174){return client['request'](_0x38a10d,_0x30e7e7)[_0x7af4('0xb')](function(_0x335a60){logger['info'](_0x7af4('0xc'),_0x440bfa,_0x7af4('0xd'));logger[_0x7af4('0xe')](_0x7af4('0xf'),_0x440bfa,'request\x20sent',JSON[_0x7af4('0x10')](_0x335a60));if(_0x335a60[_0x7af4('0x11')]){if(_0x335a60[_0x7af4('0x11')][_0x7af4('0x12')]===0x1f4){logger[_0x7af4('0x11')](_0x7af4('0xc'),_0x440bfa,_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);return _0x363174(_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x440bfa,_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);return _0x2fb3c1(_0x335a60['error']['message']);}else{logger[_0x7af4('0x14')](_0x7af4('0xc'),_0x440bfa,_0x7af4('0xd'));_0x2fb3c1(_0x335a60[_0x7af4('0x15')][_0x7af4('0x13')]);}})[_0x7af4('0x16')](function(_0x3c335c){logger[_0x7af4('0x11')](_0x7af4('0xc'),_0x440bfa,_0x3c335c);_0x363174(_0x3c335c);});});}exports['CreateVoiceTransferReport']=function(_0x34cf85){var _0x425643=this;return new Promise(function(_0x4c5287,_0x19ca37){return db['VoiceTransferReport'][_0x7af4('0x17')](_0x34cf85[_0x7af4('0x18')],{'raw':_0x34cf85[_0x7af4('0x19')]?_0x34cf85[_0x7af4('0x19')][_0x7af4('0x1a')]===undefined?!![]:![]:!![]})[_0x7af4('0xb')](function(_0x255b64){logger['info'](_0x7af4('0x1b'),_0x34cf85);logger[_0x7af4('0xe')](_0x7af4('0x1b'),_0x34cf85,JSON[_0x7af4('0x10')](_0x255b64));_0x4c5287(_0x255b64);})[_0x7af4('0x16')](function(_0x57f1d0){logger[_0x7af4('0x11')](_0x7af4('0x1b'),_0x57f1d0[_0x7af4('0x13')],_0x34cf85);_0x19ca37(_0x425643[_0x7af4('0x11')](0x1f4,_0x57f1d0['message']));});});};