Built motion from commit c116dc8b.|2.6.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 _0x0d71=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x588ebe,_0x464ea3){var _0x1c239e=function(_0x4a5291){while(--_0x4a5291){_0x588ebe['push'](_0x588ebe['shift']());}};_0x1c239e(++_0x464ea3);}(_0x0d71,0x1a4));var _0x10d7=function(_0x1e3711,_0x554fbc){_0x1e3711=_0x1e3711-0x0;var _0xff7e2b=_0x0d71[_0x1e3711];return _0xff7e2b;};'use strict';var _=require(_0x10d7('0x0'));var util=require(_0x10d7('0x1'));var moment=require('moment');var BPromise=require(_0x10d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10d7('0x3'));var db=require(_0x10d7('0x4'))['db'];var utils=require(_0x10d7('0x5'));var logger=require(_0x10d7('0x6'))(_0x10d7('0x7'));var config=require(_0x10d7('0x8'));var jayson=require(_0x10d7('0x9'));var client=jayson[_0x10d7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae121,_0x368a64,_0x12a43f){return new BPromise(function(_0x2ffc7e,_0x2b2ba4){return client[_0x10d7('0xb')](_0x3ae121,_0x12a43f)[_0x10d7('0xc')](function(_0x1792d8){logger['info'](_0x10d7('0xd'),_0x368a64,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x368a64,'request\x20sent',JSON[_0x10d7('0xe')](_0x1792d8));if(_0x1792d8['error']){if(_0x1792d8[_0x10d7('0xf')][_0x10d7('0x10')]===0x1f4){logger[_0x10d7('0xf')](_0x10d7('0xd'),_0x368a64,_0x1792d8[_0x10d7('0xf')][_0x10d7('0x11')]);return _0x2b2ba4(_0x1792d8[_0x10d7('0xf')][_0x10d7('0x11')]);}logger[_0x10d7('0xf')](_0x10d7('0xd'),_0x368a64,_0x1792d8[_0x10d7('0xf')][_0x10d7('0x11')]);return _0x2ffc7e(_0x1792d8['error'][_0x10d7('0x11')]);}else{logger[_0x10d7('0x12')](_0x10d7('0xd'),_0x368a64,'request\x20sent');_0x2ffc7e(_0x1792d8[_0x10d7('0x13')]['message']);}})['catch'](function(_0x18c1b7){logger['error']('Cdr,\x20%s,\x20%s',_0x368a64,_0x18c1b7);_0x2b2ba4(_0x18c1b7);});});}