]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add bert stats to mod_bert::lost_sync event
authorMoises Silva <moy@sangoma.com>
Thu, 11 Dec 2014 22:50:30 +0000 (17:50 -0500)
committerMoises Silva <moy@sangoma.com>
Mon, 15 Dec 2014 05:21:03 +0000 (00:21 -0500)
The following values can be read from the event:

sync_lost_percent - Error percentage within the analysis window
sync_lost_count - How many times sync has been lost
cng_count - Counter of confort noise packets
err_samples - Number of samples that did not match the sequence

src/mod/applications/mod_bert/mod_bert.c

index 72f4055e70636260d50324f934e8d50f6a629c69..a1adb2dd9d10531fce37d17bdbf9ce36a77fd6a5 100644 (file)
@@ -297,6 +297,10 @@ SWITCH_STANDARD_APP(bert_test_function)
                                        switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "true");
                                        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_LOST_SYNC) == SWITCH_STATUS_SUCCESS) {
                                                switch_channel_event_set_basic_data(channel, event);
+                                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "sync_lost_percent", "%f", err);
+                                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "sync_lost_count", "%u", bert.stats_sync_lost_cnt);
+                                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "cng_count", "%u", bert.stats_cng_cnt);
+                                               switch_event_add_header(event, SWITCH_STACK_BOTTOM, "err_samples", "%u", bert.err_samples);
                                                switch_event_fire(&event);
                                        }
                                        if (bert.hangup_on_error) {