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; }
void UmcFramework::ProcessShowSessions() { UmcSession* pSession; void* pVal; printf("%d Session(s)\n", apr_hash_count(m_pSessionTable)); 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) { printf("[%s] - %s\n", pSession->GetId(), pSession->GetScenario()->GetName()); } } }
void UmcFramework::ProcessKillRequest(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) { /* first, terminate session */ pSession->Terminate(); return; } } }
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; } } }
bool UmcFramework::ProcessRunRequest(const char* pScenarioName, const char* pProfileName) { UmcScenario* pScenario = (UmcScenario*) apr_hash_get(m_pScenarioTable,pScenarioName,APR_HASH_KEY_STRING); if(!pScenario) return false; UmcSession* pSession = pScenario->CreateSession(); if(!pSession) return false; printf("[%s]\n",pSession->GetId()); pSession->SetMrcpProfile(pProfileName); pSession->SetMrcpApplication(m_pMrcpApplication); if(!pSession->Run()) { delete pSession; return false; } AddSession(pSession); return true; }
apt_bool_t AppOnResourceDiscover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status) { UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); return pSession->OnResourceDiscover(descriptor,status); }
apt_bool_t AppOnTerminateEvent(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel) { UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); return pSession->OnTerminateEvent(channel); }
apt_bool_t AppOnMessageReceive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) { UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); return pSession->OnMessageReceive(channel,message); }
apt_bool_t AppOnChannelRemove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) { UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); return pSession->OnChannelRemove(channel,status); }
apt_bool_t AppOnSessionUpdate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) { UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); return pSession->OnSessionUpdate(status); }