Revision 71a04f89 plugins/janus_videocall.c

View differences:

plugins/janus_videocall.c
319 319

  
320 320
/* Useful stuff */
321 321
static volatile gint initialized = 0, stopping = 0;
322
static gboolean notify_events = TRUE;
322 323
static janus_callbacks *gateway = NULL;
323 324
static GThread *handler_thread;
324 325
static GThread *watchdog;
......
446 447
	g_snprintf(filename, 255, "%s/%s.cfg", config_path, JANUS_VIDEOCALL_PACKAGE);
447 448
	JANUS_LOG(LOG_VERB, "Configuration file: %s\n", filename);
448 449
	janus_config *config = janus_config_parse(filename);
449
	if(config != NULL)
450
	if(config != NULL) {
450 451
		janus_config_print(config);
451
	/* This plugin actually has nothing to configure... */
452
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
453
		if(events != NULL && events->value != NULL)
454
			notify_events = janus_is_true(events->value);
455
		if(!notify_events && callback->events_is_enabled()) {
456
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_VIDEOCALL_NAME);
457
		}
458
	}
452 459
	janus_config_destroy(config);
453 460
	config = NULL;
454 461
	
......
831 838
		JANUS_LOG(LOG_VERB, "  >> %d (%s)\n", ret, janus_get_api_error(ret));
832 839
		g_free(call_text);
833 840
		/* Also notify event handlers */
834
		if(gateway->events_is_enabled()) {
841
		if(notify_events && gateway->events_is_enabled()) {
835 842
			json_t *info = json_object();
836 843
			json_object_set_new(info, "event", json_string("hangup"));
837 844
			json_object_set_new(info, "reason", json_string("Remote WebRTC hangup"));
......
961 968
			json_object_set_new(result, "event", json_string("registered"));
962 969
			json_object_set_new(result, "username", json_string(username_text));
963 970
			/* Also notify event handlers */
964
			if(gateway->events_is_enabled()) {
971
			if(notify_events && gateway->events_is_enabled()) {
965 972
				json_t *info = json_object();
966 973
				json_object_set_new(info, "event", json_string("registered"));
967 974
				json_object_set_new(info, "username", json_string(username_text));
......
1011 1018
				json_object_set_new(result, "username", json_string(session->username));
1012 1019
				json_object_set_new(result, "reason", json_string("User busy"));
1013 1020
				/* Also notify event handlers */
1014
				if(gateway->events_is_enabled()) {
1021
				if(notify_events && gateway->events_is_enabled()) {
1015 1022
					json_t *info = json_object();
1016 1023
					json_object_set_new(info, "event", json_string("hangup"));
1017 1024
					json_object_set_new(info, "reason", json_string("User busy"));
......
1071 1078
				result = json_object();
1072 1079
				json_object_set_new(result, "event", json_string("calling"));
1073 1080
				/* Also notify event handlers */
1074
				if(gateway->events_is_enabled()) {
1081
				if(notify_events && gateway->events_is_enabled()) {
1075 1082
					json_t *info = json_object();
1076 1083
					json_object_set_new(info, "event", json_string("calling"));
1077 1084
					gateway->notify_event(session->handle, info);
......
1114 1121
			result = json_object();
1115 1122
			json_object_set_new(result, "event", json_string("accepted"));
1116 1123
			/* Also notify event handlers */
1117
			if(gateway->events_is_enabled()) {
1124
			if(notify_events && gateway->events_is_enabled()) {
1118 1125
				json_t *info = json_object();
1119 1126
				json_object_set_new(info, "event", json_string("accepted"));
1120 1127
				gateway->notify_event(session->handle, info);
......
1245 1252
				janus_mutex_unlock(&session->rec_mutex);
1246 1253
			}
1247 1254
			/* Also notify event handlers */
1248
			if(gateway->events_is_enabled()) {
1255
			if(notify_events && gateway->events_is_enabled()) {
1249 1256
				json_t *info = json_object();
1250 1257
				json_object_set_new(info, "event", json_string("configured"));
1251 1258
				json_object_set_new(info, "audio_active", session->audio_active ? json_true() : json_false());
......
1282 1289
			json_object_set_new(result, "username", json_string(session->username));
1283 1290
			json_object_set_new(result, "reason", json_string("Explicit hangup"));
1284 1291
			/* Also notify event handlers */
1285
			if(gateway->events_is_enabled()) {
1292
			if(notify_events && gateway->events_is_enabled()) {
1286 1293
				json_t *info = json_object();
1287 1294
				json_object_set_new(info, "event", json_string("hangup"));
1288 1295
				json_object_set_new(info, "reason", json_string("Explicit hangup"));
......
1304 1311
				JANUS_LOG(LOG_VERB, "  >> %d (%s)\n", ret, janus_get_api_error(ret));
1305 1312
				g_free(call_text);
1306 1313
				/* Also notify event handlers */
1307
				if(gateway->events_is_enabled()) {
1314
				if(notify_events && gateway->events_is_enabled()) {
1308 1315
					json_t *info = json_object();
1309 1316
					json_object_set_new(info, "event", json_string("hangup"));
1310 1317
					json_object_set_new(info, "reason", json_string("Remote hangup"));

Also available in: Unified diff