aec5702fb2eb40525e792010db150149fa602449
[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 _0xdb21=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x206592,_0x581d8b){var _0x419419=function(_0x159084){while(--_0x159084){_0x206592['push'](_0x206592['shift']());}};_0x419419(++_0x581d8b);}(_0xdb21,0x1e5));var _0x1db2=function(_0x4d18c2,_0x9b85d0){_0x4d18c2=_0x4d18c2-0x0;var _0x1cadf9=_0xdb21[_0x4d18c2];return _0x1cadf9;};'use strict';var _=require(_0x1db2('0x0'));var util=require(_0x1db2('0x1'));var moment=require(_0x1db2('0x2'));var BPromise=require(_0x1db2('0x3'));var rs=require(_0x1db2('0x4'));var fs=require('fs');var Redis=require(_0x1db2('0x5'));var db=require(_0x1db2('0x6'))['db'];var utils=require(_0x1db2('0x7'));var logger=require(_0x1db2('0x8'))(_0x1db2('0x9'));var config=require(_0x1db2('0xa'));var jayson=require(_0x1db2('0xb'));var client=jayson['client'][_0x1db2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5da7,_0x4ccb28,_0x49d790){return new BPromise(function(_0x2d568c,_0x25a4a0){return client[_0x1db2('0xd')](_0x5c5da7,_0x49d790)['then'](function(_0xdeb4eb){logger[_0x1db2('0xe')](_0x1db2('0xf'),_0x4ccb28,_0x1db2('0x10'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4ccb28,_0x1db2('0x10'),JSON[_0x1db2('0x11')](_0xdeb4eb));if(_0xdeb4eb['error']){if(_0xdeb4eb['error'][_0x1db2('0x12')]===0x1f4){logger[_0x1db2('0x13')](_0x1db2('0xf'),_0x4ccb28,_0xdeb4eb[_0x1db2('0x13')][_0x1db2('0x14')]);return _0x25a4a0(_0xdeb4eb[_0x1db2('0x13')][_0x1db2('0x14')]);}logger['error'](_0x1db2('0xf'),_0x4ccb28,_0xdeb4eb[_0x1db2('0x13')]['message']);return _0x2d568c(_0xdeb4eb[_0x1db2('0x13')]['message']);}else{logger[_0x1db2('0xe')](_0x1db2('0xf'),_0x4ccb28,_0x1db2('0x10'));_0x2d568c(_0xdeb4eb[_0x1db2('0x15')][_0x1db2('0x14')]);}})['catch'](function(_0x37b523){logger[_0x1db2('0x13')](_0x1db2('0xf'),_0x4ccb28,_0x37b523);_0x25a4a0(_0x37b523);});});}