109d81cc6d76c46444a2fba54c24493360df2cef
[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 _0x4b67=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','error','code','Cdr,\x20%s,\x20%s','message','info','result'];(function(_0x45e23d,_0x5be96d){var _0x1b82d1=function(_0x333cde){while(--_0x333cde){_0x45e23d['push'](_0x45e23d['shift']());}};_0x1b82d1(++_0x5be96d);}(_0x4b67,0x177));var _0x74b6=function(_0x306ea0,_0x2f7e6e){_0x306ea0=_0x306ea0-0x0;var _0x2dc13f=_0x4b67[_0x306ea0];return _0x2dc13f;};'use strict';var _=require('lodash');var util=require(_0x74b6('0x0'));var moment=require(_0x74b6('0x1'));var BPromise=require(_0x74b6('0x2'));var rs=require(_0x74b6('0x3'));var fs=require('fs');var Redis=require(_0x74b6('0x4'));var db=require(_0x74b6('0x5'))['db'];var utils=require(_0x74b6('0x6'));var logger=require('../../config/logger')(_0x74b6('0x7'));var config=require(_0x74b6('0x8'));var jayson=require(_0x74b6('0x9'));var client=jayson[_0x74b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25345a,_0x17e9a5,_0x58ce2c){return new BPromise(function(_0xe9daa7,_0x4e21fa){return client[_0x74b6('0xb')](_0x25345a,_0x58ce2c)[_0x74b6('0xc')](function(_0x21b638){logger['info']('Cdr,\x20%s,\x20%s',_0x17e9a5,_0x74b6('0xd'));logger[_0x74b6('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x17e9a5,_0x74b6('0xd'),JSON['stringify'](_0x21b638));if(_0x21b638[_0x74b6('0xf')]){if(_0x21b638[_0x74b6('0xf')][_0x74b6('0x10')]===0x1f4){logger['error'](_0x74b6('0x11'),_0x17e9a5,_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);return _0x4e21fa(_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x17e9a5,_0x21b638[_0x74b6('0xf')][_0x74b6('0x12')]);return _0xe9daa7(_0x21b638[_0x74b6('0xf')]['message']);}else{logger[_0x74b6('0x13')](_0x74b6('0x11'),_0x17e9a5,_0x74b6('0xd'));_0xe9daa7(_0x21b638[_0x74b6('0x14')]['message']);}})[_0x74b6('0x15')](function(_0x2f35fb){logger[_0x74b6('0xf')](_0x74b6('0x11'),_0x17e9a5,_0x2f35fb);_0x4e21fa(_0x2f35fb);});});}