[originally posted to freeswitch-dev, which seemed more appropriate, but it didn't appear]<br /><br />Hi All<br /><br />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 <br /><br /> <param name="verbose-channel-events" value="yes"/><br /><br />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:<br /><br />CF_VERBOSE_EVENTS - the "channel flag" set by the "verbose-events" dialpan app<br />SCF_VERBOSE_EVENTS - the "switch control flag", set by "verbose-channel-events" in switch.conf.xml<br />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<br /><br />In switch_core.c the SCSC_ flags are accessed via switch_core_session_ctl: <br /><br />
<p>SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *val)<br />{<br /> int *intval = (int *) val;<br /> int oldintval = 0, newintval = 0;</p>
<p> if (intval) {<br /> oldintval = *intval;<br /> }</p>
<p> if (switch_test_flag((&runtime), SCF_SHUTTING_DOWN)) {<br /> return -1;<br /> }</p>
<p> switch (cmd) {<br /> case SCSC_VERBOSE_EVENTS:<br /> if (intval) {<br /> if (oldintval > -1) {<br /> if (oldintval) {<br /> switch_set_flag((&runtime), SCF_VERBOSE_EVENTS);<br /> } else {<br /> switch_clear_flag((&runtime), SCF_VERBOSE_EVENTS);<br /> }<br /> }<br /> newintval = switch_test_flag((&runtime), SCF_VERBOSE_EVENTS);<br /> }<br /> break;<br /> ...<br /> }</p>
<p> if (intval) {<br /> *intval = newintval;<br /> }</p>
<p><br /> return 0;<br />}<br /><br />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:<br /><br />SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *channel, switch_event_t *event)<br />{<br /> switch_event_header_t *hi;<br /> int x, global_verbose_events = 0;</p>
<p> switch_mutex_lock(channel->profile_mutex);</p>
<p> switch_core_session_ctl(SCSC_VERBOSE_EVENTS, &global_verbose_events);</p>
<p> if (global_verbose_events ||<br /> switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) ||<br /> switch_event_get_header(event, "presence-data-cols") ||<br /> event->event_id == SWITCH_EVENT_CHANNEL_CREATE ||<br /> event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE || ...)<br /> // then add the variables to the event<br /><br />Because this does "global_verbose_events = 0" it always clears SCF_VERBOSE_EVENTS.<br /><br />I could easily have misuderstood, and if anyone else has had success with "verbose-channel-events" please let me know.<br /><br />Cheers<br /><br />David</p>