From ce6a5bdf2e3f7c8d1bd7d1b2115b3a8f8500c139 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 27 Sep 2013 06:23:11 +0800 Subject: [PATCH] use sonar_channel_event to get a verbose event --- src/mod/applications/mod_sonar/mod_sonar.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/applications/mod_sonar/mod_sonar.c b/src/mod/applications/mod_sonar/mod_sonar.c index 2a338282f9..06bf99b78d 100644 --- a/src/mod/applications/mod_sonar/mod_sonar.c +++ b/src/mod/applications/mod_sonar/mod_sonar.c @@ -170,6 +170,8 @@ SWITCH_STANDARD_APP(sonar_app) ph.min, ph.max, avg, mdev, loops, ph.received, lost, lost * 1.0 / loops); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, "sonar::ping") == SWITCH_STATUS_SUCCESS) { + const char *verbose_event; + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_min", "%d", ph.min); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_max", "%d", ph.max); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_avg", "%d", avg); @@ -182,6 +184,13 @@ SWITCH_STANDARD_APP(sonar_app) switch_channel_get_variable(channel, "ping_destination_number")); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sonar_ping_ref", switch_channel_get_variable(channel, "sonar_ping_ref")); + + verbose_event = switch_channel_get_variable(channel, "sonar_channel_event"); + + if (verbose_event && switch_true(verbose_event)) { + switch_channel_event_set_data(channel, event); + } + switch_event_fire(&event); }