mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	ARI: Implement channel hold/unhold.
This puts the channel on hold (rather than queueing a frame from the channel). (closes issue ASTERISK-21619) Review: https://reviewboard.asterisk.org/r/2647/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -173,6 +173,18 @@ int stasis_app_control_continue(struct stasis_app_control *control, const char *
 | 
			
		||||
 */
 | 
			
		||||
int stasis_app_control_answer(struct stasis_app_control *control);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * \brief Place the channel associated with the control on hold.
 | 
			
		||||
 * \param control Control for \c res_stasis.
 | 
			
		||||
 */
 | 
			
		||||
void stasis_app_control_hold(struct stasis_app_control *control);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * \brief Remove the channel associated with the control from hold.
 | 
			
		||||
 * \param control Control for \c res_stasis.
 | 
			
		||||
 */
 | 
			
		||||
void stasis_app_control_unhold(struct stasis_app_control *control);
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * \brief Returns the most recent snapshot for the associated channel.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -207,6 +207,32 @@ int stasis_app_control_continue(struct stasis_app_control *control, const char *
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void *app_control_hold(struct stasis_app_control *control,
 | 
			
		||||
	struct ast_channel *chan, void *data)
 | 
			
		||||
{
 | 
			
		||||
	ast_indicate(control->channel, AST_CONTROL_HOLD);
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void stasis_app_control_hold(struct stasis_app_control *control)
 | 
			
		||||
{
 | 
			
		||||
	stasis_app_send_command_async(control, app_control_hold, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void *app_control_unhold(struct stasis_app_control *control,
 | 
			
		||||
	struct ast_channel *chan, void *data)
 | 
			
		||||
{
 | 
			
		||||
	ast_indicate(control->channel, AST_CONTROL_UNHOLD);
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void stasis_app_control_unhold(struct stasis_app_control *control)
 | 
			
		||||
{
 | 
			
		||||
	stasis_app_send_command_async(control, app_control_unhold, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct ast_channel_snapshot *stasis_app_control_get_snapshot(
 | 
			
		||||
	const struct stasis_app_control *control)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -150,11 +150,32 @@ void stasis_http_unmute_channel(struct ast_variable *headers, struct ast_unmute_
 | 
			
		||||
}
 | 
			
		||||
void stasis_http_hold_channel(struct ast_variable *headers, struct ast_hold_channel_args *args, struct stasis_http_response *response)
 | 
			
		||||
{
 | 
			
		||||
	ast_log(LOG_ERROR, "TODO: stasis_http_hold_channel\n");
 | 
			
		||||
	RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
 | 
			
		||||
 | 
			
		||||
	control = find_control(response, args->channel_id);
 | 
			
		||||
	if (control == NULL) {
 | 
			
		||||
		/* Response filled in by find_control */
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stasis_app_control_hold(control);
 | 
			
		||||
 | 
			
		||||
	stasis_http_response_no_content(response);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void stasis_http_unhold_channel(struct ast_variable *headers, struct ast_unhold_channel_args *args, struct stasis_http_response *response)
 | 
			
		||||
{
 | 
			
		||||
	ast_log(LOG_ERROR, "TODO: stasis_http_unhold_channel\n");
 | 
			
		||||
	RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
 | 
			
		||||
 | 
			
		||||
	control = find_control(response, args->channel_id);
 | 
			
		||||
	if (control == NULL) {
 | 
			
		||||
		/* Response filled in by find_control */
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stasis_app_control_unhold(control);
 | 
			
		||||
 | 
			
		||||
	stasis_http_response_no_content(response);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void stasis_http_play_on_channel(struct ast_variable *headers,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user