Built motion from commit 746c7d2a.|2.5.35
[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 _0xc84a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0xce09a,_0x537b1d){var _0x53ec17=function(_0x14ff12){while(--_0x14ff12){_0xce09a['push'](_0xce09a['shift']());}};_0x53ec17(++_0x537b1d);}(_0xc84a,0x15c));var _0xac84=function(_0x49ee56,_0x273ea6){_0x49ee56=_0x49ee56-0x0;var _0x1ec73f=_0xc84a[_0x49ee56];return _0x1ec73f;};'use strict';var _=require(_0xac84('0x0'));var util=require(_0xac84('0x1'));var moment=require('moment');var BPromise=require(_0xac84('0x2'));var rs=require(_0xac84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac84('0x4'))['db'];var utils=require(_0xac84('0x5'));var logger=require(_0xac84('0x6'))(_0xac84('0x7'));var config=require(_0xac84('0x8'));var jayson=require(_0xac84('0x9'));var client=jayson['client'][_0xac84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5afdee,_0x3be8f0,_0x14618b){return new BPromise(function(_0x1cc6b1,_0x5a962d){return client['request'](_0x5afdee,_0x14618b)[_0xac84('0xb')](function(_0xb752e7){logger['info'](_0xac84('0xc'),_0x3be8f0,_0xac84('0xd'));logger[_0xac84('0xe')](_0xac84('0xf'),_0x3be8f0,_0xac84('0xd'),JSON['stringify'](_0xb752e7));if(_0xb752e7[_0xac84('0x10')]){if(_0xb752e7[_0xac84('0x10')][_0xac84('0x11')]===0x1f4){logger[_0xac84('0x10')]('Cdr,\x20%s,\x20%s',_0x3be8f0,_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);return _0x5a962d(_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);}logger[_0xac84('0x10')](_0xac84('0xc'),_0x3be8f0,_0xb752e7[_0xac84('0x10')][_0xac84('0x12')]);return _0x1cc6b1(_0xb752e7['error'][_0xac84('0x12')]);}else{logger[_0xac84('0x13')]('Cdr,\x20%s,\x20%s',_0x3be8f0,_0xac84('0xd'));_0x1cc6b1(_0xb752e7[_0xac84('0x14')][_0xac84('0x12')]);}})[_0xac84('0x15')](function(_0x2722e3){logger['error'](_0xac84('0xc'),_0x3be8f0,_0x2722e3);_0x5a962d(_0x2722e3);});});}