apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
{
	if(session->state == SESSION_STATE_TERMINATING) {
		/* session termination request has been sent, still waiting for the response,
		   all the events must be ignored at this stage */
		apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! "APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		return FALSE;
	}
	
	if(session->active_request) {
		apt_bool_t process_pending_requests = TRUE;
		/* raise app response */
		session->status = MRCP_SIG_STATUS_CODE_TERMINATE;
		mrcp_app_failure_message_raise(session);

		/* cancel remaing requests, but do process session termination request (if any) */
		do {
			session->active_request = apt_list_pop_front(session->request_queue);
			if(session->active_request) {
				const mrcp_app_message_t *app_message = session->active_request;
				if(app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING &&
					app_message->sig_message.command_id == MRCP_SIG_COMMAND_SESSION_TERMINATE) {
					/* process session termination */
					mrcp_app_request_dispatch(session,app_message);
					break;
				}

				/* cancel pending request */
				session->status = MRCP_SIG_STATUS_CODE_CANCEL;
				mrcp_app_failure_message_raise(session);
			}
			else {
				process_pending_requests = FALSE;
			}
		}
		while(process_pending_requests == TRUE);
	}
	else {
		/* raise app event */
		mrcp_app_sig_event_raise(session,NULL);
	}
	return TRUE;
}
Exemplo n.º 2
0
apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
{
	if(session->state == SESSION_STATE_TERMINATING) {
		/* session termination request has been sent, still waiting for the response,
		   all the events must be ignored at this stage */
		apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! " APT_NAMESID_FMT, 
			MRCP_SESSION_NAMESID(session));
		return FALSE;
	}

	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Mark Session as Disconnected " APT_NAMESID_FMT,
		MRCP_SESSION_NAMESID(session));
	session->disconnected = TRUE;
	if(!session->active_request) {
		/* raise app event */
		mrcp_app_sig_event_raise(session,NULL);
	}

	return TRUE;
}
Exemplo n.º 3
0
apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
{
	if(session->active_request) {
		/* raise app response */
		mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_TERMINATE,FALSE);

		/* cancel remaing requests (if any) */
		do {
			session->active_request = apt_list_pop_front(session->request_queue);
			if(session->active_request) {
				mrcp_app_sig_response_raise(session,MRCP_SIG_STATUS_CODE_CANCEL,FALSE);
			}
		}
		while(session->active_request);
	}
	else {
		/* raise app event */
		mrcp_app_sig_event_raise(session,NULL);
	}
	return TRUE;
}