Update to latest UniMRCP version. MRCP requests can no timeout if there is no server response.

This commit is contained in:
Christopher Rienzo committed 2011-06-16 16:25:00 +00:00
1 parent 0555b702db
commit 17099473a3
441 files changed
+17430 -17071

No files matched your search

@@ -1,5 +1,5 @@
/*
* Copyright 2008 Arsen Chaloyan
* Copyright 2008-2010 Arsen Chaloyan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -12,6 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id: umcframework.cpp 1767 2010-08-23 19:10:22Z achaloyan $
*/
#include "umcframework.h"
@@ -21,6 +23,7 @@
#include "recorderscenario.h"
#include "dtmfscenario.h"
#include "setparamscenario.h"
#include "verifierscenario.h"
#include "unimrcp_client.h"
#include "apt_log.h"
@@ -36,6 +39,7 @@ enum UmcTaskMsgType
{
UMC_TASK_CLIENT_MSG,
UMC_TASK_RUN_SESSION_MSG,
UMC_TASK_STOP_SESSION_MSG,
UMC_TASK_KILL_SESSION_MSG,
UMC_TASK_SHOW_SCENARIOS_MSG,
UMC_TASK_SHOW_SESSIONS_MSG
@@ -134,7 +138,7 @@ bool UmcFramework::CreateTask()
return false;
pTask = apt_consumer_task_base_get(m_pTask);
apt_task_name_set(pTask,"Framework Task");
apt_task_name_set(pTask,"Framework Agent");
pVtable = apt_consumer_task_vtable_get(m_pTask);
if(pVtable)
{
@@ -175,6 +179,8 @@ UmcScenario* UmcFramework::CreateScenario(const char* pType)
return new DtmfScenario();
else if(strcasecmp(pType,"Params") == 0)
return new SetParamScenario();
else if(strcasecmp(pType,"Verifier") == 0)
return new VerifierScenario();
}
return NULL;
}
@@ -335,6 +341,24 @@ bool UmcFramework::ProcessRunRequest(const char* pScenarioName, const char* pPro
return true;
}
void UmcFramework::ProcessStopRequest(const char* id)
{
UmcSession* pSession;
void* pVal;
apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable);
for(; it; it = apr_hash_next(it))
{
apr_hash_this(it,NULL,NULL,&pVal);
pSession = (UmcSession*) pVal;
if(pSession && strcasecmp(pSession->GetId(),id) == 0)
{
/* stop in-progress request */
pSession->Stop();
return;
}
}
}
void UmcFramework::ProcessKillRequest(const char* id)
{
UmcSession* pSession;
@@ -346,7 +370,7 @@ void UmcFramework::ProcessKillRequest(const char* id)
pSession = (UmcSession*) pVal;
if(pSession && strcasecmp(pSession->GetId(),id) == 0)
{
/* first, terminate session */
/* terminate session */
pSession->Terminate();
return;
}
@@ -403,6 +427,22 @@ void UmcFramework::RunSession(const char* pScenarioName, const char* pProfileNam
apt_task_msg_signal(pTask,pTaskMsg);
}
void UmcFramework::StopSession(const char* id)
{
apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
if(!pTaskMsg)
return;
pTaskMsg->type = TASK_MSG_USER;
pTaskMsg->sub_type = UMC_TASK_STOP_SESSION_MSG;
UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
strncpy(pUmcMsg->m_SessionId,id,sizeof(pUmcMsg->m_SessionId)-1);
pUmcMsg->m_pAppMessage = NULL;
apt_task_msg_signal(pTask,pTaskMsg);
}
void UmcFramework::KillSession(const char* id)
{
apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
@@ -562,6 +602,11 @@ apt_bool_t UmcProcessMsg(apt_task_t *pTask, apt_task_msg_t *pMsg)
pFramework->ProcessRunRequest(pUmcMsg->m_ScenarioName,pUmcMsg->m_ProfileName);
break;
}
case UMC_TASK_STOP_SESSION_MSG:
{
pFramework->ProcessStopRequest(pUmcMsg->m_SessionId);
break;
}
case UMC_TASK_KILL_SESSION_MSG:
{
pFramework->ProcessKillRequest(pUmcMsg->m_SessionId);