179f37f62bda5086b98e0d4a022788712495fc5b
[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 _0x14ef=['error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x238c67,_0x4c409e){var _0x51d179=function(_0x24ab46){while(--_0x24ab46){_0x238c67['push'](_0x238c67['shift']());}};_0x51d179(++_0x4c409e);}(_0x14ef,0x158));var _0xf14e=function(_0x2f888d,_0x597d3c){_0x2f888d=_0x2f888d-0x0;var _0x40f285=_0x14ef[_0x2f888d];return _0x40f285;};'use strict';var _=require(_0xf14e('0x0'));var util=require(_0xf14e('0x1'));var moment=require('moment');var BPromise=require(_0xf14e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf14e('0x3'));var db=require(_0xf14e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf14e('0x5'))(_0xf14e('0x6'));var config=require(_0xf14e('0x7'));var jayson=require(_0xf14e('0x8'));var client=jayson[_0xf14e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a594,_0xd72758,_0x51e46e){return new BPromise(function(_0x61d4a7,_0x8ec369){return client['request'](_0x41a594,_0x51e46e)[_0xf14e('0xa')](function(_0x55b89f){logger[_0xf14e('0xb')](_0xf14e('0xc'),_0xd72758,_0xf14e('0xd'));logger[_0xf14e('0xe')](_0xf14e('0xf'),_0xd72758,_0xf14e('0xd'),JSON['stringify'](_0x55b89f));if(_0x55b89f[_0xf14e('0x10')]){if(_0x55b89f[_0xf14e('0x10')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0xd72758,_0x55b89f[_0xf14e('0x10')][_0xf14e('0x11')]);return _0x8ec369(_0x55b89f[_0xf14e('0x10')][_0xf14e('0x11')]);}logger[_0xf14e('0x10')](_0xf14e('0xc'),_0xd72758,_0x55b89f[_0xf14e('0x10')][_0xf14e('0x11')]);return _0x61d4a7(_0x55b89f[_0xf14e('0x10')][_0xf14e('0x11')]);}else{logger['info'](_0xf14e('0xc'),_0xd72758,_0xf14e('0xd'));_0x61d4a7(_0x55b89f[_0xf14e('0x12')][_0xf14e('0x11')]);}})[_0xf14e('0x13')](function(_0x32affb){logger[_0xf14e('0x10')](_0xf14e('0xc'),_0xd72758,_0x32affb);_0x8ec369(_0x32affb);});});}