예제 #1
0
apt_bool_t AppOnSessionTerminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
{
	UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
	if(!pSession->OnSessionTerminate(status))
		return false;

	UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(application);
	pFramework->RemoveSession(pSession);
	delete pSession;
	return true;
}
예제 #2
0
apt_bool_t AppMessageHandler(const mrcp_app_message_t* pMessage)
{
	UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(pMessage->application);
	if(!pFramework)
		return FALSE;

	apt_task_t* pTask = apt_consumer_task_base_get(pFramework->m_pTask);
	apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
	if(pTaskMsg) 
	{
		pTaskMsg->type = TASK_MSG_USER;
		pTaskMsg->sub_type = UMC_TASK_CLIENT_MSG;
		
		UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
		pUmcMsg->m_pAppMessage = pMessage;
		apt_task_msg_signal(pTask,pTaskMsg);
	}
	
	return TRUE;
}
예제 #3
0
/** Callback is called from MRCP client stack (task) context.
 *  Signal app_message to the main consumer task of the demo framework
 *  for further processing (see demo_framework_msg_process).
 */
static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message)
{
	demo_application_t *demo_application;
	if(!app_message->application) {
		return FALSE;
	}
	demo_application = mrcp_application_object_get(app_message->application);
	if(demo_application && demo_application->framework) {
		demo_framework_t *framework = demo_application->framework;
		apt_task_t *task = apt_consumer_task_base_get(framework->task);
		apt_task_msg_t *task_msg = apt_task_msg_get(task);
		if(task_msg) {
			framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data;
			task_msg->type = TASK_MSG_USER;
			task_msg->sub_type = DEMO_APPLICATION_MSG_ID;
			framework_task_data = (framework_task_data_t*) task_msg->data;
			framework_task_data->app_message = app_message;
			framework_task_data->demo_application = demo_application;
			apt_task_msg_signal(task,task_msg);
		}
	}
	return TRUE;
}