Built motion from commit (unavailable).|2.5.30
[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 _0x6eae=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x45967a,_0x474c44){var _0xf97e90=function(_0x207c36){while(--_0x207c36){_0x45967a['push'](_0x45967a['shift']());}};_0xf97e90(++_0x474c44);}(_0x6eae,0xf3));var _0xe6ea=function(_0x303258,_0x31eee5){_0x303258=_0x303258-0x0;var _0x2ebcd6=_0x6eae[_0x303258];return _0x2ebcd6;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var moment=require('moment');var BPromise=require(_0xe6ea('0x2'));var rs=require(_0xe6ea('0x3'));var fs=require('fs');var Redis=require(_0xe6ea('0x4'));var db=require(_0xe6ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6ea('0x6'))(_0xe6ea('0x7'));var config=require(_0xe6ea('0x8'));var jayson=require(_0xe6ea('0x9'));var client=jayson['client'][_0xe6ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9f33b7,_0x459e3c,_0x245e2b){return new BPromise(function(_0x5108f3,_0x3e8182){return client['request'](_0x9f33b7,_0x245e2b)[_0xe6ea('0xb')](function(_0x512398){logger[_0xe6ea('0xc')](_0xe6ea('0xd'),_0x459e3c,'request\x20sent');logger[_0xe6ea('0xe')](_0xe6ea('0xf'),_0x459e3c,_0xe6ea('0x10'),JSON['stringify'](_0x512398));if(_0x512398[_0xe6ea('0x11')]){if(_0x512398[_0xe6ea('0x11')]['code']===0x1f4){logger[_0xe6ea('0x11')](_0xe6ea('0xd'),_0x459e3c,_0x512398[_0xe6ea('0x11')][_0xe6ea('0x12')]);return _0x3e8182(_0x512398[_0xe6ea('0x11')][_0xe6ea('0x12')]);}logger[_0xe6ea('0x11')](_0xe6ea('0xd'),_0x459e3c,_0x512398['error'][_0xe6ea('0x12')]);return _0x5108f3(_0x512398[_0xe6ea('0x11')]['message']);}else{logger[_0xe6ea('0xc')](_0xe6ea('0xd'),_0x459e3c,_0xe6ea('0x10'));_0x5108f3(_0x512398['result'][_0xe6ea('0x12')]);}})[_0xe6ea('0x13')](function(_0x11339a){logger[_0xe6ea('0x11')]('Cdr,\x20%s,\x20%s',_0x459e3c,_0x11339a);_0x3e8182(_0x11339a);});});}