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:
Michael Jerris committed 2009-06-16 22:31:19 +00:00
1 parent ec90221783
commit da925bddf8
349 files changed
+47866

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="prepare"
ProjectGUID="{01D63BF5-7798-4746-852A-4B45229BB735}"
RootNamespace="prepare"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="10"
InheritedPropertySheets="$(SolutionDir)build\vsprops\apr.vsprops;$(SolutionDir)build\vsprops\sofiasip.vsprops"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;"
ExcludedFromBuild="false"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="10"
InheritedPropertySheets="$(SolutionDir)build\vsprops\apr.vsprops;$(SolutionDir)build\vsprops\sofiasip.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="xcopy &quot;$(AprDir)\$(ConfigurationName)\libapr-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;xcopy &quot;$(SofiaDir)\win32\pthread\pthreadVC2.dll&quot; &quot;$(SolutionDir)$(ConfigurationName)\bin\&quot; /Y&#x0D;&#x0A;&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\conf&quot; xcopy &quot;$(SolutionDir)conf\*.xml&quot; &quot;$(SolutionDir)$(ConfigurationName)\conf\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\data&quot; xcopy &quot;$(SolutionDir)data\*&quot; &quot;$(SolutionDir)$(ConfigurationName)\data\&quot; /Y&#x0D;&#x0A;if not exist &quot;$(SolutionDir)$(ConfigurationName)\log&quot; mkdir &quot;$(SolutionDir)$(ConfigurationName)\log\&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+235
View File
@@ -0,0 +1,235 @@
/*
* 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 <windows.h>
#include <apr_getopt.h>
#include "apt.h"
#include "apt_pool.h"
#define WIN_SERVICE_NAME "unimrcp"
/** Register/install service in SCM */
static apt_bool_t uni_service_register(const char *root_dir_path, apr_pool_t *pool)
{
char *bin_path;
SERVICE_DESCRIPTION desc;
SC_HANDLE sch_service;
SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
if(!sch_manager) {
printf("Failed to Open SCManager %d\n", GetLastError());
return FALSE;
}
bin_path = apr_psprintf(pool,"%s\\bin\\unimrcpserver.exe --service --root-dir \"%s\" -o 2",
root_dir_path,
root_dir_path);
sch_service = CreateService(
sch_manager,
WIN_SERVICE_NAME,
"UniMRCP Server",
GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
bin_path,0,0,0,0,0);
if(!sch_service) {
printf("Failed to Create Service %d\n", GetLastError());
CloseServiceHandle(sch_manager);
return FALSE;
}
desc.lpDescription = "Launches UniMRCP Server";
if(!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_DESCRIPTION,&desc)) {
printf("Failed to Set Service Description %d\n", GetLastError());
}
CloseServiceHandle(sch_service);
CloseServiceHandle(sch_manager);
return TRUE;
}
/** Unregister/uninstall service from SCM */
static apt_bool_t uni_service_unregister()
{
apt_bool_t status = TRUE;
SERVICE_STATUS ss_status;
SC_HANDLE sch_service;
SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
if(!sch_manager) {
printf("Failed to Open SCManager %d\n", GetLastError());
return FALSE;
}
sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,DELETE|SERVICE_STOP);
if(!sch_service) {
printf("Failed to Open Service %d\n", GetLastError());
CloseServiceHandle(sch_manager);
return FALSE;
}
ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status);
if(!DeleteService(sch_service)) {
printf("Failed to Delete Service %d\n", GetLastError());
status = FALSE;
}
CloseServiceHandle(sch_service);
CloseServiceHandle(sch_manager);
return status;
}
/** Start service */
static apt_bool_t uni_service_start()
{
apt_bool_t status = TRUE;
SC_HANDLE sch_service;
SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
if(!sch_manager) {
printf("Failed to Open SCManager %d\n", GetLastError());
return FALSE;
}
sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,SERVICE_START);
if(!sch_service) {
printf("Failed to Open Service %d\n", GetLastError());
CloseServiceHandle(sch_manager);
return FALSE;
}
if(!StartService(sch_service,0,NULL)) {
printf("Failed to Start Service %d\n", GetLastError());
status = FALSE;
}
CloseServiceHandle(sch_service);
CloseServiceHandle(sch_manager);
return status;
}
/** Stop service */
static apt_bool_t uni_service_stop()
{
apt_bool_t status = TRUE;
SERVICE_STATUS ss_status;
SC_HANDLE sch_service;
SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
if(!sch_manager) {
printf("Failed to Open SCManager %d\n", GetLastError());
return FALSE;
}
sch_service = OpenService(sch_manager,WIN_SERVICE_NAME,SERVICE_STOP);
if(!sch_service) {
printf("Failed to Open Service %d\n", GetLastError());
CloseServiceHandle(sch_manager);
return FALSE;
}
if(!ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status)) {
printf("Failed to Stop Service %d\n", GetLastError());
status = FALSE;
}
CloseServiceHandle(sch_service);
CloseServiceHandle(sch_manager);
return status;
}
static void usage()
{
printf(
"\n"
"Usage:\n"
"\n"
" unimrcpservice [options]\n"
"\n"
" Available options:\n"
"\n"
" -r [--register] rootdir : Register the Windows service.\n"
"\n"
" -u [--unregister] : Unregister the Windows service.\n"
"\n"
" -s [--start] : Start the Windows service.\n"
"\n"
" -t [--stop] : Stop the Windows service.\n"
"\n"
" -h [--help] : Show the help.\n"
"\n");
}
int main(int argc, const char * const *argv)
{
apr_pool_t *pool;
apr_status_t rv;
apr_getopt_t *opt;
static const apr_getopt_option_t opt_option[] = {
/* long-option, short-option, has-arg flag, description */
{ "register", 'r', TRUE, "register service" }, /* -r or --register arg */
{ "unregister", 'u', FALSE, "unregister service" },/* -u or --unregister */
{ "start", 's', FALSE, "start service" }, /* -s or --start */
{ "stop", 't', FALSE, "stop service" }, /* -t or --stop */
{ "help", 'h', FALSE, "show help" }, /* -h or --help */
{ NULL, 0, 0, NULL }, /* end */
};
/* APR global initialization */
if(apr_initialize() != APR_SUCCESS) {
apr_terminate();
return 0;
}
/* create APR pool */
pool = apt_pool_create();
if(!pool) {
apr_terminate();
return 0;
}
rv = apr_getopt_init(&opt, pool , argc, argv);
if(rv == APR_SUCCESS) {
int optch;
const char *optarg;
while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
switch(optch) {
case 'r':
uni_service_register(optarg,pool);
break;
case 'u':
uni_service_unregister();
break;
case 's':
uni_service_start();
break;
case 't':
uni_service_stop();
break;
case 'h':
usage();
break;
}
}
if(rv != APR_EOF) {
usage();
}
}
/* destroy APR pool */
apr_pool_destroy(pool);
/* APR global termination */
apr_terminate();
return 0;
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="<AppName>" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="unimrcpservice"
ProjectGUID="{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
RootNamespace="unimrcpservice"
>
<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="libaprutil-1.lib libapr-1.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="unimrcpservice.exe.manifest"
/>
<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="libaprutil-1.lib libapr-1.lib"
LinkTimeCodeGeneration="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="unimrcpservice.exe.manifest"
/>
<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=".\unimrcp_service.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>