ca97f97808a7aa4b3f0fa002926e60699a50f9b2
[motion2.git] / server / api / cdr / cdr.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 _0xf977=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x3f3d4a,_0x29db30){var _0x32e876=function(_0x815fdd){while(--_0x815fdd){_0x3f3d4a['push'](_0x3f3d4a['shift']());}};_0x32e876(++_0x29db30);}(_0xf977,0x82));var _0x7f97=function(_0x41d436,_0x2b97f2){_0x41d436=_0x41d436-0x0;var _0x19e918=_0xf977[_0x41d436];return _0x19e918;};'use strict';var _=require(_0x7f97('0x0'));var util=require(_0x7f97('0x1'));var moment=require(_0x7f97('0x2'));var BPromise=require(_0x7f97('0x3'));var rs=require(_0x7f97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7f97('0x5'));var logger=require('../../config/logger')(_0x7f97('0x6'));var config=require(_0x7f97('0x7'));var jayson=require(_0x7f97('0x8'));var client=jayson[_0x7f97('0x9')][_0x7f97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x542d00,_0x4c86ca,_0x48523d){return new BPromise(function(_0x3fdcaa,_0x56cde7){return client[_0x7f97('0xb')](_0x542d00,_0x48523d)[_0x7f97('0xc')](function(_0x583a76){logger[_0x7f97('0xd')](_0x7f97('0xe'),_0x4c86ca,_0x7f97('0xf'));logger['debug'](_0x7f97('0x10'),_0x4c86ca,'request\x20sent',JSON['stringify'](_0x583a76));if(_0x583a76[_0x7f97('0x11')]){if(_0x583a76[_0x7f97('0x11')][_0x7f97('0x12')]===0x1f4){logger[_0x7f97('0x11')]('Cdr,\x20%s,\x20%s',_0x4c86ca,_0x583a76[_0x7f97('0x11')][_0x7f97('0x13')]);return _0x56cde7(_0x583a76['error'][_0x7f97('0x13')]);}logger[_0x7f97('0x11')](_0x7f97('0xe'),_0x4c86ca,_0x583a76['error']['message']);return _0x3fdcaa(_0x583a76[_0x7f97('0x11')][_0x7f97('0x13')]);}else{logger[_0x7f97('0xd')]('Cdr,\x20%s,\x20%s',_0x4c86ca,_0x7f97('0xf'));_0x3fdcaa(_0x583a76[_0x7f97('0x14')][_0x7f97('0x13')]);}})[_0x7f97('0x15')](function(_0x5db77c){logger[_0x7f97('0x11')](_0x7f97('0xe'),_0x4c86ca,_0x5db77c);_0x56cde7(_0x5db77c);});});}