From 24fc0240f215927b07f6ce6070fb8d78853a8dc9 Mon Sep 17 00:00:00 2001 From: Grzegorz Sluja Date: Thu, 17 Jun 2021 14:47:53 +0200 Subject: [PATCH] VoiceService: Add CallLog parameters including RTP statistics Signed-off-by: Grzegorz Sluja --- bin/Makefile.am | 32 ++- dmtree/tr104/common.c | 214 +++++++++++++++++- dmtree/tr104/common.h | 29 +++ dmtree/tr104/servicesvoiceservice.c | 2 +- dmtree/tr104/servicesvoiceservice.h | 1 + dmtree/tr104/servicesvoiceservicecalllog.c | 172 +++++++++++++- dmtree/tr104/servicesvoiceservicecalllog.h | 11 +- .../tr104/servicesvoiceservicecalllog.c | 186 +++++++++++++++ .../tr104/servicesvoiceservicecalllog.h | 22 ++ dmtree/vendor/iopsys/tr181/vendor.c | 4 + 10 files changed, 658 insertions(+), 15 deletions(-) create mode 100644 dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c create mode 100644 dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h diff --git a/bin/Makefile.am b/bin/Makefile.am index 43061de4..6758439b 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -75,8 +75,7 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr181/qos.c \ ../dmtree/tr181/softwaremodules.c \ ../dmtree/tr181/routeradvertisement.c - -endif +endif #BBF_TR181 if BBF_TR104 libbbfdm_la_SOURCES += \ @@ -90,12 +89,12 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr104/servicesvoiceservicecallcontrol.c \ ../dmtree/tr104/servicesvoiceservicecodecprofile.c \ ../dmtree/tr104/servicesvoiceservicereservedports.c -endif +endif #BBF_TR104 if BBF_TR143 libbbfdm_la_SOURCES += \ ../dmtree/tr143/diagnostics.c -endif +endif #BBF_TR143 if BBF_VENDOR_EXTENSION @@ -104,6 +103,8 @@ libbbfdm_la_SOURCES += \ ../dmtree/vendor/vendor.c if BBF_VENDOR_IOPSYS + +if BBF_TR181 libbbfdm_la_SOURCES += \ ../dmtree/vendor/iopsys/tr181/vendor.c \ ../dmtree/vendor/iopsys/tr181/device.c \ @@ -113,25 +114,40 @@ libbbfdm_la_SOURCES += \ ../dmtree/vendor/iopsys/tr181/times.c \ ../dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c \ ../dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c -endif +endif #BBF_TR181 + +if BBF_TR104 +libbbfdm_la_SOURCES += \ + ../dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c +endif #BBF_TR104 + +endif #BBF_VENDOR_IOPSYS if BBF_VENDOR_OPENWRT + +if BBF_TR181 libbbfdm_la_SOURCES += \ ../dmtree/vendor/openwrt/tr181/vendor.c \ ../dmtree/vendor/openwrt/tr181/deviceinfo.c \ ../dmtree/vendor/openwrt/tr181/qos.c -endif +endif #BBF_TR181 + +endif #BBF_VENDOR_OPENWRT if BBF_VENDOR_TEST + +if BBF_TR181 libbbfdm_la_SOURCES += \ ../dmtree/vendor/test/tr181/vendor.c \ ../dmtree/vendor/test/tr181/deviceinfo.c \ ../dmtree/vendor/test/tr181/firewall.c \ ../dmtree/vendor/test/tr181/device.c \ ../dmtree/vendor/test/tr181/x_test_com_dropbear.c -endif +endif #BBF_TR181 -endif +endif #BBF_VENDOR_TEST + +endif #BBF_VENDOR_EXTENSION libbbfdm_la_CFLAGS = \ $(AM_CFLAGS) \ diff --git a/dmtree/tr104/common.c b/dmtree/tr104/common.c index c30dede0..87c08a94 100644 --- a/dmtree/tr104/common.c +++ b/dmtree/tr104/common.c @@ -229,6 +229,215 @@ int init_call_log() CHECK_RESULT(end); strncpy(cdr.termination_cause, token, end - token); + // session id + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.sessionId, token, end - token); + + // SIP IP Address + token = strstr(token, ",\""); + CHECK_RESULT(token); + token += 2; + end = strstr(token, "\","); + CHECK_RESULT(end); + strncpy(cdr.sipIpAddress, token, end - token); + + // Far End IP Address + token = strstr(token, ",\""); + CHECK_RESULT(token); + token += 2; + end = strstr(token, "\","); + CHECK_RESULT(end); + strncpy(cdr.farEndIPAddress, token, end - token); + + // Sip Response Code + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.sipResponseCode, token, end - token); + + // Codec + token = strstr(token, ",\""); + CHECK_RESULT(token); + token += 2; + end = strstr(token, "\","); + CHECK_RESULT(end); + strncpy(cdr.codec, token, end - token); + + // RTP statistic values + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localBurstDensity, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteBurstDensity, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localBurstDuration, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteBurstDuration, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localGapDensity, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteGapDensity, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localGapDuration, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteGapDuration, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localJbRate, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteJbRate, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localJbMax, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteJbMax, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localJbNominal, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteJbNominal, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.localJbAbsMax, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.remoteJbAbsMax, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.jbAvg, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.uLossRate, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.discarded, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.lost, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.rxpkts, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.txpkts, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.jitter, token, end - token); + + token = strstr(token, ","); + CHECK_RESULT(token); + token += 1; + end = strstr(token, ","); + CHECK_RESULT(end); + strncpy(cdr.maxJitter, token, end - token); + // Skip invalid call logs if (cdr.calling_num[0] == '\0' || cdr.called_num[0] == '\0' || cdr.start_time[0] == '\0' || end_time[0] == '\0') { @@ -246,10 +455,11 @@ int init_call_log() struct tm tm_start, tm_end; char *r1 = strptime(cdr.start_time, "%Y-%m-%d %H:%M:%S", &tm_start); char *r2 = strptime(end_time, "%Y-%m-%d %H:%M:%S", &tm_end); + if (r1 && *r1 == '\0' && r2 && *r2 == '\0') { time_t time_start, time_end; - time_start = mktime(&tm_start); - time_end = mktime(&tm_end); + time_start = timegm(&tm_start); + time_end = timegm(&tm_end); snprintf(cdr.duration, sizeof(cdr.duration), "%u", (unsigned int)(time_end - time_start)); // Convert start time to ISO 8601 date-time format as per TR-181 data model strftime(cdr.start_time, sizeof(cdr.start_time), "%Y-%m-%dT%H:%M:%SZ", &tm_start); diff --git a/dmtree/tr104/common.h b/dmtree/tr104/common.h index 86f082bb..65fed57e 100644 --- a/dmtree/tr104/common.h +++ b/dmtree/tr104/common.h @@ -31,6 +31,35 @@ struct call_log_entry { char start_time[32]; char duration[8]; char termination_cause[32]; + char sessionId[20]; + char sipIpAddress[40]; + char farEndIPAddress[40]; + char sipResponseCode[20]; + char codec[40]; + char localBurstDensity[20]; + char remoteBurstDensity[20]; + char localBurstDuration[20]; + char remoteBurstDuration[20]; + char localGapDensity[20]; + char remoteGapDensity[20]; + char localGapDuration[20]; + char remoteGapDuration[20]; + char localJbRate[20]; + char remoteJbRate[20]; + char localJbMax[20]; + char remoteJbMax[20]; + char localJbNominal[20]; + char remoteJbNominal[20]; + char localJbAbsMax[20]; + char remoteJbAbsMax[20]; + char jbAvg[20]; + char uLossRate[20]; + char discarded[20]; + char lost[20]; + char rxpkts[20]; + char txpkts[20]; + char jitter[20]; + char maxJitter[20]; }; #define MAX_SUPPORTED_CODECS 8 diff --git a/dmtree/tr104/servicesvoiceservice.c b/dmtree/tr104/servicesvoiceservice.c index a33996b7..0f227256 100644 --- a/dmtree/tr104/servicesvoiceservice.c +++ b/dmtree/tr104/servicesvoiceservice.c @@ -281,7 +281,7 @@ DMOBJ tServicesVoiceServiceObj[] = { {"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServicePOTSObj, tServicesVoiceServicePOTSParams, NULL, BBFDM_BOTH}, {"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceSIPObj, NULL, NULL, BBFDM_BOTH}, {"CallControl", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallControlObj, NULL, NULL, BBFDM_BOTH}, -{"CallLog", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogInst, NULL, NULL, NULL, tServicesVoiceServiceCallLogParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, +{"CallLog", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogInst, NULL, NULL, tServicesVoiceServiceCallLogObj, tServicesVoiceServiceCallLogParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {"VoIPProfile", &DMWRITE, addObjServicesVoiceServiceVoIPProfile, delObjServicesVoiceServiceVoIPProfile, NULL, browseServicesVoiceServiceVoIPProfileInst, NULL, NULL, tServicesVoiceServiceVoIPProfileObj, tServicesVoiceServiceVoIPProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {"CodecProfile", &DMWRITE, addObjServicesVoiceServiceCodecProfile, delObjServicesVoiceServiceCodecProfile, NULL, browseServicesVoiceServiceCodecProfileInst, NULL, NULL, NULL, tServicesVoiceServiceCodecProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", NULL}}, {0} diff --git a/dmtree/tr104/servicesvoiceservice.h b/dmtree/tr104/servicesvoiceservice.h index c9389dae..aa434d6c 100644 --- a/dmtree/tr104/servicesvoiceservice.h +++ b/dmtree/tr104/servicesvoiceservice.h @@ -23,6 +23,7 @@ extern DMOBJ tServicesVoiceServicePOTSObj[]; extern DMLEAF tServicesVoiceServicePOTSParams[]; extern DMOBJ tServicesVoiceServiceSIPObj[]; extern DMOBJ tServicesVoiceServiceCallControlObj[]; +extern DMOBJ tServicesVoiceServiceCallLogObj[]; extern DMLEAF tServicesVoiceServiceCallLogParams[]; extern DMOBJ tServicesVoiceServiceVoIPProfileObj[]; extern DMLEAF tServicesVoiceServiceVoIPProfileParams[]; diff --git a/dmtree/tr104/servicesvoiceservicecalllog.c b/dmtree/tr104/servicesvoiceservicecalllog.c index b0d7c9b5..8a0262e0 100644 --- a/dmtree/tr104/servicesvoiceservicecalllog.c +++ b/dmtree/tr104/servicesvoiceservicecalllog.c @@ -6,11 +6,22 @@ * as published by the Free Software Foundation * * Author: Yalu Zhang, yalu.zhang@iopsys.eu + * Author: Grzegorz Sluja, grzegorz.sluja@iopsys.eu */ #include "servicesvoiceservicecalllog.h" #include "common.h" +/************************************************************* +* ENTRY METHOD +**************************************************************/ +static int browseServicesVoiceServiceCallLogSessionInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + // prev_data is from its parent node SIP.Client.{i}. i.e. the UCI section of asterisk.sip_service_provider + DM_LINK_INST_OBJ(dmctx, parent_node, prev_data, "1"); + return 0; +} + /************************************************************* * GET & SET PARAM **************************************************************/ @@ -98,14 +109,87 @@ static int get_ServicesVoiceServiceCallLog_Duration(char *refparam, struct dmctx return 0; } +static int get_ServicesVoiceServiceCallLog_SessionId(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->sessionId) : "0"; + return 0; +} + static int get_ServicesVoiceServiceCallLog_CallTerminationCause(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->termination_cause) : ""; + return 0; +} - if (entry) { - *value = dmstrdup(entry->termination_cause); - } +static int get_ServicesVoiceServiceCallLog_FarEndIpAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->farEndIPAddress) : ""; + return 0; +} +static int get_ServicesVoiceServiceCallLog_SessionDSPCodec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->codec) : ""; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_PacketsDiscarded(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->discarded) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_PacketsLost(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->lost) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->rxpkts) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->txpkts) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_AverageReceiveInterarrivalJitter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->jbAvg) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_FarEndInterarrivalJitter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->jitter) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_FarEndPacketLossRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->uLossRate) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_MaxJitter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->maxJitter) : "0"; return 0; } @@ -113,6 +197,12 @@ static int get_ServicesVoiceServiceCallLog_CallTerminationCause(char *refparam, * OBJ & PARAM DEFINITION ***********************************************************************************************************************************/ /* *** Device.Services.VoiceService.{i}.CallLog.{i}. *** */ +DMOBJ tServicesVoiceServiceCallLogObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Session", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCallLogSessionInst, NULL, NULL, tServicesVoiceServiceCallLogSessionObj, tServicesVoiceServiceCallLogSessionParams, NULL, BBFDM_BOTH}, +{0} +}; + DMLEAF tServicesVoiceServiceCallLogParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ {"CallingPartyNumber", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_CallingPartyNumber, NULL, BBFDM_BOTH}, @@ -127,3 +217,79 @@ DMLEAF tServicesVoiceServiceCallLogParams[] = { {0} }; +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}. *** */ +DMOBJ tServicesVoiceServiceCallLogSessionObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"Destination", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionDestinationObj, NULL, NULL, BBFDM_BOTH}, +{"Source", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionSourceObj, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tServicesVoiceServiceCallLogSessionParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Duration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Duration, NULL, BBFDM_BOTH}, +{"Start", &DMREAD, DMT_TIME, get_ServicesVoiceServiceCallLog_Start, NULL, BBFDM_BOTH}, +{"SessionID", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_SessionId, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination. *** */ +DMOBJ tServicesVoiceServiceCallLogSessionDestinationObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DSP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionDestinationDSPObj, NULL, NULL, BBFDM_BOTH}, +{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source. *** */ +DMOBJ tServicesVoiceServiceCallLogSessionSourceObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"DSP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionSourceDSPObj, NULL, NULL, BBFDM_BOTH}, +{"RTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionSourceRTPParams, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination.DSP. *** */ +DMOBJ tServicesVoiceServiceCallLogSessionDestinationDSPObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ReceiveCodec", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionDestinationDSPCodecParams, NULL, BBFDM_BOTH}, +{"TransmitCodec", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionDestinationDSPCodecParams, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.DSP. *** */ +DMOBJ tServicesVoiceServiceCallLogSessionSourceDSPObj[] = { +/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ +{"ReceiveCodec", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionSourceDSPCodecParams, NULL, BBFDM_BOTH}, +{"TransmitCodec", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCallLogSessionSourceDSPCodecParams, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination.DSP.ReceiveCodec. *** */ +DMLEAF tServicesVoiceServiceCallLogSessionDestinationDSPCodecParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Codec", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_SessionDSPCodec, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.DSP.ReceiveCodec. *** */ +DMLEAF tServicesVoiceServiceCallLogSessionSourceDSPCodecParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"Codec", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_SessionDSPCodec, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.RTP. *** */ +DMLEAF tServicesVoiceServiceCallLogSessionSourceRTPParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{"FarEndIPAddress", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_FarEndIpAddress, NULL, BBFDM_BOTH}, +{"PacketsDiscarded", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_PacketsDiscarded, NULL, BBFDM_BOTH}, +{"PacketsLost", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_PacketsLost, NULL, BBFDM_BOTH}, +{"PacketsReceived", &DMREAD, DMT_UNLONG, get_ServicesVoiceServiceCallLog_Src_PacketsReceived, NULL, BBFDM_BOTH}, +{"PacketsSent", &DMREAD, DMT_UNLONG, get_ServicesVoiceServiceCallLog_Src_PacketsSent, NULL, BBFDM_BOTH}, +{"AverageReceiveInterarrivalJitter", &DMREAD, DMT_INT, get_ServicesVoiceServiceCallLog_Src_AverageReceiveInterarrivalJitter, NULL, BBFDM_BOTH}, +{"FarEndInterarrivalJitter", &DMREAD, DMT_INT, get_ServicesVoiceServiceCallLog_Src_FarEndInterarrivalJitter, NULL, BBFDM_BOTH}, +{"FarEndPacketLossRate", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_FarEndPacketLossRate, NULL, BBFDM_BOTH}, +{"MaxJitter", &DMREAD, DMT_INT, get_ServicesVoiceServiceCallLog_Src_MaxJitter, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/tr104/servicesvoiceservicecalllog.h b/dmtree/tr104/servicesvoiceservicecalllog.h index ae4d1263..e3e720d1 100644 --- a/dmtree/tr104/servicesvoiceservicecalllog.h +++ b/dmtree/tr104/servicesvoiceservicecalllog.h @@ -13,8 +13,17 @@ #include +extern DMOBJ tServicesVoiceServiceCallLogObj[]; extern DMLEAF tServicesVoiceServiceCallLogParams[]; - +extern DMOBJ tServicesVoiceServiceCallLogSessionObj[]; +extern DMLEAF tServicesVoiceServiceCallLogSessionParams[]; +extern DMOBJ tServicesVoiceServiceCallLogSessionDestinationObj[]; +extern DMOBJ tServicesVoiceServiceCallLogSessionSourceObj[]; +extern DMOBJ tServicesVoiceServiceCallLogSessionDestinationDSPObj[]; +extern DMOBJ tServicesVoiceServiceCallLogSessionSourceDSPObj[]; +extern DMLEAF tServicesVoiceServiceCallLogSessionDestinationDSPCodecParams[]; +extern DMLEAF tServicesVoiceServiceCallLogSessionSourceDSPCodecParams[]; +extern DMLEAF tServicesVoiceServiceCallLogSessionSourceRTPParams[]; #endif //__SERVICESVOICESERVICECALLLOG_H diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c new file mode 100644 index 00000000..0a94bfd4 --- /dev/null +++ b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2021 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * Author Grzegorz Sluja + */ + +#include "servicesvoiceservicecalllog.h" +#include "common.h" + +static int get_ServicesVoiceServiceCallLog_SessionId(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->sessionId) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_SipIpAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->sipIpAddress) : ""; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_SipResponseCode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->sipResponseCode) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_BurstDensity(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localBurstDensity) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_BurstDensity(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteBurstDensity) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_BurstDuration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localBurstDuration) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_BurstDuration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteBurstDuration) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_GapDensity(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localGapDensity) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_GapDensity(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteGapDensity) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_GapDuration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localGapDuration) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_GapDuration(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteGapDuration) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_JBAvgDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localJbRate) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_JBAvgDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteJbRate) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_JBMaxDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localJbMax) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_JBMaxDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteJbMax) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_JBNomDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localJbNominal) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_JBNomDelay(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteJbNominal) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Src_PeakJitter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->localJbAbsMax) : "0"; + return 0; +} + +static int get_ServicesVoiceServiceCallLog_Dst_PeakJitter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct call_log_entry *entry = (struct call_log_entry *)data; + *value = (entry) ? dmstrdup(entry->remoteJbAbsMax) : "0"; + return 0; +} + +/********************************************************************************************************************************** +* OBJ & PARAM DEFINITION +***********************************************************************************************************************************/ +/* *** Device.Services.VoiceService.{i}.CallLog.{i}. *** */ +DMLEAF tIOPSYS_VoiceServiceCallLogParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"SIPSession-ID", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_SessionId, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"SIPIPAddress", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCallLog_SipIpAddress, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"SIPResponseCode", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_SipResponseCode, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.RTP. *** */ +DMLEAF tIOPSYS_VoiceServiceCallLogSessionSourceRTPParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"BurstDensity", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_BurstDensity, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"BurstDuration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_BurstDuration, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"GapDensity", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_GapDensity, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"GapDuration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_GapDuration, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBAvgDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_JBAvgDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBMaxDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_JBMaxDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBNomDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_JBNomDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"PeakJitter", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Src_PeakJitter, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination.RTP. *** */ +DMLEAF tIOPSYS_VoiceServiceCallLogSessionDestinationRTPParams[] = { +/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ +{BBF_VENDOR_PREFIX"BurstDensity", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_BurstDensity, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"BurstDuration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_BurstDuration, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"GapDensity", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_GapDensity, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"GapDuration", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_GapDuration, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBAvgDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_JBAvgDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBMaxDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_JBMaxDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"JBNomDelay", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_JBNomDelay, NULL, BBFDM_BOTH}, +{BBF_VENDOR_PREFIX"PeakJitter", &DMREAD, DMT_UNINT, get_ServicesVoiceServiceCallLog_Dst_PeakJitter, NULL, BBFDM_BOTH}, +{0} +}; diff --git a/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h new file mode 100644 index 00000000..0db9c635 --- /dev/null +++ b/dmtree/vendor/iopsys/tr104/servicesvoiceservicecalllog.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2021 iopsys Software Solutions AB + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation + * + * Author Amin Ben Ramdhane + * Author Grzegorz Sluja + */ + +#ifndef __IOPSYS_VOICESERVICECALLLOG_H +#define __IOPSYS_VOICESERVICECALLLOG_H + +#include + +extern DMLEAF tIOPSYS_VoiceServiceCallLogParams[]; +extern DMLEAF tIOPSYS_VoiceServiceCallLogSessionSourceRTPParams[]; +extern DMLEAF tIOPSYS_VoiceServiceCallLogSessionDestinationRTPParams[]; + +#endif //__IOPSYS_VOICESERVICECALLLOG_H + diff --git a/dmtree/vendor/iopsys/tr181/vendor.c b/dmtree/vendor/iopsys/tr181/vendor.c index ca0245d1..d96f76fc 100644 --- a/dmtree/vendor/iopsys/tr181/vendor.c +++ b/dmtree/vendor/iopsys/tr181/vendor.c @@ -15,6 +15,7 @@ #include "ethernet.h" #include "ip.h" #include "times.h" +#include "../tr104/servicesvoiceservicecalllog.h" #include "vendor.h" DM_MAP_OBJ tVendorExtensionIOPSYS[] = { @@ -25,5 +26,8 @@ DM_MAP_OBJ tVendorExtensionIOPSYS[] = { {"Device.Time.", NULL, tIOPSYS_TimeParams}, {"Device.Bridging.Bridge.{i}.Port.{i}.", NULL, tIOPSYS_BridgingBridgePortParams}, {"Device.Bridging.Bridge.{i}.VLAN.{i}.", NULL, tIOPSYS_BridgingBridgeVLANParams}, +{"Device.Services.VoiceService.{i}.CallLog.{i}.", NULL, tIOPSYS_VoiceServiceCallLogParams}, +{"Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Source.RTP.", NULL, tIOPSYS_VoiceServiceCallLogSessionSourceRTPParams}, +{"Device.Services.VoiceService.{i}.CallLog.{i}.Session.{i}.Destination.RTP.", NULL, tIOPSYS_VoiceServiceCallLogSessionDestinationRTPParams}, {0} };