Built motion from commit (unavailable).|2.5.16
[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 _0x3ff4=['client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46d019,_0x769b82){var _0x5da479=function(_0x5e5242){while(--_0x5e5242){_0x46d019['push'](_0x46d019['shift']());}};_0x5da479(++_0x769b82);}(_0x3ff4,0xd3));var _0x43ff=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3ff4[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x43ff('0x0'));var moment=require('moment');var BPromise=require(_0x43ff('0x1'));var rs=require(_0x43ff('0x2'));var fs=require('fs');var Redis=require(_0x43ff('0x3'));var db=require(_0x43ff('0x4'))['db'];var utils=require(_0x43ff('0x5'));var logger=require(_0x43ff('0x6'))(_0x43ff('0x7'));var config=require(_0x43ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x43ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5824b1,_0xf9557e,_0x38a53b){return new BPromise(function(_0x10a4ea,_0x469858){return client[_0x43ff('0xa')](_0x5824b1,_0x38a53b)['then'](function(_0xe0c31c){logger[_0x43ff('0xb')](_0x43ff('0xc'),_0xf9557e,_0x43ff('0xd'));logger[_0x43ff('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0xf9557e,_0x43ff('0xd'),JSON[_0x43ff('0xf')](_0xe0c31c));if(_0xe0c31c['error']){if(_0xe0c31c[_0x43ff('0x10')]['code']===0x1f4){logger[_0x43ff('0x10')](_0x43ff('0xc'),_0xf9557e,_0xe0c31c[_0x43ff('0x10')][_0x43ff('0x11')]);return _0x469858(_0xe0c31c[_0x43ff('0x10')][_0x43ff('0x11')]);}logger['error'](_0x43ff('0xc'),_0xf9557e,_0xe0c31c[_0x43ff('0x10')][_0x43ff('0x11')]);return _0x10a4ea(_0xe0c31c[_0x43ff('0x10')]['message']);}else{logger[_0x43ff('0xb')](_0x43ff('0xc'),_0xf9557e,_0x43ff('0xd'));_0x10a4ea(_0xe0c31c[_0x43ff('0x12')][_0x43ff('0x11')]);}})[_0x43ff('0x13')](function(_0x47f269){logger[_0x43ff('0x10')]('Cdr,\x20%s,\x20%s',_0xf9557e,_0x47f269);_0x469858(_0x47f269);});});}