aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-12 21:08:42 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-05-17 17:23:57 +0200
commit77ff1c40e28d4e7a8000be5293e9352e85b9f31b (patch)
tree4a7aaa6f17d64bfa56c61be23acddb460e121a9f
parent446f8403d1072b5a7aa7d5a3d55106b36a64941d (diff)
cdr: Remember the charging id supplied by the GGSN
The charging_id is provided by the GGSN. Copy it into the CDR part of the data structure so it will remain present until after the pdp context has been deleted.
-rw-r--r--openbsc/include/openbsc/gprs_sgsn.h1
-rw-r--r--openbsc/src/gprs/sgsn_cdr.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/gprs_sgsn.h b/openbsc/include/openbsc/gprs_sgsn.h
index c88a2bbe7..4bbde9c44 100644
--- a/openbsc/include/openbsc/gprs_sgsn.h
+++ b/openbsc/include/openbsc/gprs_sgsn.h
@@ -212,6 +212,7 @@ struct sgsn_pdp_ctx {
struct timespec cdr_start; /* The start of the CDR */
uint64_t cdr_bytes_in;
uint64_t cdr_bytes_out;
+ uint32_t cdr_charging_id;
};
#define LOGPDPCTXP(level, pdp, fmt, args...) \
diff --git a/openbsc/src/gprs/sgsn_cdr.c b/openbsc/src/gprs/sgsn_cdr.c
index 0fcdd3b2a..04084f5b2 100644
--- a/openbsc/src/gprs/sgsn_cdr.c
+++ b/openbsc/src/gprs/sgsn_cdr.c
@@ -64,7 +64,7 @@ static void maybe_print_header(FILE *cdr_file)
if (ftell(cdr_file) != 0)
return;
- fprintf(cdr_file, "timestamp,imsi,imei,msisdn,cell_id,lac,event,pdp_duration,ggsn_addr,sgsn_addr,apni,eua_addr,vol_in,vol_out\n");
+ fprintf(cdr_file, "timestamp,imsi,imei,msisdn,cell_id,lac,event,pdp_duration,ggsn_addr,sgsn_addr,apni,eua_addr,vol_in,vol_out,charging_id\n");
}
static void cdr_log_mm(struct sgsn_instance *inst, const char *ev,
@@ -171,7 +171,7 @@ static void cdr_log_pdp(struct sgsn_instance *inst, const char *ev,
duration = tp.tv_sec - pdp->cdr_start.tv_sec;
fprintf(cdr_file,
- "%04d%02d%02d%02d%02d%02d%03d,%s,%s,%s,%d,%d,%s,%ld,%s,%s,%s,%s,%" PRIu64 ",%" PRIu64 "\n",
+ "%04d%02d%02d%02d%02d%02d%03d,%s,%s,%s,%d,%d,%s,%ld,%s,%s,%s,%s,%" PRIu64 ",%" PRIu64 ",%u\n",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec,
(int)(tv.tv_usec / 1000),
@@ -187,7 +187,8 @@ static void cdr_log_pdp(struct sgsn_instance *inst, const char *ev,
apni,
eua_addr,
pdp->cdr_bytes_in,
- pdp->cdr_bytes_out);
+ pdp->cdr_bytes_out,
+ pdp->cdr_charging_id);
fclose(cdr_file);
}
@@ -222,6 +223,7 @@ static int handle_sgsn_sig(unsigned int subsys, unsigned int signal,
break;
case S_SGSN_PDP_ACT:
clock_gettime(CLOCK_MONOTONIC, &signal_data->pdp->cdr_start);
+ signal_data->pdp->cdr_charging_id = signal_data->pdp->lib->cid;
cdr_log_pdp(inst, "pdp-act", signal_data->pdp);
signal_data->pdp->cdr_timer.cb = cdr_pdp_timeout;
signal_data->pdp->cdr_timer.data = signal_data->pdp;