Browse code

rtpengine: query rtt per call leg

root authored on 24/11/2020 21:06:21
Showing 1 changed files
... ...
@@ -148,6 +148,7 @@ struct minmax_mos_stats {
148 148
 	str packetloss_param;
149 149
 	str jitter_param;
150 150
 	str roundtrip_param;
151
+	str roundtrip_leg_param;
151 152
 	str samples_param;
152 153
 
153 154
 	pv_elem_t *mos_pv;
... ...
@@ -155,6 +156,7 @@ struct minmax_mos_stats {
155 156
 	pv_elem_t *packetloss_pv;
156 157
 	pv_elem_t *jitter_pv;
157 158
 	pv_elem_t *roundtrip_pv;
159
+	pv_elem_t *roundtrip_leg_pv;
158 160
 	pv_elem_t *samples_pv;
159 161
 };
160 162
 struct minmax_mos_label_stats {
... ...
@@ -173,6 +175,7 @@ struct minmax_stats_vals {
173 175
 	long long packetloss;
174 176
 	long long jitter;
175 177
 	long long roundtrip;
178
+	long long roundtrip_leg;
176 179
 	long long samples;
177 180
 	long long avg_samples; /* our own running count to average the averages */
178 181
 };
... ...
@@ -462,15 +465,18 @@ static param_export_t params[] = {
462 465
 	{"mos_min_packetloss_pv",     PARAM_STR, &global_mos_stats.min.packetloss_param      },
463 466
 	{"mos_min_jitter_pv",         PARAM_STR, &global_mos_stats.min.jitter_param          },
464 467
 	{"mos_min_roundtrip_pv",      PARAM_STR, &global_mos_stats.min.roundtrip_param       },
468
+	{"mos_min_roundtrip_leg_pv",  PARAM_STR, &global_mos_stats.min.roundtrip_leg_param   },
465 469
 	{"mos_max_pv",                PARAM_STR, &global_mos_stats.max.mos_param             },
466 470
 	{"mos_max_at_pv",             PARAM_STR, &global_mos_stats.max.at_param              },
467 471
 	{"mos_max_packetloss_pv",     PARAM_STR, &global_mos_stats.max.packetloss_param      },
468 472
 	{"mos_max_jitter_pv",         PARAM_STR, &global_mos_stats.max.jitter_param          },
469 473
 	{"mos_max_roundtrip_pv",      PARAM_STR, &global_mos_stats.max.roundtrip_param       },
474
+	{"mos_max_roundtrip_leg_pv",  PARAM_STR, &global_mos_stats.max.roundtrip_leg_param   },
470 475
 	{"mos_average_pv",            PARAM_STR, &global_mos_stats.average.mos_param         },
471 476
 	{"mos_average_packetloss_pv", PARAM_STR, &global_mos_stats.average.packetloss_param  },
472 477
 	{"mos_average_jitter_pv",     PARAM_STR, &global_mos_stats.average.jitter_param      },
473 478
 	{"mos_average_roundtrip_pv",  PARAM_STR, &global_mos_stats.average.roundtrip_param   },
479
+	{"mos_average_roundtrip_leg_pv", PARAM_STR, &global_mos_stats.average.roundtrip_leg_param },
474 480
 	{"mos_average_samples_pv",    PARAM_STR, &global_mos_stats.average.samples_param     },
475 481
 
476 482
 	/* designated side A */
... ...
@@ -480,15 +486,18 @@ static param_export_t params[] = {
480 486
 	{"mos_min_packetloss_A_pv",     PARAM_STR, &side_A_mos_stats.min.packetloss_param      },
481 487
 	{"mos_min_jitter_A_pv",         PARAM_STR, &side_A_mos_stats.min.jitter_param          },
482 488
 	{"mos_min_roundtrip_A_pv",      PARAM_STR, &side_A_mos_stats.min.roundtrip_param       },
489
+	{"mos_min_roundtrip_leg_A_pv",  PARAM_STR, &side_A_mos_stats.min.roundtrip_leg_param   },
483 490
 	{"mos_max_A_pv",                PARAM_STR, &side_A_mos_stats.max.mos_param             },
484 491
 	{"mos_max_at_A_pv",             PARAM_STR, &side_A_mos_stats.max.at_param              },
485 492
 	{"mos_max_packetloss_A_pv",     PARAM_STR, &side_A_mos_stats.max.packetloss_param      },
486 493
 	{"mos_max_jitter_A_pv",         PARAM_STR, &side_A_mos_stats.max.jitter_param          },
487 494
 	{"mos_max_roundtrip_A_pv",      PARAM_STR, &side_A_mos_stats.max.roundtrip_param       },
495
+	{"mos_max_roundtrip_leg_A_pv",  PARAM_STR, &side_A_mos_stats.max.roundtrip_leg_param   },
488 496
 	{"mos_average_A_pv",            PARAM_STR, &side_A_mos_stats.average.mos_param         },
489 497
 	{"mos_average_packetloss_A_pv", PARAM_STR, &side_A_mos_stats.average.packetloss_param  },
490 498
 	{"mos_average_jitter_A_pv",     PARAM_STR, &side_A_mos_stats.average.jitter_param      },
491 499
 	{"mos_average_roundtrip_A_pv",  PARAM_STR, &side_A_mos_stats.average.roundtrip_param   },
500
+	{"mos_average_roundtrip_leg_A_pv",  PARAM_STR, &side_A_mos_stats.average.roundtrip_leg_param },
492 501
 	{"mos_average_samples_A_pv",    PARAM_STR, &side_A_mos_stats.average.samples_param     },
493 502
 
494 503
 	/* designated side B */
... ...
@@ -498,15 +507,18 @@ static param_export_t params[] = {
498 507
 	{"mos_min_packetloss_B_pv",     PARAM_STR, &side_B_mos_stats.min.packetloss_param      },
499 508
 	{"mos_min_jitter_B_pv",         PARAM_STR, &side_B_mos_stats.min.jitter_param          },
500 509
 	{"mos_min_roundtrip_B_pv",      PARAM_STR, &side_B_mos_stats.min.roundtrip_param       },
510
+	{"mos_min_roundtrip_B_pv",      PARAM_STR, &side_B_mos_stats.min.roundtrip_param       },
501 511
 	{"mos_max_B_pv",                PARAM_STR, &side_B_mos_stats.max.mos_param             },
502 512
 	{"mos_max_at_B_pv",             PARAM_STR, &side_B_mos_stats.max.at_param              },
503 513
 	{"mos_max_packetloss_B_pv",     PARAM_STR, &side_B_mos_stats.max.packetloss_param      },
504 514
 	{"mos_max_jitter_B_pv",         PARAM_STR, &side_B_mos_stats.max.jitter_param          },
505 515
 	{"mos_max_roundtrip_B_pv",      PARAM_STR, &side_B_mos_stats.max.roundtrip_param       },
516
+	{"mos_max_roundtrip_leg_B_pv",  PARAM_STR, &side_B_mos_stats.max.roundtrip_leg_param   },
506 517
 	{"mos_average_B_pv",            PARAM_STR, &side_B_mos_stats.average.mos_param         },
507 518
 	{"mos_average_packetloss_B_pv", PARAM_STR, &side_B_mos_stats.average.packetloss_param  },
508 519
 	{"mos_average_jitter_B_pv",     PARAM_STR, &side_B_mos_stats.average.jitter_param      },
509 520
 	{"mos_average_roundtrip_B_pv",  PARAM_STR, &side_B_mos_stats.average.roundtrip_param   },
521
+	{"mos_average_roundtrip_leg_B_pv",  PARAM_STR, &side_B_mos_stats.average.roundtrip_leg_param },
510 522
 	{"mos_average_samples_B_pv",    PARAM_STR, &side_B_mos_stats.average.samples_param     },
511 523
 
512 524
 	{0, 0, 0}
... ...
@@ -1924,6 +1936,8 @@ static int minmax_pv_parse(struct minmax_mos_stats *s, int *got_any) {
1924 1936
 		return -1;
1925 1937
 	if (pv_parse_var(&s->roundtrip_param, &s->roundtrip_pv, got_any))
1926 1938
 		return -1;
1939
+	if (pv_parse_var(&s->roundtrip_leg_param, &s->roundtrip_leg_pv, got_any))
1940
+		return -1;
1927 1941
 	if (pv_parse_var(&s->samples_param, &s->samples_pv, got_any))
1928 1942
 		return -1;
1929 1943
 	return 0;
... ...
@@ -3273,6 +3287,7 @@ static void avp_print_mos(struct minmax_mos_stats *s, struct minmax_stats_vals *
3273 3287
 	avp_print_int(s->packetloss_pv, vals->packetloss / vals->avg_samples, msg);
3274 3288
 	avp_print_int(s->jitter_pv, vals->jitter / vals->avg_samples, msg);
3275 3289
 	avp_print_int(s->roundtrip_pv, vals->roundtrip / vals->avg_samples, msg);
3290
+	avp_print_int(s->roundtrip_leg_pv, vals->roundtrip_leg / vals->avg_samples, msg);
3276 3291
 	avp_print_int(s->samples_pv, vals->samples / vals->avg_samples, msg);
3277 3292
 }
3278 3293
 
... ...
@@ -3288,6 +3303,8 @@ static int decode_mos_vals_dict(struct minmax_stats_vals *vals, bencode_item_t *
3288 3303
 	vals->packetloss = bencode_dictionary_get_integer(mos_ent, "packet loss", -1);
3289 3304
 	vals->jitter = bencode_dictionary_get_integer(mos_ent, "jitter", -1);
3290 3305
 	vals->roundtrip = bencode_dictionary_get_integer(mos_ent, "round-trip time", -1);
3306
+	vals->roundtrip_leg = bencode_dictionary_get_integer(mos_ent, "round-trip time leg", -1);
3307
+	// long long int ssrc = bencode_dictionary_get_integer(mos_ent, "SSRC", -1);
3291 3308
 	vals->samples = bencode_dictionary_get_integer(mos_ent, "samples", -1);
3292 3309
 	vals->avg_samples = 1;
3293 3310
 
... ...
@@ -3417,6 +3434,7 @@ ssrc_ok:
3417 3434
 			average_vals.packetloss += vals_decoded.packetloss;
3418 3435
 			average_vals.jitter += vals_decoded.jitter;
3419 3436
 			average_vals.roundtrip += vals_decoded.roundtrip;
3437
+			average_vals.roundtrip_leg += vals_decoded.roundtrip_leg;
3420 3438
 			average_vals.samples += vals_decoded.samples;
3421 3439
 		}
3422 3440