mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 21:17:06 +00:00
inital checkin of unimrcp svn revision 985 from http://unimrcp.googlecode.com/svn/trunk/
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13790 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
ec90221783
commit
da925bddf8
349 files changed
+47866
No files matched your search
@@ -0,0 +1,3 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = apttest mpftest mrcptest rtsptest strtablegen
|
||||
@@ -0,0 +1,11 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/libs/apr-toolkit/include \
|
||||
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
|
||||
|
||||
noinst_PROGRAMS = apttest
|
||||
apttest_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
|
||||
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
|
||||
apttest_SOURCES = src/main.c \
|
||||
src/task_suite.c \
|
||||
src/consumer_task_suite.c
|
||||
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="apttest"
|
||||
ProjectGUID="{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
|
||||
RootNamespace="apttest"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
LinkTimeCodeGeneration="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\consumer_task_suite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\task_suite.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="include"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <apr_time.h>
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_consumer_task.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
typedef struct {
|
||||
apr_time_t timestamp;
|
||||
int number;
|
||||
} sample_msg_data_t;
|
||||
|
||||
static void task_on_start_complete(apt_task_t *task)
|
||||
{
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Start");
|
||||
}
|
||||
|
||||
static void task_on_terminate_complete(apt_task_t *task)
|
||||
{
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Terminate");
|
||||
}
|
||||
|
||||
static apt_bool_t task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
|
||||
{
|
||||
sample_msg_data_t *data = (sample_msg_data_t*)msg->data;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%d]",data->number);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"consumer",NULL,consumer_task_test_run);
|
||||
return suite;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
apt_test_suite_t* task_test_suite_create(apr_pool_t *pool);
|
||||
apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool);
|
||||
|
||||
int main(int argc, const char * const *argv)
|
||||
{
|
||||
apt_test_framework_t *test_framework;
|
||||
apt_test_suite_t *test_suite;
|
||||
apr_pool_t *pool;
|
||||
|
||||
/* one time apr global initialization */
|
||||
if(apr_initialize() != APR_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* create test framework */
|
||||
test_framework = apt_test_framework_create();
|
||||
pool = apt_test_framework_pool_get(test_framework);
|
||||
|
||||
/* create test suites and add them to test framework */
|
||||
test_suite = task_test_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
|
||||
test_suite = consumer_task_test_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
|
||||
/* run tests */
|
||||
apt_test_framework_run(test_framework,argc,argv);
|
||||
|
||||
/* destroy test framework */
|
||||
apt_test_framework_destroy(test_framework);
|
||||
|
||||
/* final apr global termination */
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_task.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
static apt_bool_t task_main(apt_task_t *task)
|
||||
{
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Do the Job");
|
||||
apt_task_delay(3000);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
|
||||
{
|
||||
apt_task_t *task;
|
||||
apt_task_vtable_t *vtable;
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Task");
|
||||
task = apt_task_create(NULL,NULL,suite->pool);
|
||||
if(!task) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Task");
|
||||
return FALSE;
|
||||
}
|
||||
vtable = apt_task_vtable_get(task);
|
||||
if(vtable) {
|
||||
vtable->run = task_main;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete");
|
||||
apt_task_wait_till_complete(task);
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
|
||||
apt_task_destroy(task);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
apt_test_suite_t* task_test_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"task",NULL,task_test_run);
|
||||
return suite;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/libs/mpf/include \
|
||||
-I$(top_srcdir)/libs/apr-toolkit/include \
|
||||
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
|
||||
|
||||
noinst_PROGRAMS = mpftest
|
||||
mpftest_LDADD = $(top_builddir)/libs/mpf/libmpf.la \
|
||||
$(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
|
||||
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
|
||||
mpftest_SOURCES = src/main.c \
|
||||
src/mpf_suite.c
|
||||
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="mpftest"
|
||||
ProjectGUID="{DCF01B1C-5268-44F3-9130-D647FABFB663}"
|
||||
RootNamespace="mpftest"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\mpf.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\mpf.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib "
|
||||
LinkTimeCodeGeneration="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\mpf_suite.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="include"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
apt_test_suite_t* mpf_suite_create(apr_pool_t *pool);
|
||||
|
||||
int main(int argc, const char * const *argv)
|
||||
{
|
||||
apt_test_framework_t *test_framework;
|
||||
apt_test_suite_t *test_suite;
|
||||
apr_pool_t *pool;
|
||||
|
||||
/* one time apr global initialization */
|
||||
if(apr_initialize() != APR_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* create test framework */
|
||||
test_framework = apt_test_framework_create();
|
||||
pool = apt_test_framework_pool_get(test_framework);
|
||||
|
||||
/* create test suites and add them to test framework */
|
||||
test_suite = mpf_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
|
||||
/* run tests */
|
||||
apt_test_framework_run(test_framework,argc,argv);
|
||||
|
||||
/* destroy test framework */
|
||||
apt_test_framework_destroy(test_framework);
|
||||
|
||||
/* final apr global termination */
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <apr_thread_cond.h>
|
||||
#include "apt_test_suite.h"
|
||||
#include "mpf_engine.h"
|
||||
#include "mpf_user.h"
|
||||
#include "mpf_termination.h"
|
||||
#include "mpf_rtp_termination_factory.h"
|
||||
#include "mpf_file_termination_factory.h"
|
||||
#include "mpf_audio_file_descriptor.h"
|
||||
#include "mpf_rtp_descriptor.h"
|
||||
#include "apt_pool.h"
|
||||
#include "apt_consumer_task.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
typedef struct mpf_suite_session_t mpf_suite_session_t;
|
||||
typedef struct mpf_suite_engine_t mpf_suite_engine_t;
|
||||
|
||||
|
||||
/** Test suite session */
|
||||
struct mpf_suite_session_t {
|
||||
/** Pool to allocate memory from */
|
||||
apr_pool_t *pool;
|
||||
|
||||
/** Media context associated with the session */
|
||||
mpf_context_t *context;
|
||||
/** The first termination in the context */
|
||||
mpf_termination_t *termination1;
|
||||
/** The second termination in the context */
|
||||
mpf_termination_t *termination2;
|
||||
/** RTP or file termination mode */
|
||||
apt_bool_t rtp_mode;
|
||||
};
|
||||
|
||||
/** Test suite engine */
|
||||
struct mpf_suite_engine_t {
|
||||
/** The main task of the test engine, which sends messages to MPF engine and
|
||||
* processes responses and events sent back from MPF engine */
|
||||
apt_consumer_task_t *consumer_task;
|
||||
/** MPF engine task */
|
||||
apt_task_t *engine_task;
|
||||
/** RTP termination factory */
|
||||
mpf_termination_factory_t *rtp_termination_factory;
|
||||
/** File termination factory */
|
||||
mpf_termination_factory_t *file_termination_factory;
|
||||
|
||||
/** Wait object, which is signalled to indicate shutdown */
|
||||
apr_thread_cond_t *wait_object;
|
||||
/** Mutex of the wait object */
|
||||
apr_thread_mutex_t *wait_object_mutex;
|
||||
};
|
||||
|
||||
static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv);
|
||||
|
||||
static void mpf_suite_on_start_complete(apt_task_t *task);
|
||||
static void mpf_suite_on_terminate_complete(apt_task_t *task);
|
||||
static apt_bool_t mpf_suite_msg_process(apt_task_t *task, apt_task_msg_t *msg);
|
||||
|
||||
static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(mpf_suite_session_t *session);
|
||||
static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(mpf_suite_session_t *session);
|
||||
static mpf_rtp_stream_descriptor_t* mpf_rtp_local_descriptor_create(mpf_suite_session_t *session);
|
||||
static mpf_rtp_stream_descriptor_t* mpf_rtp_remote_descriptor_create(mpf_suite_session_t *session);
|
||||
|
||||
|
||||
/** Create MPF test suite */
|
||||
apt_test_suite_t* mpf_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"mpf",NULL,mpf_test_run);
|
||||
return suite;
|
||||
}
|
||||
|
||||
/** Run MPF test suite */
|
||||
static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
|
||||
{
|
||||
mpf_suite_engine_t *suite_engine;
|
||||
mpf_codec_manager_t *codec_manager;
|
||||
mpf_rtp_config_t *config;
|
||||
mpf_engine_t *engine;
|
||||
|
||||
apt_task_t *task;
|
||||
apt_task_vtable_t *vtable;
|
||||
apt_task_msg_pool_t *msg_pool;
|
||||
|
||||
suite_engine = apr_palloc(suite->pool,sizeof(mpf_suite_engine_t));
|
||||
|
||||
engine = mpf_engine_create(suite->pool);
|
||||
if(!engine) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MPF Engine");
|
||||
return FALSE;
|
||||
}
|
||||
codec_manager = mpf_engine_codec_manager_create(suite->pool);
|
||||
if(codec_manager) {
|
||||
mpf_engine_codec_manager_register(engine,codec_manager);
|
||||
}
|
||||
suite_engine->engine_task = mpf_task_get(engine);
|
||||
|
||||
config = mpf_rtp_config_create(suite->pool);
|
||||
apt_string_set(&config->ip,"127.0.0.1");
|
||||
config->rtp_port_min = 5000;
|
||||
config->rtp_port_min = 6000;
|
||||
suite_engine->rtp_termination_factory = mpf_rtp_termination_factory_create(config,suite->pool);
|
||||
suite_engine->file_termination_factory = mpf_file_termination_factory_create(suite->pool);
|
||||
|
||||
msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_t),suite->pool);
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
|
||||
suite_engine->consumer_task = apt_consumer_task_create(suite_engine,msg_pool,suite->pool);
|
||||
if(!suite_engine->consumer_task) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
|
||||
return FALSE;
|
||||
}
|
||||
task = apt_consumer_task_base_get(suite_engine->consumer_task);
|
||||
vtable = apt_task_vtable_get(task);
|
||||
if(vtable) {
|
||||
vtable->process_msg = mpf_suite_msg_process;
|
||||
vtable->on_start_complete = mpf_suite_on_start_complete;
|
||||
vtable->on_terminate_complete = mpf_suite_on_terminate_complete;
|
||||
}
|
||||
|
||||
apt_task_add(task,suite_engine->engine_task);
|
||||
|
||||
apr_thread_mutex_create(&suite_engine->wait_object_mutex,APR_THREAD_MUTEX_UNNESTED,suite->pool);
|
||||
apr_thread_cond_create(&suite_engine->wait_object,suite->pool);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
apr_thread_mutex_lock(suite_engine->wait_object_mutex);
|
||||
apr_thread_cond_wait(suite_engine->wait_object,suite_engine->wait_object_mutex);
|
||||
apr_thread_mutex_unlock(suite_engine->wait_object_mutex);
|
||||
|
||||
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);
|
||||
|
||||
apr_thread_cond_destroy(suite_engine->wait_object);
|
||||
apr_thread_mutex_destroy(suite_engine->wait_object_mutex);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Start execution of MPF test suite scenario */
|
||||
static void mpf_suite_on_start_complete(apt_task_t *task)
|
||||
{
|
||||
mpf_suite_session_t *session;
|
||||
apt_task_t *consumer_task;
|
||||
mpf_suite_engine_t *suite_engine;
|
||||
apt_task_msg_t *msg;
|
||||
mpf_message_t *mpf_message;
|
||||
apr_pool_t *pool = NULL;
|
||||
|
||||
consumer_task = apt_task_object_get(task);
|
||||
suite_engine = apt_task_object_get(consumer_task);
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Start");
|
||||
pool = apt_pool_create();
|
||||
session = apr_palloc(pool,sizeof(mpf_suite_session_t));
|
||||
session->pool = pool;
|
||||
session->context = NULL;
|
||||
session->termination1 = NULL;
|
||||
session->termination2 = NULL;
|
||||
session->rtp_mode = TRUE;
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context");
|
||||
session->context = mpf_context_create(session,2,pool);
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [1]");
|
||||
session->termination1 = mpf_termination_create(suite_engine->file_termination_factory,session,session->pool);
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [1]");
|
||||
msg = apt_task_msg_get(task);
|
||||
msg->type = TASK_MSG_USER;
|
||||
mpf_message = (mpf_message_t*) msg->data;
|
||||
|
||||
mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
|
||||
mpf_message->command_id = MPF_COMMAND_ADD;
|
||||
mpf_message->context = session->context;
|
||||
mpf_message->termination = session->termination1;
|
||||
mpf_message->descriptor = mpf_file_reader_descriptor_create(session);
|
||||
apt_task_msg_signal(suite_engine->engine_task,msg);
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [2]");
|
||||
if(session->rtp_mode == TRUE) {
|
||||
session->termination2 = mpf_termination_create(suite_engine->rtp_termination_factory,session,session->pool);
|
||||
}
|
||||
else {
|
||||
session->termination2 = mpf_termination_create(suite_engine->file_termination_factory,session,session->pool);
|
||||
}
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [2]");
|
||||
msg = apt_task_msg_get(task);
|
||||
msg->type = TASK_MSG_USER;
|
||||
mpf_message = (mpf_message_t*) msg->data;
|
||||
|
||||
mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
|
||||
mpf_message->command_id = MPF_COMMAND_ADD;
|
||||
mpf_message->context = session->context;
|
||||
mpf_message->termination = session->termination2;
|
||||
if(session->rtp_mode == TRUE) {
|
||||
mpf_message->descriptor = mpf_rtp_local_descriptor_create(session);
|
||||
}
|
||||
else {
|
||||
mpf_message->descriptor = mpf_file_writer_descriptor_create(session);
|
||||
}
|
||||
apt_task_msg_signal(suite_engine->engine_task,msg);
|
||||
}
|
||||
|
||||
/** Execution of MPF test suite scenario is terminated */
|
||||
static void mpf_suite_on_terminate_complete(apt_task_t *task)
|
||||
{
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Terminate");
|
||||
}
|
||||
|
||||
/** Process task messages */
|
||||
static apt_bool_t mpf_suite_msg_process(apt_task_t *task, apt_task_msg_t *msg)
|
||||
{
|
||||
const mpf_message_t *mpf_message = (const mpf_message_t*) msg->data;
|
||||
if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Response");
|
||||
if(mpf_message->command_id == MPF_COMMAND_ADD) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Add Termination");
|
||||
if(mpf_message->termination) {
|
||||
mpf_suite_session_t *session;
|
||||
session = mpf_termination_object_get(mpf_message->termination);
|
||||
if(session->termination2 == mpf_message->termination && session->rtp_mode == TRUE) {
|
||||
apt_task_msg_t *msg;
|
||||
mpf_message_t *request;
|
||||
apt_task_t *consumer_task;
|
||||
mpf_suite_engine_t *suite_engine;
|
||||
|
||||
consumer_task = apt_task_object_get(task);
|
||||
suite_engine = apt_task_object_get(consumer_task);
|
||||
|
||||
msg = apt_task_msg_get(task);
|
||||
msg->type = TASK_MSG_USER;
|
||||
request = (mpf_message_t*) msg->data;
|
||||
|
||||
request->message_type = MPF_MESSAGE_TYPE_REQUEST;
|
||||
request->command_id = MPF_COMMAND_MODIFY;
|
||||
request->context = session->context;
|
||||
request->termination = session->termination2;
|
||||
request->descriptor = mpf_rtp_remote_descriptor_create(session);
|
||||
apt_task_msg_signal(suite_engine->engine_task,msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mpf_message->command_id == MPF_COMMAND_SUBTRACT) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Subtract Termination");
|
||||
if(mpf_message->termination) {
|
||||
mpf_suite_session_t *session;
|
||||
session = mpf_termination_object_get(mpf_message->termination);
|
||||
if(session->termination1 == mpf_message->termination) {
|
||||
session->termination1 = NULL;
|
||||
}
|
||||
if(session->termination2 == mpf_message->termination) {
|
||||
session->termination2 = NULL;
|
||||
}
|
||||
mpf_termination_destroy(mpf_message->termination);
|
||||
|
||||
if(!session->termination1 && !session->termination2) {
|
||||
apt_task_t *consumer_task;
|
||||
mpf_suite_engine_t *suite_engine;
|
||||
|
||||
mpf_context_destroy(session->context);
|
||||
session->context = NULL;
|
||||
apr_pool_destroy(session->pool);
|
||||
|
||||
consumer_task = apt_task_object_get(task);
|
||||
suite_engine = apt_task_object_get(consumer_task);
|
||||
|
||||
apr_thread_mutex_lock(suite_engine->wait_object_mutex);
|
||||
apr_thread_cond_signal(suite_engine->wait_object);
|
||||
apr_thread_mutex_unlock(suite_engine->wait_object_mutex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
|
||||
apt_task_t *consumer_task;
|
||||
mpf_suite_engine_t *suite_engine;
|
||||
apt_task_msg_t *msg;
|
||||
mpf_message_t *request;
|
||||
mpf_suite_session_t *session;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event");
|
||||
if(mpf_message->termination) {
|
||||
session = mpf_termination_object_get(mpf_message->termination);
|
||||
if(session->termination1) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [1]");
|
||||
msg = apt_task_msg_get(task);
|
||||
msg->type = TASK_MSG_USER;
|
||||
request = (mpf_message_t*) msg->data;
|
||||
|
||||
request->message_type = MPF_MESSAGE_TYPE_REQUEST;
|
||||
request->command_id = MPF_COMMAND_SUBTRACT;
|
||||
request->context = session->context;
|
||||
request->termination = session->termination1;
|
||||
|
||||
consumer_task = apt_task_object_get(task);
|
||||
suite_engine = apt_task_object_get(consumer_task);
|
||||
apt_task_msg_signal(suite_engine->engine_task,msg);
|
||||
}
|
||||
if(session->termination2) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [2]");
|
||||
msg = apt_task_msg_get(task);
|
||||
msg->type = TASK_MSG_USER;
|
||||
request = (mpf_message_t*) msg->data;
|
||||
|
||||
request->message_type = MPF_MESSAGE_TYPE_REQUEST;
|
||||
request->command_id = MPF_COMMAND_SUBTRACT;
|
||||
request->context = session->context;
|
||||
request->termination = session->termination2;
|
||||
|
||||
consumer_task = apt_task_object_get(task);
|
||||
suite_engine = apt_task_object_get(consumer_task);
|
||||
apt_task_msg_signal(suite_engine->engine_task,msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Create sample file reader descriptor */
|
||||
static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(mpf_suite_session_t *session)
|
||||
{
|
||||
mpf_codec_descriptor_t *codec_descriptor;
|
||||
mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
|
||||
descriptor->mask = FILE_READER;
|
||||
descriptor->read_handle = fopen("demo.pcm","rb");
|
||||
descriptor->write_handle = NULL;
|
||||
|
||||
codec_descriptor = &descriptor->codec_descriptor;
|
||||
codec_descriptor->payload_type = 11;
|
||||
apt_string_set(&codec_descriptor->name,"L16");
|
||||
codec_descriptor->sampling_rate = 8000;
|
||||
codec_descriptor->channel_count = 1;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/** Create sample file writer descriptor */
|
||||
static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(mpf_suite_session_t *session)
|
||||
{
|
||||
mpf_codec_descriptor_t *codec_descriptor;
|
||||
mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
|
||||
descriptor->mask = FILE_WRITER;
|
||||
descriptor->max_write_size = 500000; /* 500Kb */
|
||||
descriptor->write_handle = fopen("demo_out.pcm","wb");
|
||||
descriptor->read_handle = NULL;
|
||||
|
||||
codec_descriptor = &descriptor->codec_descriptor;
|
||||
codec_descriptor->payload_type = 11;
|
||||
apt_string_set(&codec_descriptor->name,"L16");
|
||||
codec_descriptor->sampling_rate = 8000;
|
||||
codec_descriptor->channel_count = 1;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/** Create sample RTP local descriptor */
|
||||
static mpf_rtp_stream_descriptor_t* mpf_rtp_local_descriptor_create(mpf_suite_session_t *session)
|
||||
{
|
||||
mpf_rtp_stream_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
|
||||
mpf_rtp_stream_descriptor_init(descriptor);
|
||||
descriptor->local = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
|
||||
mpf_rtp_media_descriptor_init(descriptor->local);
|
||||
descriptor->local->mode = STREAM_MODE_NONE;
|
||||
apt_string_set(&descriptor->local->base.ip,"127.0.0.1");
|
||||
descriptor->local->base.port = 5000;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/** Create sample RTP remote descriptor */
|
||||
static mpf_rtp_stream_descriptor_t* mpf_rtp_remote_descriptor_create(mpf_suite_session_t *session)
|
||||
{
|
||||
mpf_codec_list_t *codec_list;
|
||||
mpf_codec_descriptor_t *codec_descriptor;
|
||||
mpf_rtp_stream_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
|
||||
mpf_rtp_stream_descriptor_init(descriptor);
|
||||
descriptor->remote = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
|
||||
mpf_rtp_media_descriptor_init(descriptor->remote);
|
||||
descriptor->remote->mode = STREAM_MODE_SEND_RECEIVE;
|
||||
apt_string_set(&descriptor->remote->base.ip,"127.0.0.1");
|
||||
descriptor->remote->base.port = 5002;
|
||||
codec_list = &descriptor->remote->codec_list;
|
||||
mpf_codec_list_init(codec_list,2,session->pool);
|
||||
codec_descriptor = mpf_codec_list_add(codec_list);
|
||||
if(codec_descriptor) {
|
||||
codec_descriptor->payload_type = 0;
|
||||
}
|
||||
codec_descriptor = mpf_codec_list_add(codec_list);
|
||||
if(codec_descriptor) {
|
||||
codec_descriptor->payload_type = 96;
|
||||
apt_string_set(&codec_descriptor->name,"PCMU");
|
||||
codec_descriptor->sampling_rate = 16000;
|
||||
codec_descriptor->channel_count = 1;
|
||||
}
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/libs/mrcp/include \
|
||||
-I$(top_srcdir)/libs/mrcp/message/include \
|
||||
-I$(top_srcdir)/libs/mrcp/control/include \
|
||||
-I$(top_srcdir)/libs/mrcp/resources/include \
|
||||
-I$(top_srcdir)/libs/apr-toolkit/include \
|
||||
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
|
||||
|
||||
noinst_PROGRAMS = mrcptest
|
||||
mrcptest_LDADD = $(top_builddir)/libs/mrcp/libmrcp.la \
|
||||
$(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
|
||||
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
|
||||
mrcptest_SOURCES = src/main.c \
|
||||
src/parse_gen_suite.c \
|
||||
src/set_get_suite.c
|
||||
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="mrcptest"
|
||||
ProjectGUID="{3CA97077-6210-4362-998A-D15A35EEAA08}"
|
||||
RootNamespace="mrcptest"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\mrcp.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\mrcp.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
LinkTimeCodeGeneration="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\parse_gen_suite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\set_get_suite.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="include"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
|
||||
apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool);
|
||||
|
||||
int main(int argc, const char * const *argv)
|
||||
{
|
||||
apt_test_framework_t *test_framework;
|
||||
apt_test_suite_t *test_suite;
|
||||
apr_pool_t *pool;
|
||||
|
||||
/* one time apr global initialization */
|
||||
if(apr_initialize() != APR_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* create test framework */
|
||||
test_framework = apt_test_framework_create();
|
||||
pool = apt_test_framework_pool_get(test_framework);
|
||||
|
||||
/* create test suites and add them to test framework */
|
||||
test_suite = set_get_test_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
test_suite = parse_gen_test_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
|
||||
/* run tests */
|
||||
apt_test_framework_run(test_framework,argc,argv);
|
||||
|
||||
/* destroy test framework */
|
||||
apt_test_framework_destroy(test_framework);
|
||||
|
||||
/* final apr global termination */
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <apr_file_info.h>
|
||||
#include <apr_file_io.h>
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
#include "mrcp_default_factory.h"
|
||||
#include "mrcp_message.h"
|
||||
#include "mrcp_stream.h"
|
||||
|
||||
static apt_bool_t test_stream_generate(mrcp_generator_t *generator, mrcp_message_t *message)
|
||||
{
|
||||
char buffer[500];
|
||||
apt_text_stream_t stream;
|
||||
mrcp_stream_result_e result;
|
||||
apt_bool_t continuation;
|
||||
|
||||
mrcp_generator_message_set(generator,message);
|
||||
do {
|
||||
apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
|
||||
continuation = FALSE;
|
||||
result = mrcp_generator_run(generator,&stream);
|
||||
if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
|
||||
stream.text.length = stream.pos - stream.text.buf;
|
||||
*stream.pos = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%lu bytes]\n%s",stream.text.length,stream.text.buf);
|
||||
}
|
||||
else if(result == MRCP_STREAM_MESSAGE_TRUNCATED) {
|
||||
*stream.pos = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%lu bytes] continuation awaiting\n%s",stream.text.length,stream.text.buf);
|
||||
continuation = TRUE;
|
||||
}
|
||||
else {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCP Stream");
|
||||
}
|
||||
}
|
||||
while(continuation == TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t mrcp_message_handler(void *obj, mrcp_message_t *message, mrcp_stream_result_e result)
|
||||
{
|
||||
if(result == MRCP_STREAM_MESSAGE_COMPLETE) {
|
||||
/* message is completely parsed */
|
||||
mrcp_generator_t *generator = obj;
|
||||
test_stream_generate(generator,message);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t resource_name_read(apr_file_t *file, mrcp_parser_t *parser)
|
||||
{
|
||||
char buffer[100];
|
||||
apt_text_stream_t stream;
|
||||
apt_bool_t status = FALSE;
|
||||
apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
|
||||
if(apr_file_read(file,stream.pos,&stream.text.length) != APR_SUCCESS) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* skip the first line in a test file, which indicates resource name */
|
||||
if(*stream.pos =='/' && *(stream.pos+1)=='/') {
|
||||
apt_str_t line;
|
||||
stream.pos += 2;
|
||||
if(apt_text_line_read(&stream,&line) == TRUE) {
|
||||
apr_off_t offset = stream.pos - stream.text.buf;
|
||||
apr_file_seek(file,APR_SET,&offset);
|
||||
mrcp_parser_resource_name_set(parser,&line);
|
||||
status = TRUE;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static apt_bool_t test_file_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version, const char *file_path)
|
||||
{
|
||||
apr_file_t *file;
|
||||
char buffer[500];
|
||||
apt_text_stream_t stream;
|
||||
mrcp_parser_t *parser;
|
||||
mrcp_generator_t *generator;
|
||||
apr_size_t length;
|
||||
apr_size_t offset;
|
||||
apt_str_t resource_name;
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
|
||||
if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
parser = mrcp_parser_create(factory,suite->pool);
|
||||
generator = mrcp_generator_create(factory,suite->pool);
|
||||
|
||||
apt_string_reset(&resource_name);
|
||||
if(version == MRCP_VERSION_1) {
|
||||
resource_name_read(file,parser);
|
||||
}
|
||||
|
||||
apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
|
||||
do {
|
||||
/* init length of the stream */
|
||||
stream.text.length = sizeof(buffer)-1;
|
||||
/* calculate offset remaining from the previous receive / if any */
|
||||
offset = stream.pos - stream.text.buf;
|
||||
/* calculate available length */
|
||||
length = stream.text.length - offset;
|
||||
|
||||
if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
/* calculate actual length of the stream */
|
||||
stream.text.length = offset + length;
|
||||
stream.pos[length] = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCP Stream [%lu bytes]\n%s",length,stream.pos);
|
||||
|
||||
/* reset pos */
|
||||
stream.pos = stream.text.buf;
|
||||
mrcp_stream_walk(parser,&stream,mrcp_message_handler,generator);
|
||||
}
|
||||
while(apr_file_eof(file) != APR_EOF);
|
||||
|
||||
apr_file_close(file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t test_dir_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version)
|
||||
{
|
||||
apr_status_t rv;
|
||||
apr_dir_t *dir;
|
||||
|
||||
const char *dir_name = "v2";
|
||||
if(version == MRCP_VERSION_1) {
|
||||
dir_name = "v1";
|
||||
}
|
||||
if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do {
|
||||
apr_finfo_t finfo;
|
||||
rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
|
||||
if(rv == APR_SUCCESS) {
|
||||
if(finfo.filetype == APR_REG && finfo.name) {
|
||||
char *file_path;
|
||||
apr_filepath_merge(&file_path,dir_name,finfo.name,0,suite->pool);
|
||||
test_file_process(suite,factory,version,file_path);
|
||||
printf("\nPress ENTER to continue\n");
|
||||
getchar();
|
||||
}
|
||||
}
|
||||
}
|
||||
while(rv == APR_SUCCESS);
|
||||
|
||||
apr_dir_close(dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
|
||||
{
|
||||
mrcp_resource_factory_t *factory = mrcp_default_factory_create(suite->pool);
|
||||
if(!factory) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
test_dir_process(suite,factory,MRCP_VERSION_2);
|
||||
test_dir_process(suite,factory,MRCP_VERSION_1);
|
||||
|
||||
mrcp_resource_factory_destroy(factory);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
|
||||
return suite;
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
/* common includes */
|
||||
#include "mrcp_default_factory.h"
|
||||
#include "mrcp_message.h"
|
||||
#include "mrcp_generic_header.h"
|
||||
/* synthesizer includes */
|
||||
#include "mrcp_synth_header.h"
|
||||
#include "mrcp_synth_resource.h"
|
||||
/* recognizer includes */
|
||||
#include "mrcp_recog_header.h"
|
||||
#include "mrcp_recog_resource.h"
|
||||
|
||||
#define SAMPLE_VOICE_AGE 28
|
||||
#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml"
|
||||
#define SAMPLE_CONTENT_ID "123456"
|
||||
#define SAMPLE_CONTENT "SSML content goes here"
|
||||
#define SAMPLE_PARAM_NAME "SampleParamName"
|
||||
#define SAMPLE_PARAM_VALUE "SampleParamValue"
|
||||
|
||||
/* Create SPEAK request */
|
||||
static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
|
||||
{
|
||||
mrcp_message_t *message;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request");
|
||||
message = mrcp_request_create(MRCP_SYNTHESIZER_RESOURCE,SYNTHESIZER_SPEAK,pool);
|
||||
mrcp_message_resourcify_by_id(factory,message);
|
||||
if(message) {
|
||||
mrcp_generic_header_t *generic_header;
|
||||
mrcp_synth_header_t *synth_header;
|
||||
/* get/allocate generic header */
|
||||
generic_header = mrcp_generic_header_prepare(message);
|
||||
if(generic_header) {
|
||||
/* set generic header fields */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-Type: %s",SAMPLE_CONTENT_TYPE);
|
||||
apt_string_assign(&generic_header->content_type,SAMPLE_CONTENT_TYPE,message->pool);
|
||||
mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
|
||||
}
|
||||
/* get/allocate synthesizer header */
|
||||
synth_header = mrcp_resource_header_prepare(message);
|
||||
if(synth_header) {
|
||||
/* set synthesizer header fields */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",SAMPLE_VOICE_AGE);
|
||||
synth_header->voice_param.age = SAMPLE_VOICE_AGE;
|
||||
mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
|
||||
}
|
||||
/* set message body */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT);
|
||||
apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/* Test SPEAK request */
|
||||
static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message)
|
||||
{
|
||||
apt_bool_t res;
|
||||
mrcp_generic_header_t *generic_header;
|
||||
mrcp_synth_header_t *synth_header;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request");
|
||||
res = FALSE;
|
||||
/* get generic header */
|
||||
generic_header = mrcp_generic_header_get(message);
|
||||
if(generic_header) {
|
||||
/* test content type header */
|
||||
if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
|
||||
if(strncasecmp(generic_header->content_type.buf,SAMPLE_CONTENT_TYPE,generic_header->content_type.length) == 0) {
|
||||
/* OK */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Content-Type: %s",generic_header->content_type.buf);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(res == FALSE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
res = FALSE;
|
||||
/* get synthesizer header */
|
||||
synth_header = mrcp_resource_header_get(message);
|
||||
if(synth_header) {
|
||||
/* test voice age header */
|
||||
if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
|
||||
if(synth_header->voice_param.age == SAMPLE_VOICE_AGE) {
|
||||
/* OK */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Voice-Age: %d",synth_header->voice_param.age);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(res == FALSE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body");
|
||||
return FALSE;
|
||||
}
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Create SPEAK response */
|
||||
static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
|
||||
{
|
||||
mrcp_message_t *response;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response");
|
||||
response = mrcp_response_create(request,request->pool);
|
||||
if(response) {
|
||||
/* set IN-PROGRESS state */
|
||||
response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/* Create SPEAK-COMPLETE event */
|
||||
static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
|
||||
{
|
||||
mrcp_message_t *event_message;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event");
|
||||
event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool);
|
||||
if(event_message) {
|
||||
/* get/allocate synthesizer header */
|
||||
mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(event_message);
|
||||
if(synth_header) {
|
||||
/* set completion cause */
|
||||
synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
|
||||
mrcp_resource_header_property_add(event_message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
|
||||
}
|
||||
/* set request state */
|
||||
event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
|
||||
}
|
||||
return event_message;
|
||||
}
|
||||
|
||||
|
||||
/* Create GET-PARAMS request */
|
||||
static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
|
||||
{
|
||||
mrcp_message_t *message;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request");
|
||||
message = mrcp_request_create(MRCP_SYNTHESIZER_RESOURCE,SYNTHESIZER_GET_PARAMS,pool);
|
||||
mrcp_message_resourcify_by_id(factory,message);
|
||||
if(message) {
|
||||
apt_str_t param_name;
|
||||
apt_str_t param_value;
|
||||
mrcp_generic_header_t *generic_header;
|
||||
mrcp_synth_header_t *synth_header;
|
||||
/* get/allocate generic header */
|
||||
generic_header = mrcp_generic_header_prepare(message);
|
||||
if(generic_header) {
|
||||
/* set content id empty header */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: <empty>");
|
||||
mrcp_generic_header_name_property_add(message,GENERIC_HEADER_CONTENT_ID);
|
||||
|
||||
/* set vendor specific params header */
|
||||
generic_header->vendor_specific_params = apt_pair_array_create(1,pool);
|
||||
apt_string_set(¶m_name,SAMPLE_PARAM_NAME);
|
||||
apt_string_reset(¶m_value);
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s",param_name.buf);
|
||||
apt_pair_array_append(generic_header->vendor_specific_params,¶m_name,¶m_value,pool);
|
||||
mrcp_generic_header_property_add(message,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
|
||||
}
|
||||
/* get/allocate synthesizer header */
|
||||
synth_header = mrcp_resource_header_prepare(message);
|
||||
if(synth_header) {
|
||||
/* set voice age empty header */
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: <empty>");
|
||||
mrcp_resource_header_name_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/* Create GET-PARAMS response */
|
||||
static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request)
|
||||
{
|
||||
apt_bool_t res;
|
||||
mrcp_message_t *response;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response");
|
||||
response = mrcp_response_create(request,request->pool);
|
||||
if(response) {
|
||||
mrcp_generic_header_t *generic_header;
|
||||
mrcp_synth_header_t *synth_header;
|
||||
res = FALSE;
|
||||
/* get generic header */
|
||||
generic_header = mrcp_generic_header_get(request);
|
||||
if(generic_header) {
|
||||
mrcp_generic_header_t *res_generic_header = mrcp_generic_header_prepare(response);
|
||||
/* test content id header */
|
||||
if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: %s",SAMPLE_CONTENT_ID);
|
||||
apt_string_assign(&res_generic_header->content_id,SAMPLE_CONTENT_ID,response->pool);
|
||||
mrcp_generic_header_property_add(response,GENERIC_HEADER_CONTENT_ID);
|
||||
res = TRUE;
|
||||
}
|
||||
/* test vendor specific header */
|
||||
if(mrcp_generic_header_property_check(request,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS) == TRUE) {
|
||||
apt_str_t name;
|
||||
const apt_pair_t *pair;
|
||||
res_generic_header->vendor_specific_params = apt_pair_array_create(1,response->pool);
|
||||
apt_string_set(&name,SAMPLE_PARAM_NAME);
|
||||
pair = apt_pair_array_find(generic_header->vendor_specific_params,&name);
|
||||
if(pair) {
|
||||
apt_str_t value;
|
||||
apt_string_set(&value,SAMPLE_PARAM_VALUE);
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s=%s",name.buf,value.buf);
|
||||
apt_pair_array_append(res_generic_header->vendor_specific_params,&name,&value,response->pool);
|
||||
}
|
||||
mrcp_generic_header_property_add(response,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(res == FALSE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
res = FALSE;
|
||||
/* get synthesizer header */
|
||||
synth_header = mrcp_resource_header_get(request);
|
||||
if(synth_header) {
|
||||
mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response);
|
||||
/* test voice age header */
|
||||
if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
|
||||
res_synth_header->voice_param.age = SAMPLE_VOICE_AGE;
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",res_synth_header->voice_param.age);
|
||||
mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE);
|
||||
res = TRUE;
|
||||
}
|
||||
}
|
||||
if(res == FALSE) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
|
||||
{
|
||||
mrcp_message_t *message = speak_request_create(factory,suite->pool);
|
||||
if(!message) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(speak_request_test(factory,message) != TRUE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
speak_response_create(factory,message);
|
||||
speak_event_create(factory,message);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
|
||||
{
|
||||
mrcp_message_t *message = get_params_request_create(factory,suite->pool);
|
||||
if(!message) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
get_params_response_create(factory,message);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
|
||||
{
|
||||
mrcp_resource_factory_t *factory = mrcp_default_factory_create(suite->pool);
|
||||
if(!factory) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
speak_test_run(suite,factory);
|
||||
get_params_test_run(suite,factory);
|
||||
|
||||
mrcp_resource_factory_destroy(factory);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"set-gen",NULL,set_get_test_run);
|
||||
return suite;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//speechrecog
|
||||
DEFINE-GRAMMAR 543257 MRCP/1.0
|
||||
Content-Type:application/grammar+xml
|
||||
Content-Id:request1@form-level.store
|
||||
Content-Length:309
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- the default grammar language is US English -->
|
||||
<grammar xml:lang="en-US" version="1.0">
|
||||
|
||||
<!-- single language attachment to tokens -->
|
||||
<rule id="yes">
|
||||
<one-of>
|
||||
<item xml:lang="fr-CA">oui</item>
|
||||
<item xml:lang="en-US">yes</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
@@ -0,0 +1,5 @@
|
||||
//speechsynth
|
||||
GET-PARAMS 543256 MRCP/1.0
|
||||
Voice-gender:
|
||||
Voice-variant:
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//speechsynth
|
||||
GET-PARAMS 543256 MRCP/1.0
|
||||
Voice-gender:
|
||||
Voice-variant:
|
||||
|
||||
SET-PARAMS 543256 MRCP/1.0
|
||||
Voice-gender:female
|
||||
Voice-variant:3
|
||||
|
||||
SPEAK 543257 MRCP/1.0
|
||||
Kill-On-Barge-In:false
|
||||
Voice-gender:neutral
|
||||
Prosody-volume:medium
|
||||
Content-Type:application/synthesis+ssml
|
||||
Content-Length:412
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<speak>
|
||||
<paragraph>
|
||||
<sentence>You have 4 new messages.</sentence>
|
||||
<sentence>The first is from <say-as type="name">Stephanie Williams</say-as>
|
||||
<mark name="Stephanie"/> and arrived at <break/>
|
||||
<say-as type="time">3:45pm</say-as>.</sentence>
|
||||
|
||||
<sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
|
||||
</paragraph>
|
||||
</speak>
|
||||
@@ -0,0 +1,3 @@
|
||||
//speechsynth
|
||||
PAUSE 543258 MRCP/1.0
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//speechrecog
|
||||
RECOGNITION-COMPLETE 543257 COMPLETE MRCP/1.0
|
||||
Completion-Cause:000 success
|
||||
Waveform-URL:http://web.media.com/session123/audio.wav
|
||||
Content-Type:application/x-nlsml
|
||||
Content-Length:446
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<result x-model="http://IdentityModel"
|
||||
xmlns:xf="http://www.w3.org/2000/xforms"
|
||||
grammar="session:request1@form-level.store">
|
||||
<interpretation>
|
||||
<xf:instance name="Person">
|
||||
<Person>
|
||||
<Name> Andre Roy </Name>
|
||||
</Person>
|
||||
</xf:instance>
|
||||
<input> may I speak to Andre Roy </input>
|
||||
</interpretation>
|
||||
</result>
|
||||
@@ -0,0 +1,30 @@
|
||||
//speechrecog
|
||||
RECOGNIZE 543257 MRCP/1.0
|
||||
Confidence-Threshold:90
|
||||
Content-Type:application/grammar+xml
|
||||
Content-Id:request1@form-level.store
|
||||
Content-Length:608
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- the default grammar language is US English -->
|
||||
<grammar xml:lang="en-US" version="1.0">
|
||||
|
||||
<!-- single language attachment to tokens -->
|
||||
<rule id="yes">
|
||||
<one-of>
|
||||
<item xml:lang="fr-CA">oui</item>
|
||||
<item xml:lang="en-US">yes</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
|
||||
<!-- single language attachment to a rule expansion -->
|
||||
<rule id="request">
|
||||
may I speak to
|
||||
<one-of xml:lang="fr-CA">
|
||||
<item>Michel Tremblay</item>
|
||||
<item>Andre Roy</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
|
||||
</grammar>
|
||||
@@ -0,0 +1,3 @@
|
||||
//speechsynth
|
||||
MRCP/1.0 543257 200 IN-PROGRESS
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
//speechsynth
|
||||
RESUME 543260 MRCP/1.0
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//speechsynth
|
||||
SET-PARAMS 543256 MRCP/1.0
|
||||
Voice-gender:female
|
||||
Voice-variant:3
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//speechsynth
|
||||
SPEAK 543257 MRCP/1.0
|
||||
Kill-On-Barge-In:false
|
||||
Voice-gender:neutral
|
||||
Prosody-volume:medium
|
||||
Content-Type:application/synthesis+ssml
|
||||
Content-Length:412
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<speak>
|
||||
<paragraph>
|
||||
<sentence>You have 4 new messages.</sentence>
|
||||
<sentence>The first is from <say-as type="name">Stephanie Williams</say-as>
|
||||
<mark name="Stephanie"/> and arrived at <break/>
|
||||
<say-as type="time">3:45pm</say-as>.</sentence>
|
||||
|
||||
<sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
|
||||
</paragraph>
|
||||
</speak>
|
||||
@@ -0,0 +1,4 @@
|
||||
//speechsynth
|
||||
SPEAK-COMPLETE 543260 COMPLETE MRCP/1.0
|
||||
Completion-Cause:000 normal
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
//speechsynth
|
||||
STOP 543258 MRCP/1.0
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
MRCP/2.0 865 DEFINE-GRAMMAR 543257
|
||||
Channel-Identifier:32AECB23433801@speechrecog
|
||||
Content-Type:application/srgs+xml
|
||||
Content-ID:<request1@form-level.store>
|
||||
Content-Length:685
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- the default grammar language is US English -->
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xml:lang="en-US" version="1.0">
|
||||
|
||||
<!-- single language attachment to tokens -->
|
||||
<rule id="yes">
|
||||
<one-of>
|
||||
<item xml:lang="fr-CA">oui</item>
|
||||
<item xml:lang="en-US">yes</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
|
||||
<!-- single language attachment to a rule expansion -->
|
||||
<rule id="request">
|
||||
may I speak to
|
||||
<one-of xml:lang="fr-CA">
|
||||
<item>Michel Tremblay</item>
|
||||
<item>Andre Roy</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
|
||||
</grammar>
|
||||
@@ -0,0 +1,5 @@
|
||||
MRCP/2.0 112 GET-PARAMS 543256
|
||||
Channel-Identifier:32AECB23433802@speechsynth
|
||||
Voice-gender:
|
||||
Voice-variant:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
MRCP/2.0 616 RECOGNITION-COMPLETE 543257 COMPLETE
|
||||
Channel-Identifier:32AECB23433801@speechrecog
|
||||
Completion-Cause:000 success
|
||||
Waveform-URI:<http://web.media.com/session123/audio.wav>;size=342456;duration=25435
|
||||
Content-Type:application/nlsml+xml
|
||||
Content-Length:430
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<result xmlns="http://www.ietf.org/xml/ns/mrcpv2"
|
||||
xmlns:ex="http://www.example.com/example"
|
||||
grammar="session:request1@form-level.store">
|
||||
<interpretation>
|
||||
<instance name="Person">
|
||||
<ex:Person>
|
||||
<ex:Name> Andre Roy </ex:Name>
|
||||
</ex:Person>
|
||||
</instance>
|
||||
<input> may I speak to Andre Roy </input>
|
||||
</interpretation>
|
||||
</result>
|
||||
@@ -0,0 +1,30 @@
|
||||
MRCP/2.0 903 RECOGNIZE 543257
|
||||
Channel-Identifier:32AECB23433801@speechrecog
|
||||
Confidence-Threshold:0.9
|
||||
Content-Type:application/srgs+xml
|
||||
Content-ID:<request1@form-level.store>
|
||||
Content-Length:702
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- the default grammar language is US English -->
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xml:lang="en-US" version="1.0" root="request">
|
||||
|
||||
<!-- single language attachment to tokens -->
|
||||
<rule id="yes">
|
||||
<one-of>
|
||||
<item xml:lang="fr-CA">oui</item>
|
||||
<item xml:lang="en-US">yes</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
|
||||
<!-- single language attachment to a rule expansion -->
|
||||
<rule id="request">
|
||||
may I speak to
|
||||
<one-of xml:lang="fr-CA">
|
||||
<item>Michel Tremblay</item>
|
||||
<item>Andre Roy</item>
|
||||
</one-of>
|
||||
</rule>
|
||||
</grammar>
|
||||
@@ -0,0 +1,5 @@
|
||||
MRCP/2.0 119 SET-PARAMS 543256
|
||||
Channel-Identifier:32AECB23433802@speechsynth
|
||||
Voice-gender:female
|
||||
Voice-variant:3
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
MRCP/2.0 732 SPEAK 543257
|
||||
Channel-Identifier:32AECB23433802@speechsynth
|
||||
Voice-gender:neutral
|
||||
Voice-Age:25
|
||||
Prosody-volume:medium
|
||||
Content-Type:application/ssml+xml
|
||||
Content-Length:542
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<speak version="1.0"
|
||||
xmlns="http://www.w3.org/2001/10/synthesis"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
|
||||
http://www.w3.org/TR/speech-synthesis/synthesis.xsd"
|
||||
xml:lang="en-US">
|
||||
<p>
|
||||
<s>You have 4 new messages.</s>
|
||||
<s>The first is from Stephanie Williams and arrived at
|
||||
<break/>
|
||||
<say-as interpret-as="vxml:time">0345p</say-as>.
|
||||
</s>
|
||||
<s>The subject is
|
||||
<prosody rate="-20%">ski trip</prosody>
|
||||
</s>
|
||||
</p>
|
||||
</speak>
|
||||
@@ -0,0 +1,5 @@
|
||||
MRCP/2.0 161 SPEAK-COMPLETE 543257 COMPLETE
|
||||
Channel-Identifier:32AECB23433802@speechsynth
|
||||
Completion-Cause:000 normal
|
||||
Speech-Marker:timestamp=857206027059
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
MRCP/2.0 74 STOP 543258
|
||||
Channel-Identifier:32AECB23433802@speechsynth
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/libs/uni-rtsp/include \
|
||||
-I$(top_srcdir)/libs/apr-toolkit/include \
|
||||
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
|
||||
|
||||
noinst_PROGRAMS = rtsptest
|
||||
rtsptest_LDADD = $(top_builddir)/libs/uni-rtsp/libunirtsp.la \
|
||||
$(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
|
||||
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
|
||||
rtsptest_SOURCES = src/main.c \
|
||||
src/parse_gen_suite.c
|
||||
@@ -0,0 +1,24 @@
|
||||
ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0
|
||||
CSeq:4
|
||||
Session:12345678
|
||||
Content-Type:application/mrcp
|
||||
Content-Length:567
|
||||
|
||||
SPEAK 543257 MRCP/1.0
|
||||
Kill-On-Barge-In:false
|
||||
Voice-gender:neutral
|
||||
Prosody-volume:medium
|
||||
Content-Type:application/synthesis+ssml
|
||||
Content-Length:412
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<speak>
|
||||
<paragraph>
|
||||
<sentence>You have 4 new messages.</sentence>
|
||||
<sentence>The first is from <say-as type="name">Stephanie Williams</say-as>
|
||||
<mark name="Stephanie"/> and arrived at <break/>
|
||||
<say-as type="time">3:45pm</say-as>.</sentence>
|
||||
|
||||
<sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
|
||||
</paragraph>
|
||||
</speak>
|
||||
@@ -0,0 +1,16 @@
|
||||
RTSP/1.0 200 OK
|
||||
CSeq:2
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457;server_port=46460-46461
|
||||
Session:12345678
|
||||
Content-Length:188
|
||||
Content-Type:application/sdp
|
||||
|
||||
v=0
|
||||
o=- 3211724219 3211724219 IN IP4 10.3.2.88
|
||||
s=Media Server
|
||||
c=IN IP4 0.0.0.0
|
||||
t=0 0
|
||||
m=audio 46460 RTP/AVP 0 96
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:96 telephone-event/8000
|
||||
a=fmtp:96 0-15
|
||||
@@ -0,0 +1,6 @@
|
||||
RTSP/1.0 200 OK
|
||||
CSeq:3
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457;
|
||||
server_port=46460-46461;mode=record;ttl=127
|
||||
Session:12345678
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
SETUP rtsp://media.server.com/media/recognizer RTSP/1.0
|
||||
CSeq:3
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457;
|
||||
mode=record;ttl=127
|
||||
Session:12345678;timeout=200
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0
|
||||
CSeq:2
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457
|
||||
Content-Type:application/sdp
|
||||
Content-Length:188
|
||||
|
||||
v=0
|
||||
o=- 123 456 IN IP4 10.0.0.1
|
||||
s=Media Server
|
||||
p=+1-888-555-1212
|
||||
c=IN IP4 0.0.0.0
|
||||
t=0 0
|
||||
m=audio 0 RTP/AVP 0 96
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:96 telephone-event/8000
|
||||
a=fmtp:96 0-15
|
||||
@@ -0,0 +1,4 @@
|
||||
TEARDOWN rtsp://media.server.com/media/synthesizer RTSP/1.0
|
||||
CSeq:12
|
||||
Session:12345678
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
RTSP/1.0 200 OK
|
||||
CSeq:3
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457;
|
||||
server_port=46460-46461;mode=record;ttl=127
|
||||
Session:12345678
|
||||
|
||||
SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0
|
||||
CSeq:2
|
||||
Transport:RTP/AVP;unicast;client_port=46456-46457
|
||||
Content-Type:application/sdp
|
||||
Content-Length:190
|
||||
|
||||
v=0
|
||||
o=- 123 456 IN IP4 10.0.0.1
|
||||
s=Media Server
|
||||
p=+1-888-555-1212
|
||||
c=IN IP4 0.0.0.0
|
||||
t=0 0
|
||||
m=audio 0 RTP/AVP 0 96
|
||||
a=rtpmap:0 pcmu/8000
|
||||
a=rtpmap:96 telephone-event/8000
|
||||
a=fmtp:96 0-15
|
||||
ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0
|
||||
CSeq:4
|
||||
Session:12345678
|
||||
Content-Type:application/mrcp
|
||||
Content-Length:567
|
||||
|
||||
SPEAK 543257 MRCP/1.0
|
||||
Kill-On-Barge-In:false
|
||||
Voice-gender:neutral
|
||||
Prosody-volume:medium
|
||||
Content-Type:application/synthesis+ssml
|
||||
Content-Length:412
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<speak>
|
||||
<paragraph>
|
||||
<sentence>You have 4 new messages.</sentence>
|
||||
<sentence>The first is from <say-as type="name">Stephanie Williams</say-as>
|
||||
<mark name="Stephanie"/> and arrived at <break/>
|
||||
<say-as type="time">3:45pm</say-as>.</sentence>
|
||||
|
||||
<sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>
|
||||
</paragraph>
|
||||
</speak>
|
||||
@@ -0,0 +1,167 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="rtsptest"
|
||||
ProjectGUID="{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
|
||||
RootNamespace="rtsptest"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\unirtsp.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\unirtsp.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
LinkTimeCodeGeneration="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\parse_gen_suite.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="include"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
|
||||
apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
|
||||
|
||||
int main(int argc, const char * const *argv)
|
||||
{
|
||||
apt_test_framework_t *test_framework;
|
||||
apt_test_suite_t *test_suite;
|
||||
apr_pool_t *pool;
|
||||
|
||||
/* one time apr global initialization */
|
||||
if(apr_initialize() != APR_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* create test framework */
|
||||
test_framework = apt_test_framework_create();
|
||||
pool = apt_test_framework_pool_get(test_framework);
|
||||
|
||||
/* create test suites and add them to test framework */
|
||||
test_suite = parse_gen_test_suite_create(pool);
|
||||
apt_test_framework_suite_add(test_framework,test_suite);
|
||||
|
||||
/* run tests */
|
||||
apt_test_framework_run(test_framework,argc,argv);
|
||||
|
||||
/* destroy test framework */
|
||||
apt_test_framework_destroy(test_framework);
|
||||
|
||||
/* final apr global termination */
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <apr_file_info.h>
|
||||
#include <apr_file_io.h>
|
||||
#include "apt_test_suite.h"
|
||||
#include "apt_log.h"
|
||||
#include "rtsp_stream.h"
|
||||
|
||||
static apt_bool_t test_stream_generate(rtsp_generator_t *generator, rtsp_message_t *message)
|
||||
{
|
||||
char buffer[500];
|
||||
apt_text_stream_t stream;
|
||||
rtsp_stream_result_e result;
|
||||
apt_bool_t continuation;
|
||||
|
||||
rtsp_generator_message_set(generator,message);
|
||||
do {
|
||||
apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
|
||||
continuation = FALSE;
|
||||
result = rtsp_generator_run(generator,&stream);
|
||||
if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
|
||||
stream.text.length = stream.pos - stream.text.buf;
|
||||
*stream.pos = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%lu bytes]\n%s",stream.text.length,stream.text.buf);
|
||||
}
|
||||
else if(result == RTSP_STREAM_MESSAGE_TRUNCATED) {
|
||||
*stream.pos = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%lu bytes] continuation awaiting\n%s",stream.text.length,stream.text.buf);
|
||||
continuation = TRUE;
|
||||
}
|
||||
else {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream");
|
||||
}
|
||||
}
|
||||
while(continuation == TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t rtsp_message_handler(void *obj, rtsp_message_t *message, rtsp_stream_result_e result)
|
||||
{
|
||||
if(result == RTSP_STREAM_MESSAGE_COMPLETE) {
|
||||
/* message is completely parsed */
|
||||
rtsp_generator_t *generator = obj;
|
||||
test_stream_generate(generator,message);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t test_file_process(apt_test_suite_t *suite, const char *file_path)
|
||||
{
|
||||
apr_file_t *file;
|
||||
char buffer[500];
|
||||
apt_text_stream_t stream;
|
||||
rtsp_parser_t *parser;
|
||||
rtsp_generator_t *generator;
|
||||
apr_size_t length;
|
||||
apr_size_t offset;
|
||||
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
|
||||
if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
parser = rtsp_parser_create(suite->pool);
|
||||
generator = rtsp_generator_create(suite->pool);
|
||||
|
||||
apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
|
||||
|
||||
do {
|
||||
/* init length of the stream */
|
||||
stream.text.length = sizeof(buffer)-1;
|
||||
/* calculate offset remaining from the previous receive / if any */
|
||||
offset = stream.pos - stream.text.buf;
|
||||
/* calculate available length */
|
||||
length = stream.text.length - offset;
|
||||
|
||||
if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
/* calculate actual length of the stream */
|
||||
stream.text.length = offset + length;
|
||||
stream.pos[length] = '\0';
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Stream [%lu bytes]\n%s",length,stream.pos);
|
||||
|
||||
/* reset pos */
|
||||
stream.pos = stream.text.buf;
|
||||
rtsp_stream_walk(parser,&stream,rtsp_message_handler,generator);
|
||||
}
|
||||
while(apr_file_eof(file) != APR_EOF);
|
||||
|
||||
apr_file_close(file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t test_dir_process(apt_test_suite_t *suite)
|
||||
{
|
||||
apr_status_t rv;
|
||||
apr_dir_t *dir;
|
||||
|
||||
const char *dir_name = "msg";
|
||||
if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
|
||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do {
|
||||
apr_finfo_t finfo;
|
||||
rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
|
||||
if(rv == APR_SUCCESS) {
|
||||
if(finfo.filetype == APR_REG && finfo.name) {
|
||||
char *file_path;
|
||||
apr_filepath_merge(&file_path,dir_name,finfo.name,0,suite->pool);
|
||||
test_file_process(suite,file_path);
|
||||
printf("\nPress ENTER to continue\n");
|
||||
getchar();
|
||||
}
|
||||
}
|
||||
}
|
||||
while(rv == APR_SUCCESS);
|
||||
|
||||
apr_dir_close(dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
|
||||
{
|
||||
test_dir_process(suite);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
|
||||
{
|
||||
apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
|
||||
return suite;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Multiple Resources UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechsynth
|
||||
a=cmid:1
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechrecog
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=sendrecv
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Recognizer Resource UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechrecog
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=sendonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Synthesizer Resource UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechsynth
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=recvonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Unknown Resource UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:unknown
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Synthesizer/Recognizer Resources UAC">
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechsynth
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=recvonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
|
||||
<!-- generated by sipp. To do so, use [call_id] token. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 INVITE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:new
|
||||
a=resource:speechsynth
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=sendrecv
|
||||
a=mid:1
|
||||
m=application 9 TCP/MRCPv2 1
|
||||
a=setup:active
|
||||
a=connection:existing
|
||||
a=resource:speechrecog
|
||||
a=cmid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="100"
|
||||
optional="true">
|
||||
</recv>
|
||||
|
||||
<recv response="180" optional="true">
|
||||
</recv>
|
||||
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv response="200" rtd="true">
|
||||
</recv>
|
||||
|
||||
<!-- Packet lost can be simulated in any send/recv message by -->
|
||||
<!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 1 ACK
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- This delay can be customized by the -d command-line option -->
|
||||
<!-- or by adding a 'milliseconds = "value"' option here. -->
|
||||
<pause/>
|
||||
|
||||
|
||||
<!-- The 'crlf' option inserts a blank line in the statistics report. -->
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
|
||||
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
|
||||
From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
|
||||
To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
|
||||
Call-ID: [call_id]
|
||||
CSeq: 2 BYE
|
||||
Contact: sip:sipp@[local_ip]:[local_port]
|
||||
Max-Forwards: 70
|
||||
Subject: Performance Test
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv response="200" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Recognizer Resource UAS">
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||
<!-- specified header if it was present in the last message received -->
|
||||
<!-- (except if it was a retransmission). If the header was not -->
|
||||
<!-- present or if no message has been received, the '[last_*]' -->
|
||||
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||
<!-- are also discarded. -->
|
||||
<!-- -->
|
||||
<!-- If the specified header was present several times in the -->
|
||||
<!-- message, all occurences are concatenated (CRLF seperated) -->
|
||||
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 1050 TCP/MRCPv2 1
|
||||
a=setup:passive
|
||||
a=connection:new
|
||||
a=channel:dca48cf082dd584b@speechrecog
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=recvonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 0 TCP/MRCPv2 1
|
||||
a=setup:passive
|
||||
a=connection:existing
|
||||
a=channel:dca48cf082dd584b@speechrecog
|
||||
a=cmid:1
|
||||
m=audio 0 RTP/AVP 0 8
|
||||
a=recvonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<recv request="BYE">
|
||||
</recv>
|
||||
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- Keep the call open for a while in case the 200 is lost to be -->
|
||||
<!-- able to retransmit it if we receive the BYE again. -->
|
||||
<pause milliseconds="4000"/>
|
||||
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Rejected Offer UAS">
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||
<!-- specified header if it was present in the last message received -->
|
||||
<!-- (except if it was a retransmission). If the header was not -->
|
||||
<!-- present or if no message has been received, the '[last_*]' -->
|
||||
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||
<!-- are also discarded. -->
|
||||
<!-- -->
|
||||
<!-- If the specified header was present several times in the -->
|
||||
<!-- message, all occurences are concatenated (CRLF seperated) -->
|
||||
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 404 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Length: 0
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Synthesizer Resource UAS">
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||
<!-- specified header if it was present in the last message received -->
|
||||
<!-- (except if it was a retransmission). If the header was not -->
|
||||
<!-- present or if no message has been received, the '[last_*]' -->
|
||||
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||
<!-- are also discarded. -->
|
||||
<!-- -->
|
||||
<!-- If the specified header was present several times in the -->
|
||||
<!-- message, all occurences are concatenated (CRLF seperated) -->
|
||||
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 1050 TCP/MRCPv2 1
|
||||
a=setup:passive
|
||||
a=connection:new
|
||||
a=channel:dca48cf082dd584b@speechsynth
|
||||
a=cmid:1
|
||||
m=audio [media_port] RTP/AVP 0 8
|
||||
a=sendonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 0 TCP/MRCPv2 1
|
||||
a=setup:passive
|
||||
a=connection:existing
|
||||
a=channel:dca48cf082dd584b@speechsynth
|
||||
a=cmid:1
|
||||
m=audio 0 RTP/AVP 0 8
|
||||
a=sendonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<recv request="BYE">
|
||||
</recv>
|
||||
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- Keep the call open for a while in case the 200 is lost to be -->
|
||||
<!-- able to retransmit it if we receive the BYE again. -->
|
||||
<pause milliseconds="4000"/>
|
||||
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE scenario SYSTEM "sipp.dtd">
|
||||
|
||||
|
||||
<scenario name="MRCP Unknown Resource UAS">
|
||||
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
|
||||
<!-- are saved and used for following messages sent. Useful to test -->
|
||||
<!-- against stateful SIP proxies/B2BUAs. -->
|
||||
<recv request="INVITE" crlf="true">
|
||||
</recv>
|
||||
|
||||
<!-- The '[last_*]' keyword is replaced automatically by the -->
|
||||
<!-- specified header if it was present in the last message received -->
|
||||
<!-- (except if it was a retransmission). If the header was not -->
|
||||
<!-- present or if no message has been received, the '[last_*]' -->
|
||||
<!-- keyword is discarded, and all bytes until the end of the line -->
|
||||
<!-- are also discarded. -->
|
||||
<!-- -->
|
||||
<!-- If the specified header was present several times in the -->
|
||||
<!-- message, all occurences are concatenated (CRLF seperated) -->
|
||||
<!-- to be used in place of the '[last_*]' keyword. -->
|
||||
|
||||
<send retrans="500">
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:];tag=[call_number]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Type: application/sdp
|
||||
Content-Length: [len]
|
||||
|
||||
v=0
|
||||
o=user1 53655765 2353687637 IN IP4 [local_ip]
|
||||
s=-
|
||||
c=IN IP4 [media_ip]
|
||||
t=0 0
|
||||
m=application 0 TCP/MRCPv2 1
|
||||
a=setup:passive
|
||||
a=connection:new
|
||||
a=channel:dca48cf082dd584b@unknown
|
||||
a=cmid:1
|
||||
m=audio 0 RTP/AVP 0 8
|
||||
a=sendonly
|
||||
a=mid:1
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<recv request="ACK"
|
||||
optional="true"
|
||||
rtd="true"
|
||||
crlf="true">
|
||||
</recv>
|
||||
|
||||
<recv request="BYE">
|
||||
</recv>
|
||||
|
||||
<send>
|
||||
<![CDATA[
|
||||
|
||||
SIP/2.0 200 OK
|
||||
[last_Via:]
|
||||
[last_From:]
|
||||
[last_To:]
|
||||
[last_Call-ID:]
|
||||
[last_CSeq:]
|
||||
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
|
||||
Content-Length: 0
|
||||
|
||||
]]>
|
||||
</send>
|
||||
|
||||
<!-- Keep the call open for a while in case the 200 is lost to be -->
|
||||
<!-- able to retransmit it if we receive the BYE again. -->
|
||||
<pause milliseconds="4000"/>
|
||||
|
||||
|
||||
<!-- definition of the response time repartition table (unit is ms) -->
|
||||
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
|
||||
|
||||
<!-- definition of the call length repartition table (unit is ms) -->
|
||||
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
|
||||
|
||||
</scenario>
|
||||
@@ -0,0 +1,9 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/libs/apr-toolkit/include \
|
||||
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
|
||||
|
||||
noinst_PROGRAMS = strtablegen
|
||||
strtablegen_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
|
||||
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
|
||||
strtablegen_SOURCES = src/main.c
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright 2008 Arsen Chaloyan
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "apt_pool.h"
|
||||
#include "apt_string_table.h"
|
||||
#include "apt_text_stream.h"
|
||||
|
||||
static apt_bool_t is_unique(const apt_str_table_item_t table[], apr_size_t count,
|
||||
apr_size_t item_index, apr_size_t char_index, char value)
|
||||
{
|
||||
size_t i;
|
||||
const char *buf;
|
||||
for(i=0; i<count; i++) {
|
||||
buf = table[i].value.buf;
|
||||
if(i != item_index && char_index < table[i].value.length &&
|
||||
tolower(value) == tolower(buf[char_index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static apt_bool_t string_table_key_generate(apt_str_table_item_t table[], apr_size_t count)
|
||||
{
|
||||
size_t i,j;
|
||||
size_t length;
|
||||
for(i=0; i<count; i++) {
|
||||
length = table[i].value.length;
|
||||
table[i].key = length;
|
||||
for(j=0; j<length; j++) {
|
||||
if(is_unique(table,count,i,j,table[i].value.buf[j]) == TRUE) {
|
||||
table[i].key = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define TEST_BUFFER_SIZE 2048
|
||||
static char parse_buffer[TEST_BUFFER_SIZE];
|
||||
|
||||
static size_t string_table_read(apt_str_table_item_t table[], apr_size_t max_count, FILE *file, apr_pool_t *pool)
|
||||
{
|
||||
apt_str_table_item_t *item;
|
||||
size_t count = 0;
|
||||
apt_str_t line;
|
||||
apt_text_stream_t text_stream;
|
||||
|
||||
text_stream.text.length = fread(parse_buffer, 1, sizeof(parse_buffer)-1, file);
|
||||
parse_buffer[text_stream.text.length] = '\0';
|
||||
text_stream.text.buf = parse_buffer;
|
||||
text_stream.pos = parse_buffer;
|
||||
|
||||
do {
|
||||
if(apt_text_line_read(&text_stream,&line) == FALSE || !line.length) {
|
||||
break;
|
||||
}
|
||||
item = &table[count];
|
||||
apt_string_copy(&item->value,&line,pool);
|
||||
item->key = 0;
|
||||
count++;
|
||||
}
|
||||
while(count < max_count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static apt_bool_t string_table_write(const apt_str_table_item_t table[], apr_size_t count, FILE *file)
|
||||
{
|
||||
size_t i;
|
||||
const apt_str_table_item_t *item;
|
||||
for(i=0; i<count; i++) {
|
||||
item = &table[i];
|
||||
fprintf(file,"{{\"%s\",%"APR_SIZE_T_FMT"},%"APR_SIZE_T_FMT"},\r\n",
|
||||
item->value.buf, item->value.length, item->key);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
apr_pool_t *pool = NULL;
|
||||
apt_str_table_item_t table[100];
|
||||
size_t count;
|
||||
FILE *file_in, *file_out;
|
||||
|
||||
/* one time apr global initialization */
|
||||
if(apr_initialize() != APR_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
pool = apt_pool_create();
|
||||
|
||||
if(argc < 2) {
|
||||
printf("usage: stringtablegen stringtable.in [stringtable.out]\n");
|
||||
return 0;
|
||||
}
|
||||
file_in = fopen(argv[1], "rb");
|
||||
if(file_in == NULL) {
|
||||
printf("cannot open file %s\n", argv[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(argc > 2) {
|
||||
file_out = fopen(argv[2], "wb");
|
||||
}
|
||||
else {
|
||||
file_out = stdout;
|
||||
}
|
||||
|
||||
/* read items (strings) from the file */
|
||||
count = string_table_read(table,100,file_in,pool);
|
||||
|
||||
/* generate string table */
|
||||
string_table_key_generate(table,count);
|
||||
|
||||
/* dump string table to the file */
|
||||
string_table_write(table,count,file_out);
|
||||
|
||||
fclose(file_in);
|
||||
if(file_out != stdout) {
|
||||
fclose(file_out);
|
||||
}
|
||||
|
||||
apr_pool_destroy(pool);
|
||||
/* final apr global termination */
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
Channel-Identifier
|
||||
Active-Request-Id-List
|
||||
Proxy-Sync-Id
|
||||
Accept-Charset
|
||||
Content-Type
|
||||
Content-Id
|
||||
Content-Base
|
||||
Content-Encoding
|
||||
Content-Location
|
||||
Content-Length
|
||||
Cache-Control
|
||||
Logging-Tag
|
||||
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="strtablegen"
|
||||
ProjectGUID="{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
|
||||
RootNamespace="strtablegen"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
|
||||
LinkTimeCodeGeneration="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\main.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="include"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Reference in new issue
Block a user