Built motion from commit (unavailable).|2.5.29
[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 _0xb4e0=['error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','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'];(function(_0x11f926,_0x35320a){var _0x11f557=function(_0x295151){while(--_0x295151){_0x11f926['push'](_0x11f926['shift']());}};_0x11f557(++_0x35320a);}(_0xb4e0,0x9e));var _0x0b4e=function(_0xdbc13,_0x1925de){_0xdbc13=_0xdbc13-0x0;var _0x45ff7b=_0xb4e0[_0xdbc13];return _0x45ff7b;};'use strict';var _=require('lodash');var util=require(_0x0b4e('0x0'));var moment=require(_0x0b4e('0x1'));var BPromise=require(_0x0b4e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b4e('0x3'));var db=require(_0x0b4e('0x4'))['db'];var utils=require(_0x0b4e('0x5'));var logger=require('../../config/logger')(_0x0b4e('0x6'));var config=require(_0x0b4e('0x7'));var jayson=require(_0x0b4e('0x8'));var client=jayson[_0x0b4e('0x9')][_0x0b4e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd73486,_0x5a8791,_0x4c6ea2){return new BPromise(function(_0x234bc5,_0x4add04){return client[_0x0b4e('0xb')](_0xd73486,_0x4c6ea2)[_0x0b4e('0xc')](function(_0x2589d3){logger[_0x0b4e('0xd')](_0x0b4e('0xe'),_0x5a8791,_0x0b4e('0xf'));logger['debug'](_0x0b4e('0x10'),_0x5a8791,_0x0b4e('0xf'),JSON[_0x0b4e('0x11')](_0x2589d3));if(_0x2589d3[_0x0b4e('0x12')]){if(_0x2589d3[_0x0b4e('0x12')][_0x0b4e('0x13')]===0x1f4){logger[_0x0b4e('0x12')](_0x0b4e('0xe'),_0x5a8791,_0x2589d3[_0x0b4e('0x12')][_0x0b4e('0x14')]);return _0x4add04(_0x2589d3[_0x0b4e('0x12')]['message']);}logger[_0x0b4e('0x12')](_0x0b4e('0xe'),_0x5a8791,_0x2589d3[_0x0b4e('0x12')][_0x0b4e('0x14')]);return _0x234bc5(_0x2589d3[_0x0b4e('0x12')][_0x0b4e('0x14')]);}else{logger[_0x0b4e('0xd')]('Cdr,\x20%s,\x20%s',_0x5a8791,'request\x20sent');_0x234bc5(_0x2589d3[_0x0b4e('0x15')][_0x0b4e('0x14')]);}})['catch'](function(_0x358452){logger['error'](_0x0b4e('0xe'),_0x5a8791,_0x358452);_0x4add04(_0x358452);});});}