mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	Confbridge: Add a user timeout option
This option adds the ability to specify a timeout, in seconds, for a participant in a ConfBridge. When the user's timeout has been reached, the user is ejected from the conference with the CONFBRIDGE_RESULT channel variable set to "TIMEOUT". The rationale for this change is that there have been times where we have seen channels get "stuck" in ConfBridge because a network issue results in a SIP BYE not being received by Asterisk. While these channels can be hung up manually via CLI/AMI/ARI, adding some sort of automatic cleanup of the channels is a nice feature to have. ASTERISK-25549 #close Reported by Mark Michelson Change-Id: I2996b6c5e16a3dda27595f8352abad0bda9c2d98
This commit is contained in:
		| @@ -118,6 +118,7 @@ ASTERISK_REGISTER_FILE() | ||||
| 					<value name="KICKED">The channel was kicked from the conference.</value> | ||||
| 					<value name="ENDMARKED">The channel left the conference as a result of the last marked user leaving.</value> | ||||
| 					<value name="DTMF">The channel pressed a DTMF sequence to exit the conference.</value> | ||||
| 					<value name="TIMEOUT">The channel reached its configured timeout.</value> | ||||
| 				</variable> | ||||
| 			</variablelist> | ||||
| 		</description> | ||||
| @@ -1545,6 +1546,13 @@ static int conf_get_pin(struct ast_channel *chan, struct confbridge_user *user) | ||||
| 	return -1; | ||||
| } | ||||
|  | ||||
| static int user_timeout(struct ast_bridge_channel *bridge_channel, void *ignore) | ||||
| { | ||||
| 	ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, 0); | ||||
| 	pbx_builtin_setvar_helper(bridge_channel->chan, "CONFBRIDGE_RESULT", "TIMEOUT"); | ||||
| 	return -1; | ||||
| } | ||||
|  | ||||
| static int conf_rec_name(struct confbridge_user *user, const char *conf_name) | ||||
| { | ||||
| 	char destdir[PATH_MAX]; | ||||
| @@ -1779,6 +1787,16 @@ static int confbridge_exec(struct ast_channel *chan, const char *data) | ||||
| 		ast_autoservice_stop(chan); | ||||
| 	} | ||||
|  | ||||
| 	if (user.u_profile.timeout) { | ||||
| 		ast_bridge_interval_hook(&user.features, | ||||
| 			0, | ||||
| 			user.u_profile.timeout * 1000, | ||||
| 			user_timeout, | ||||
| 			NULL, | ||||
| 			NULL, | ||||
| 			AST_BRIDGE_HOOK_REMOVE_ON_PULL); | ||||
| 	} | ||||
|  | ||||
| 	/* See if we need to automatically set this user as a video source or not */ | ||||
| 	handle_video_on_join(conference, user.chan, ast_test_flag(&user.u_profile, USER_OPT_MARKEDUSER)); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user