Revision 71a04f89 plugins/janus_echotest.c

View differences:

plugins/janus_echotest.c
161 161

  
162 162
/* Useful stuff */
163 163
static volatile gint initialized = 0, stopping = 0;
164
static gboolean notify_events = TRUE;
164 165
static janus_callbacks *gateway = NULL;
165 166
static GThread *handler_thread;
166 167
static GThread *watchdog;
......
277 278
	g_snprintf(filename, 255, "%s/%s.cfg", config_path, JANUS_ECHOTEST_PACKAGE);
278 279
	JANUS_LOG(LOG_VERB, "Configuration file: %s\n", filename);
279 280
	janus_config *config = janus_config_parse(filename);
280
	if(config != NULL)
281
	if(config != NULL) {
281 282
		janus_config_print(config);
282
	/* This plugin actually has nothing to configure... */
283
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
284
		if(events != NULL && events->value != NULL)
285
			notify_events = janus_is_true(events->value);
286
		if(!notify_events && callback->events_is_enabled()) {
287
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_ECHOTEST_NAME);
288
		}
289
	}
283 290
	janus_config_destroy(config);
284 291
	config = NULL;
285 292
	
......
956 963
		g_free(event_text);
957 964
		janus_echotest_message_free(msg);
958 965

  
959
		if(gateway->events_is_enabled()) {
966
		if(notify_events && gateway->events_is_enabled()) {
960 967
			/* Just to showcase how you can notify handlers, let's update them on our configuration */
961 968
			json_t *info = json_object();
962 969
			json_object_set_new(info, "audio_active", session->audio_active ? json_true() : json_false());

Also available in: Unified diff