Built motion from commit (unavailable).|2.5.6
[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 _0x5e50=['../../config/utils','rpc','../../config/environment','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x187ee8,_0x38ecef){var _0x4acd8c=function(_0x3a9c4e){while(--_0x3a9c4e){_0x187ee8['push'](_0x187ee8['shift']());}};_0x4acd8c(++_0x38ecef);}(_0x5e50,0x1dd));var _0x05e5=function(_0x557d83,_0x3ce17b){_0x557d83=_0x557d83-0x0;var _0x3ca85c=_0x5e50[_0x557d83];return _0x3ca85c;};'use strict';var _=require('lodash');var util=require(_0x05e5('0x0'));var moment=require(_0x05e5('0x1'));var BPromise=require(_0x05e5('0x2'));var rs=require(_0x05e5('0x3'));var fs=require('fs');var Redis=require(_0x05e5('0x4'));var db=require(_0x05e5('0x5'))['db'];var utils=require(_0x05e5('0x6'));var logger=require('../../config/logger')(_0x05e5('0x7'));var config=require(_0x05e5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa737b2,_0x15ae78,_0x375830){return new BPromise(function(_0x512132,_0x42f73d){return client[_0x05e5('0x9')](_0xa737b2,_0x375830)[_0x05e5('0xa')](function(_0x364e62){logger[_0x05e5('0xb')]('Cdr,\x20%s,\x20%s',_0x15ae78,'request\x20sent');logger[_0x05e5('0xc')](_0x05e5('0xd'),_0x15ae78,'request\x20sent',JSON[_0x05e5('0xe')](_0x364e62));if(_0x364e62['error']){if(_0x364e62[_0x05e5('0xf')][_0x05e5('0x10')]===0x1f4){logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);return _0x42f73d(_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);}logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);return _0x512132(_0x364e62['error'][_0x05e5('0x12')]);}else{logger[_0x05e5('0xb')](_0x05e5('0x11'),_0x15ae78,'request\x20sent');_0x512132(_0x364e62[_0x05e5('0x13')][_0x05e5('0x12')]);}})[_0x05e5('0x14')](function(_0x254417){logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x254417);_0x42f73d(_0x254417);});});}