wlan-ap-Telecominfraproject/feeds/wlan-ap/opensync/patches/22-new-voice-video-detect-params.patch
Yashvardhan 6ae7f08d90 opensync: Rebased 57c3a1c to fix build errors
Signed-off-by: Yashvardhan <yashvardhan@netexperience.com>
2020-10-21 23:25:35 +02:00

248 lines
8.1 KiB
Diff

--- a/src/sm/src/ucc_report.c
+++ b/src/sm/src/ucc_report.c
@@ -21,6 +21,7 @@
#include "nl_ucc.h"
#define MODULE_ID LOG_MODULE_ID_MAIN
+#define IFNAME_LEN (8)
/* new part */
typedef struct
@@ -42,6 +43,16 @@ static sm_ucc_ctx_t g_sm_uc
/******************************************************************************
* PROTECTED definitions
*****************************************************************************/
+/*
+ * get_if_name: Get ifname of wifi interface
+ */
+void get_if_name(unsigned int id, char *ifname) {
+
+ snprintf(ifname, IFNAME_LEN, "wlan%d", id);
+// memcpy(ifname, itoa(id));
+
+}
+
static
void sm_ucc_report(struct wc_capture_buf *rbuf)
{
@@ -52,9 +63,29 @@ void sm_ucc_report(struct wc_capture_buf
struct sip_call_start *SipCallStart = NULL;
struct sip_call_end *SipCallEnd = NULL;
struct sip_call_report *SipCallReport = NULL;
+ unsigned int chan = 0;
+ radio_type_t band = 0;
+
+ char *ifname = (char *)malloc(IFNAME_LEN);
/* Get ucc stats */
+ /* Get channel and radio type */
+
+ memset(ifname, 0, IFNAME_LEN);
+ if (rbuf->wifiIf >= 0) {
+ get_if_name(rbuf->wifiIf, ifname);
+
+ if(target_stats_channel_get(ifname, &chan)) {
+ if (chan <= 16)
+ band = RADIO_TYPE_2G;
+ else if (chan >= 32 && chan <= 68)
+ band = RADIO_TYPE_5GL;
+ else if (chan >= 96)
+ band = RADIO_TYPE_5GU;
+ }
+ }
+
/* Report_timestamp is base-timestamp + relative start time offset */
report_ctx->timestamp_ms =
request_ctx->reporting_timestamp - ucc_ctx->report_ts +
@@ -78,6 +109,8 @@ void sm_ucc_report(struct wc_capture_buf
memcpy( &(report_ctx->record.sip_call_start.provider_domain[0]),
&(SipCallStart->Url[0]), 50 );
+ report_ctx->record.sip_call_start.channel = chan;
+ report_ctx->record.sip_call_start.band = band;
break;
case PKT_TYPE_CALL_STOP:
@@ -94,6 +127,12 @@ void sm_ucc_report(struct wc_capture_buf
report_ctx->record.sip_call_stop.reason = SipCallEnd->Reason;
report_ctx->record.sip_call_stop.session_id = SipCallEnd->SessionId;
+ report_ctx->record.sip_call_stop.channel = chan;
+ report_ctx->record.sip_call_stop.band = band;
+ memcpy(&(report_ctx->record.sip_call_stop.provider_domain[0]),
+ &(SipCallEnd->Url[0]), 50);
+ memcpy( &(report_ctx->record.sip_call_stop.codecs[0]),
+ &(SipCallEnd->codecs[0]), 4 );
/* Stats Currently unimplemented */
report_ctx->record.sip_call_stop.call_duration = 0;
@@ -127,6 +166,12 @@ void sm_ucc_report(struct wc_capture_buf
report_ctx->record.sip_call_report.stats.jitter = SipCallReport->Jitter;
report_ctx->record.sip_call_report.stats.packet_loss_consec = SipCallReport->PacketLoss;
report_ctx->record.sip_call_report.stats.MOSx100 = SipCallReport->Mos;
+ report_ctx->record.sip_call_report.channel = chan;
+ report_ctx->record.sip_call_report.band = band;
+ memcpy(&(report_ctx->record.sip_call_report.provider_domain[0]),
+ &(SipCallReport->Url[0]), 50);
+ memcpy( &(report_ctx->record.sip_call_report.codecs[0]),
+ &(SipCallReport->codecs[0]), 4 );
break;
default:
--- a/interfaces/opensync_stats.proto
+++ b/interfaces/opensync_stats.proto
@@ -596,6 +596,8 @@ message CallStart {
repeated string codecs = 4;
optional string provider_domain = 5;
optional string device_info = 6;
+ optional uint32 channel = 7;
+ required RadioBandType band = 8;
}
message CallStop {
@@ -610,6 +612,10 @@ message CallStop {
optional CallStopReason reason = 4;
optional uint32 call_duration = 5;
repeated RtpFlowStats stats = 6;
+ optional uint32 channel = 7;
+ required RadioBandType band = 8;
+ repeated string codecs = 9;
+ optional string provider_domain = 10;
}
message CallReport {
@@ -624,6 +630,10 @@ message CallReport {
optional bytes client_mac = 3;
repeated RtpFlowStats stats = 4;
optional CallReportReason reason = 5;
+ optional uint32 channel = 6;
+ required RadioBandType band = 7;
+ repeated string codecs = 8;
+ optional string provider_domain = 9;
}
message StreamingVideoDetectPattern {
--- a/src/lib/datapipeline/inc/dpp_ucc.h
+++ b/src/lib/datapipeline/inc/dpp_ucc.h
@@ -40,6 +40,8 @@ typedef struct
char codecs[15][30];
char provider_domain[50];
char device_info[10];
+ uint32_t channel;
+ radio_type_t band;
} dpp_ucc_sipcall_start_t;
@@ -51,6 +53,10 @@ typedef struct
sipcall_stopreason_t reason;
uint32_t call_duration; // call duration in seconds
rtp_flow_stats_t stats;
+ uint32_t channel;
+ radio_type_t band;
+ char codecs[4];
+ char provider_domain[50];
} dpp_ucc_sipcall_stop_t;
@@ -61,6 +67,10 @@ typedef struct
char clt_mac[6];
rtp_flow_stats_t stats;
sip_call_report_reason_t reason;
+ uint32_t channel;
+ radio_type_t band;
+ char codecs[4];
+ char provider_domain[50];
} dpp_ucc_sipcall_report_t;
typedef struct
--- a/src/sm/src/nl_ucc.h
+++ b/src/sm/src/nl_ucc.h
@@ -70,6 +70,8 @@ struct sip_call_end
unsigned int RtpSeqFirst;
unsigned int RtpSeqLast;
unsigned int SipReportIdx;
+ char Url[50];
+ char codecs[4];
} __attribute__((packed));
@@ -79,6 +81,8 @@ struct sip_call_report
unsigned int Jitter;
unsigned int PacketLoss;
unsigned int Mos;
+ char Url[50];
+ char codecs[4];
} __attribute__((packed));
--- a/src/lib/datapipeline/src/dppline.c
+++ b/src/lib/datapipeline/src/dppline.c
@@ -2615,6 +2615,9 @@ static void dppline_add_stat_ucc(Sts__Re
memcpy(sr->call_start->provider_domain,
ucc->record.sip_call_start.provider_domain,
sizeof(ucc->record.sip_call_start.provider_domain));
+ sr->call_start->channel = ucc->record.sip_call_start.channel;
+ sr->call_start->has_channel = true;
+ sr->call_start->band = dppline_to_proto_radio(ucc->record.sip_call_start.band);
break;
case PKT_TYPE_CALL_STOP:
@@ -2647,6 +2650,19 @@ static void dppline_add_stat_ucc(Sts__Re
sr->call_stop->reason = ucc->record.sip_call_stop.reason;
sr->call_stop->has_reason = true;
+ sr->call_stop->channel = ucc->record.sip_call_stop.channel;
+ sr->call_stop->has_channel = true;
+ sr->call_stop->band = dppline_to_proto_radio(ucc->record.sip_call_stop.band);
+
+ sr->call_stop->provider_domain = malloc(sizeof(ucc->record.sip_call_stop.provider_domain));
+
+ size += sizeof(ucc->record.sip_call_stop.provider_domain);
+ assert(sr->call_stop->provider_domain);
+
+ memcpy(sr->call_stop->provider_domain,
+ ucc->record.sip_call_stop.provider_domain,
+ sizeof(ucc->record.sip_call_stop.provider_domain));
+
break;
case PKT_TYPE_CALL_REPORT:
@@ -2680,6 +2696,18 @@ static void dppline_add_stat_ucc(Sts__Re
sr->call_report->reason = ucc->record.sip_call_report.reason;
sr->call_report->has_reason = true;
+ sr->call_report->channel = ucc->record.sip_call_report.channel;
+ sr->call_report->has_channel = true;
+ sr->call_report->band = dppline_to_proto_radio(ucc->record.sip_call_report.band);
+
+ sr->call_report->provider_domain = malloc(sizeof(ucc->record.sip_call_report.provider_domain));
+
+ size += sizeof(ucc->record.sip_call_report.provider_domain);
+ assert(sr->call_report->provider_domain);
+
+ memcpy(sr->call_report->provider_domain,
+ ucc->record.sip_call_report.provider_domain,
+ sizeof(ucc->record.sip_call_report.provider_domain));
break;
default:
--- a/src/lib/target/inc/target_common.h
+++ b/src/lib/target/inc/target_common.h
@@ -879,6 +879,15 @@ bool target_set_mld_mcproxy_sys_params(s
*/
bool target_get_mld_mcproxy_sys_params(struct schema_MLD_Config *iccfg);
+/******************************************************************************
+ * UCC voice video detect definitions
+ *****************************************************************************/
+
+/*
+ * @brief Get channel info
+ * @return true if successful
+ */
+bool target_stats_channel_get(char *radio_if, unsigned int *chan);
/******************************************************************************
* PLATFORM SPECIFIC definitions