Пример #1
0
static apt_bool_t mrcp_client_connection_task_msg_signal(
							connection_agent_task_msg_type_e type,
							mrcp_connection_agent_t         *agent, 
							mrcp_control_channel_t          *channel,
							mrcp_control_descriptor_t       *descriptor,
							mrcp_message_t                  *message,
							apt_bool_t                       status)
{
	apt_task_t *task;
	apt_task_msg_t *task_msg;
	connection_agent_task_msg_data_t *data;
	mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent);
	if(!client || !client->cnt_msg_pool) {
		return FALSE;
	}
	task = apt_consumer_task_base_get(client->task);
	task_msg = apt_task_msg_acquire(client->cnt_msg_pool);
	task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG;
	task_msg->sub_type = type;
	data = (connection_agent_task_msg_data_t*) task_msg->data;
	data->channel = channel ? channel->obj : NULL;
	data->descriptor = descriptor;
	data->message = message;
	data->status = status;

	return apt_task_msg_signal(task,task_msg);
}
Пример #2
0
static apt_bool_t mrcp_client_signaling_task_msg_signal(sig_agent_task_msg_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
{
	sig_agent_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
	task_msg->type = MRCP_CLIENT_SIGNALING_TASK_MSG;
	task_msg->sub_type = type;
	data = (sig_agent_task_msg_data_t*) task_msg->data;
	data->session = (mrcp_client_session_t*)session;
	data->descriptor = descriptor;
	data->message = message;

	return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
}
Пример #3
0
static apt_bool_t consumer_task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
{
	apt_consumer_task_t *consumer_task;
	apt_task_t *task;
	apt_task_vtable_t *vtable;
	apt_task_msg_pool_t *msg_pool;
	apt_task_msg_t *msg;
	sample_msg_data_t *data;
	int i;
	
	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sample_msg_data_t),suite->pool);

	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
	consumer_task = apt_consumer_task_create(NULL,msg_pool,suite->pool);
	if(!consumer_task) {
		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
		return FALSE;
	}
	task = apt_consumer_task_base_get(consumer_task);
	vtable = apt_task_vtable_get(task);
	if(vtable) {
		vtable->process_msg = task_msg_process;
		vtable->on_start_complete = task_on_start_complete;
		vtable->on_terminate_complete = task_on_terminate_complete;
	}

	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
	if(apt_task_start(task) == FALSE) {
		apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
		apt_task_destroy(task);
		return FALSE;
	}

	for(i=0; i<10; i++) {
		msg = apt_task_msg_acquire(msg_pool);
		msg->type = TASK_MSG_USER;
		data = (sample_msg_data_t*) msg->data;

		data->number = i;
		data->timestamp = apr_time_now();
		apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message [%d]",data->number);
		apt_task_msg_signal(task,msg);
	}

	apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
	apt_task_terminate(task,TRUE);
	apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
	apt_task_destroy(task);
	return TRUE;
}
Пример #4
0
static apt_bool_t mrcp_server_signaling_task_msg_signal(mrcp_signaling_message_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
{
	mrcp_signaling_message_t *signaling_message;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
	mrcp_signaling_message_t **slot = ((mrcp_signaling_message_t**)task_msg->data);
	task_msg->type = MRCP_SERVER_SIGNALING_TASK_MSG;
	task_msg->sub_type = type;
	
	signaling_message = apr_palloc(session->pool,sizeof(mrcp_signaling_message_t));
	signaling_message->type = type;
	signaling_message->session = (mrcp_server_session_t*)session;
	signaling_message->descriptor = descriptor;
	signaling_message->channel = NULL;
	signaling_message->message = message;
	*slot = signaling_message;
	
	return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
}
Пример #5
0
static apt_bool_t mrcp_server_engine_task_msg_signal(
							engine_task_msg_type_e  type,
							mrcp_engine_t          *engine,
							apt_bool_t              status)
{
	mrcp_server_t *server = engine->event_obj;
	apt_task_t *task = apt_consumer_task_base_get(server->task);
	engine_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool);
	task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG;
	task_msg->sub_type = type;
	data = (engine_task_msg_data_t*) task_msg->data;
	data->engine = engine;
	data->channel = NULL;
	data->status = status;
	data->mrcp_message = NULL;

	return apt_task_msg_signal(task,task_msg);
}
Пример #6
0
apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
{
	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
	mrcp_application_t *application = client_session->application;
	apt_task_t *task = apt_consumer_task_base_get(application->client->task);
	apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
	if(task_msg) {
		mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
		mrcp_app_message_t *app_message;
		task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;

		app_message = mrcp_client_app_control_message_create(session->pool);
		app_message->application = client_session->application;
		app_message->session = session;
		app_message->channel = channel;
		app_message->control_message = message;
		*slot = app_message;
	}
	return apt_task_msg_signal(task,task_msg);
}
Пример #7
0
static apt_bool_t mrcp_client_connection_task_msg_signal(
							connection_agent_task_msg_type_e type,
							mrcp_connection_agent_t         *agent, 
							mrcp_control_channel_t          *channel,
							mrcp_control_descriptor_t       *descriptor,
							mrcp_message_t                  *message)
{
	mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent);
	apt_task_t *task = apt_consumer_task_base_get(client->task);
	connection_agent_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(client->cnt_msg_pool);
	task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG;
	task_msg->sub_type = type;
	data = (connection_agent_task_msg_data_t*) task_msg->data;
	data->channel = channel ? channel->obj : NULL;
	data->descriptor = descriptor;
	data->message = message;

	apt_log(APT_PRIO_DEBUG,"Signal Connection Task Message");
	return apt_task_msg_signal(task,task_msg);
}
Пример #8
0
static apt_bool_t mrcp_server_engine_task_msg_signal(
							resource_engine_task_msg_type_e  type,
							mrcp_engine_channel_t           *engine_channel,
							apt_bool_t                       status,
							mrcp_message_t                  *message)
{
	mrcp_channel_t *channel = engine_channel->event_obj;
	mrcp_session_t *session = mrcp_server_channel_session_get(channel);
	mrcp_server_t *server = session->signaling_agent->parent;
	apt_task_t *task = apt_consumer_task_base_get(server->task);
	resource_engine_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->resource_engine_msg_pool);
	task_msg->type = MRCP_SERVER_RESOURCE_ENGINE_TASK_MSG;
	task_msg->sub_type = type;
	data = (resource_engine_task_msg_data_t*) task_msg->data;
	data->channel = channel;
	data->status = status;
	data->mrcp_message = message;

	apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Resource Engine Task Message");
	return apt_task_msg_signal(task,task_msg);
}
Пример #9
0
static apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
{
	mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
	mrcp_application_t *application = client_session->application;
	apt_task_t *task = apt_consumer_task_base_get(application->client->task);
	apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
	if(task_msg) {
		mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
		mrcp_app_message_t *app_message;
		task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;

		app_message = apr_palloc(session->pool,sizeof(mrcp_app_message_t));
		app_message->message_type = MRCP_APP_MESSAGE_TYPE_CONTROL;
		app_message->application = client_session->application;
		app_message->session = session;
		app_message->channel = channel;
		app_message->control_message = message;
		*slot = app_message;
	}
	apt_log(APT_PRIO_DEBUG,"Signal Application Task Message");
	return apt_task_msg_signal(task,task_msg);
}
Пример #10
0
static apt_bool_t mrcp_server_channel_task_msg_signal(
							engine_task_msg_type_e  type,
							mrcp_engine_channel_t  *engine_channel,
							apt_bool_t              status,
							mrcp_message_t         *message)
{
	mrcp_channel_t *channel = engine_channel->event_obj;
	mrcp_session_t *session = mrcp_server_channel_session_get(channel);
	mrcp_server_t *server = session->signaling_agent->parent;
	apt_task_t *task = apt_consumer_task_base_get(server->task);
	engine_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool);
	task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG;
	task_msg->sub_type = type;
	data = (engine_task_msg_data_t*) task_msg->data;
	data->engine = engine_channel->engine;
	data->channel = channel;
	data->status = status;
	data->mrcp_message = message;

	return apt_task_msg_signal(task,task_msg);
}
Пример #11
0
static apt_bool_t mrcp_server_connection_task_msg_signal(
							connection_agent_task_msg_type_e type,
							mrcp_connection_agent_t         *agent,
							mrcp_control_channel_t          *channel,
							mrcp_control_descriptor_t       *descriptor,
							mrcp_message_t                  *message,
							apt_bool_t                       status)
{
	mrcp_server_t *server = mrcp_server_connection_agent_object_get(agent);
	apt_task_t *task = apt_consumer_task_base_get(server->task);
	connection_agent_task_msg_data_t *data;
	apt_task_msg_t *task_msg = apt_task_msg_acquire(server->connection_msg_pool);
	task_msg->type = MRCP_SERVER_CONNECTION_TASK_MSG;
	task_msg->sub_type = type;
	data = (connection_agent_task_msg_data_t*) task_msg->data;
	data->channel = channel ? channel->obj : NULL;
	data->descriptor = descriptor;
	data->message = message;
	data->status = status;

	return apt_task_msg_signal(task,task_msg);
}