Revision 71a04f89 plugins/janus_audiobridge.c

View differences:

plugins/janus_audiobridge.c
500 500

  
501 501
/* Useful stuff */
502 502
static volatile gint initialized = 0, stopping = 0;
503
static gboolean notify_events = TRUE;
503 504
static janus_callbacks *gateway = NULL;
504 505
static GThread *handler_thread;
505 506
static GThread *watchdog;
......
795 796
		janus_config_item *key = janus_config_get_item_drilldown(config, "general", "admin_key");
796 797
		if(key != NULL && key->value != NULL)
797 798
			admin_key = g_strdup(key->value);
799
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
800
		if(events != NULL && events->value != NULL)
801
			notify_events = janus_is_true(events->value);
802
		if(!notify_events && callback->events_is_enabled()) {
803
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_AUDIOBRIDGE_NAME);
804
		}
798 805
		/* Iterate on all rooms */
799 806
		GList *cl = janus_config_get_categories(config);
800 807
		while(cl != NULL) {
......
1307 1314
		json_object_set_new(response, "audiobridge", json_string("created"));
1308 1315
		json_object_set_new(response, "room", json_integer(audiobridge->room_id));
1309 1316
		/* Also notify event handlers */
1310
		if(gateway->events_is_enabled()) {
1317
		if(notify_events && gateway->events_is_enabled()) {
1311 1318
			json_t *info = json_object();
1312 1319
			json_object_set_new(info, "event", json_string("created"));
1313 1320
			json_object_set_new(info, "room", json_integer(audiobridge->room_id));
......
1402 1409
		}
1403 1410
		g_free(response_text);
1404 1411
		/* Also notify event handlers */
1405
		if(gateway->events_is_enabled()) {
1412
		if(notify_events && gateway->events_is_enabled()) {
1406 1413
			json_t *info = json_object();
1407 1414
			json_object_set_new(info, "event", json_string("destroyed"));
1408 1415
			json_object_set_new(info, "room", json_integer(room_id));
......
1755 1762
		}
1756 1763
		g_free(leaving_text);
1757 1764
		/* Also notify event handlers */
1758
		if(gateway->events_is_enabled()) {
1765
		if(notify_events && gateway->events_is_enabled()) {
1759 1766
			json_t *info = json_object();
1760 1767
			json_object_set_new(info, "event", json_string("left"));
1761 1768
			json_object_set_new(info, "room", json_integer(audiobridge->room_id));
......
2100 2107
			json_object_set_new(event, "id", json_integer(user_id));
2101 2108
			json_object_set_new(event, "participants", list);
2102 2109
			/* Also notify event handlers */
2103
			if(gateway->events_is_enabled()) {
2110
			if(notify_events && gateway->events_is_enabled()) {
2104 2111
				json_t *info = json_object();
2105 2112
				json_object_set_new(info, "event", json_string("joined"));
2106 2113
				json_object_set_new(info, "room", json_integer(room_id));
......
2245 2252
			json_object_set_new(event, "audiobridge", json_string("event"));
2246 2253
			json_object_set_new(event, "result", json_string("ok"));
2247 2254
			/* Also notify event handlers */
2248
			if(gateway->events_is_enabled()) {
2255
			if(notify_events && gateway->events_is_enabled()) {
2249 2256
				janus_audiobridge_room *audiobridge = participant->room;
2250 2257
				json_t *info = json_object();
2251 2258
				json_object_set_new(info, "event", json_string("configured"));
......
2426 2433
			}
2427 2434
			g_free(leaving_text);
2428 2435
			/* Also notify event handlers */
2429
			if(gateway->events_is_enabled()) {
2436
			if(notify_events && gateway->events_is_enabled()) {
2430 2437
				json_t *info = json_object();
2431 2438
				json_object_set_new(info, "event", json_string("left"));
2432 2439
				json_object_set_new(info, "room", json_integer(old_audiobridge->room_id));
......
2503 2510
			json_object_set_new(event, "id", json_integer(user_id));
2504 2511
			json_object_set_new(event, "participants", list);
2505 2512
			/* Also notify event handlers */
2506
			if(gateway->events_is_enabled()) {
2513
			if(notify_events && gateway->events_is_enabled()) {
2507 2514
				json_t *info = json_object();
2508 2515
				json_object_set_new(info, "event", json_string("joined"));
2509 2516
				json_object_set_new(info, "room", json_integer(audiobridge->room_id));
......
2578 2585
			participant->arc = NULL;
2579 2586
			janus_mutex_unlock(&participant->rec_mutex);
2580 2587
			/* Also notify event handlers */
2581
			if(gateway->events_is_enabled()) {
2588
			if(notify_events && gateway->events_is_enabled()) {
2582 2589
				json_t *info = json_object();
2583 2590
				json_object_set_new(info, "event", json_string("left"));
2584 2591
				json_object_set_new(info, "room", json_integer(audiobridge->room_id));

Also available in: Unified diff