[Freeswitch-dev] Verbose Events
Michael Jerris
mike at jerris.com
Thu Nov 18 09:19:05 PST 2010
A patch went in earlier this week on this issue.
Mike
On Nov 16, 2010, at 5:37 AM, David Brazier wrote:
> [same as last message, better formatting!]
>
> Hi All
>
> I want to get session variables on all events. I have tried using the "verbose-events" dialplan app but that isn't convenient to use when bridging. So I have set
>
> <param name="verbose-channel-events" value="yes"/>
>
> in switch.conf.xml & restarted to make sure. But I still don't see variables on all events, for example CHANNEL_CALLSTATE. In the source code, there are 3 related flags:
>
> 1. CF_VERBOSE_EVENTS - the "channel flag" set by the "verbose-events" dialpan app
>
> 2. SCF_VERBOSE_EVENTS - the "switch control flag", set by "verbose-channel-events" in switch.conf.xml
>
> 3. SCSC_VERBOSE_EVENTS - used by "fsctl verbose_events" - actually SCSC_VERBOSE_EVENTS is only an internal name for the command - using "fsctl verbose_events" sets or clears SCF_VERBOSE_EVENTS
>
> In switch_core.c the SCSC_ flags are accessed via switch_core_session_ctl:
>
> SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *val) {
> int *intval = (int *) val;
> int oldintval = 0, newintval = 0;
>
> if (intval) {
> oldintval = *intval;
> }
>
> if (switch_test_flag((&runtime), SCF_SHUTTING_DOWN)) {
> return -1;
> }
>
> switch (cmd) {
> case SCSC_VERBOSE_EVENTS:
> if (intval) {
> if (oldintval > -1) {
> if (oldintval) {
> switch_set_flag((&runtime), SCF_VERBOSE_EVENTS);
> } else {
> switch_clear_flag((&runtime), SCF_VERBOSE_EVENTS);
> }
> }
> newintval = switch_test_flag((&runtime), SCF_VERBOSE_EVENTS);
> }
> break;
> ...
> }
>
> if (intval) {
> *intval = newintval;
> }
>
>
> return 0;
> }
>
> If I read this right, the caller can use this to just get the flag without setting it by setting val to -1 initially. However, in switch_channel.c where it is deciding whether to do a verbose event:
>
> SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *channel, switch_event_t *event) {
> switch_event_header_t *hi;
> int x, global_verbose_events = 0;
>
> switch_mutex_lock(channel->profile_mutex);
>
> switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &global_verbose_events);
>
> if (global_verbose_events ||
> switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) ||
> switch_event_get_header(event, "presence-data-cols") ||
> event->event_id == SWITCH_EVENT_CHANNEL_CREATE ||
> event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE || ...)
> // then add the variables to the event
>
> Because this does "global_verbose_events = 0" it always clears SCF_VERBOSE_EVENTS.
>
> I could easily have misuderstood, and if anyone else has had success with "verbose-channel-events" please let me know.
>
> Cheers
>
> David
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
More information about the FreeSWITCH-dev
mailing list