34e5a05e5bf3c3aef8ac3b87ff8946b1ed109e87
[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 _0x5717=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a2291,_0x3ddda7){var _0x10e3f5=function(_0xc510cc){while(--_0xc510cc){_0x5a2291['push'](_0x5a2291['shift']());}};_0x10e3f5(++_0x3ddda7);}(_0x5717,0x179));var _0x7571=function(_0x5089b4,_0x47154e){_0x5089b4=_0x5089b4-0x0;var _0x49a5c1=_0x5717[_0x5089b4];return _0x49a5c1;};'use strict';var _=require(_0x7571('0x0'));var util=require(_0x7571('0x1'));var moment=require(_0x7571('0x2'));var BPromise=require(_0x7571('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7571('0x4'));var db=require(_0x7571('0x5'))['db'];var utils=require(_0x7571('0x6'));var logger=require(_0x7571('0x7'))(_0x7571('0x8'));var config=require(_0x7571('0x9'));var jayson=require(_0x7571('0xa'));var client=jayson[_0x7571('0xb')][_0x7571('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x146ccb,_0x265ac0,_0x459e2a){return new BPromise(function(_0x201d71,_0x599681){return client[_0x7571('0xd')](_0x146ccb,_0x459e2a)[_0x7571('0xe')](function(_0x239f7a){logger[_0x7571('0xf')](_0x7571('0x10'),_0x265ac0,_0x7571('0x11'));logger['debug'](_0x7571('0x12'),_0x265ac0,_0x7571('0x11'),JSON[_0x7571('0x13')](_0x239f7a));if(_0x239f7a[_0x7571('0x14')]){if(_0x239f7a[_0x7571('0x14')][_0x7571('0x15')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x265ac0,_0x239f7a[_0x7571('0x14')][_0x7571('0x16')]);return _0x599681(_0x239f7a['error'][_0x7571('0x16')]);}logger[_0x7571('0x14')](_0x7571('0x10'),_0x265ac0,_0x239f7a[_0x7571('0x14')][_0x7571('0x16')]);return _0x201d71(_0x239f7a['error'][_0x7571('0x16')]);}else{logger[_0x7571('0xf')](_0x7571('0x10'),_0x265ac0,_0x7571('0x11'));_0x201d71(_0x239f7a['result'][_0x7571('0x16')]);}})[_0x7571('0x17')](function(_0x4aabdb){logger[_0x7571('0x14')](_0x7571('0x10'),_0x265ac0,_0x4aabdb);_0x599681(_0x4aabdb);});});}