git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6325 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2007-11-19 15:22:03 +00:00
parent 1c02f4560f
commit 073a49c94c
12 changed files with 0 additions and 2330 deletions

View File

@ -1,47 +0,0 @@
# define these targets in your makefile if you wish
# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
# and define these variables to impact your build
PERL = `which perl`
PERL_LIBDIR =-L$(shell perl -MConfig -e 'print $$Config{archlib}')/CORE
PERL_LIBS =$(shell perl -MConfig -e 'print $$Config{libs}')
LOCAL_CFLAGS=-w -DMULTIPLICITY $(shell $(PERL) -MExtUtils::Embed -e ccopts) -DEMBED_PERL
LOCAL_LDFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ldopts) $(shell $(PERL) -MConfig -e 'print $$Config{libs}')
LOCAL_OBJS=perlxsi.o
include ../../../../build/modmake.rules
SWIGCFILE=../../../switch_swig.c
SWIGIFILE=../../../switch_swig.i
local_all: fs_perl.$(DYNAMIC_LIB_EXTEN)
.perlok:
@(${PERL} -V | grep -i usemultiplicity=define >/dev/null && echo Phew, You have the right perl.) \
|| ((echo Sorry, you need to compile perl with threads and multiplicity.&& exit 1))
@touch .perlok
reswig:
rm switch_swig_wrap.c
swig -o switch_swig_wrap.c -l$(SWIGIFILE) -ignoremissing -DMULTIPLICITY -perl5 -module fs_perl $(SWIGCFILE)
switch_swig.o: $(SWIGCFILE) Makefile
$(CC) -w $(ALL_CFLAGS) -c $< -o $@
switch_swig_wrap.o: switch_swig_wrap.c
$(CC) -w $(ALL_CFLAGS) -c $< -o $@
fs_perl.$(DYNAMIC_LIB_EXTEN): $(MODNAME).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o
$(LINK) $(SOLINK) -o fs_perl.$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o $(LDFLAGS)
local_clean:
rm -fr *~ .perlok
depend_install:
mkdir -p $(PREFIX)/perl
$(LTINSTALL) fs_perl.$(DYNAMIC_LIB_EXTEN) fs_perl.pm $(PREFIX)/perl
if [ ! -f $(PREFIX)/perl/freeswitch.pm ] ; then $(LTINSTALL) freeswitch.pm $(PREFIX)/perl ; fi

View File

@ -1 +0,0 @@
/IC:\perl\lib\CORE

View File

@ -1 +0,0 @@
/I@PERL_INCLUDE@

View File

@ -1,11 +0,0 @@
package fs_perl;
use Data::Dumper;
sub wazzup() {
fs_console_log("WOOHOO!\n");
$session = fs_core_session_locate($SWITCH_ENV{UUID});
fs_channel_answer($session);
fs_ivr_play_file($session, "/root/siriusraw.raw", "");
}
1;

View File

@ -1,83 +0,0 @@
# This file was automatically generated by SWIG
package fs_perl;
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
package fs_perlc;
bootstrap fs_perl;
package fs_perl;
@EXPORT = qw( );
# ---------- BASE METHODS -------------
package fs_perl;
sub TIEHASH {
my ($classname,$obj) = @_;
return bless $obj, $classname;
}
sub CLEAR { }
sub FIRSTKEY { }
sub NEXTKEY { }
sub FETCH {
my ($self,$field) = @_;
my $member_func = "swig_${field}_get";
$self->$member_func();
}
sub STORE {
my ($self,$field,$newval) = @_;
my $member_func = "swig_${field}_set";
$self->$member_func($newval);
}
sub this {
my $ptr = shift;
return tied(%$ptr);
}
# ------- FUNCTION WRAPPERS --------
package fs_perl;
*fs_core_set_globals = *fs_perlc::fs_core_set_globals;
*fs_core_init = *fs_perlc::fs_core_init;
*fs_core_destroy = *fs_perlc::fs_core_destroy;
*fs_loadable_module_init = *fs_perlc::fs_loadable_module_init;
*fs_loadable_module_shutdown = *fs_perlc::fs_loadable_module_shutdown;
*fs_console_loop = *fs_perlc::fs_console_loop;
*fs_consol_log = *fs_perlc::fs_consol_log;
*fs_consol_clean = *fs_perlc::fs_consol_clean;
*fs_core_session_locate = *fs_perlc::fs_core_session_locate;
*fs_channel_answer = *fs_perlc::fs_channel_answer;
*fs_channel_pre_answer = *fs_perlc::fs_channel_pre_answer;
*fs_channel_hangup = *fs_perlc::fs_channel_hangup;
*fs_channel_set_variable = *fs_perlc::fs_channel_set_variable;
*fs_channel_get_variable = *fs_perlc::fs_channel_get_variable;
*fs_channel_set_state = *fs_perlc::fs_channel_set_state;
*fs_ivr_play_file = *fs_perlc::fs_ivr_play_file;
*fs_switch_ivr_record_file = *fs_perlc::fs_switch_ivr_record_file;
*fs_switch_ivr_sleep = *fs_perlc::fs_switch_ivr_sleep;
*fs_ivr_play_file2 = *fs_perlc::fs_ivr_play_file2;
*fs_switch_ivr_collect_digits_callback = *fs_perlc::fs_switch_ivr_collect_digits_callback;
*fs_switch_ivr_collect_digits_count = *fs_perlc::fs_switch_ivr_collect_digits_count;
*fs_switch_ivr_originate = *fs_perlc::fs_switch_ivr_originate;
*fs_switch_ivr_session_transfer = *fs_perlc::fs_switch_ivr_session_transfer;
*fs_switch_ivr_speak_text = *fs_perlc::fs_switch_ivr_speak_text;
*fs_switch_channel_get_variable = *fs_perlc::fs_switch_channel_get_variable;
*fs_switch_channel_set_variable = *fs_perlc::fs_switch_channel_set_variable;
# ------- VARIABLE STUBS --------
package fs_perl;
*FREESWITCH_PEN = *fs_perlc::FREESWITCH_PEN;
*FREESWITCH_OID_PREFIX = *fs_perlc::FREESWITCH_OID_PREFIX;
*FREESWITCH_ITAD = *fs_perlc::FREESWITCH_ITAD;
*__EXTENSIONS__ = *fs_perlc::__EXTENSIONS__;
1;

View File

@ -1,213 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="fs_perl"
ProjectGUID="{B0C6CFF9-7DCD-4A21-8BA4-C2011E18DED8}"
RootNamespace="fs_perl"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="@compiler.opts"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;."
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FS_PERL_EXPORTS;MULTIPLICITY;EMBED_PERL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(OutDir)/Perl/$(InputName).dll"
Version=""
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\w32\vsnet\$(ConfigurationName)&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="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"
CommandLine="@xcopy $(InputDir)fs_perl.pm $(Outdir)\Perl\ /C /D /Y&#x0D;&#x0A;@if not exist $(Outdir)\Perl\freeswitch.pm xcopy $(InputDir)freeswitch.pm $(Outdir)\Perl\ /C /Y&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="@compiler.opts"
AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;."
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FS_PERL_EXPORTS;MULTIPLICITY;EMBED_PERL"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(SolutionDir)$(OutDir)/Perl/$(InputName).dll"
Version=""
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\w32\vsnet\$(ConfigurationName)&quot;"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="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"
CommandLine="@xcopy $(InputDir)fs_perl.pm $(Outdir)\Perl\ /C /D /Y&#x0D;&#x0A;@if not exist $(Outdir)\Perl\freeswitch.pm xcopy $(InputDir)freeswitch.pm $(Outdir)\Perl\ /C /Y&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\switch_swig.c"
>
</File>
<File
RelativePath=".\switch_swig_wrap.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
WarningLevel="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
WarningLevel="0"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,131 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthmct@yahoo.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthmct@yahoo.com>
*
*
* mod_perl.c -- Perl
*
*/
#ifdef __ICC
#pragma warning (disable:1419)
#endif
#ifdef _MSC_VER
#include <perlibs.h>
#pragma comment(lib, PERL_LIB)
#endif
#include <EXTERN.h>
#include <perl.h>
#include <switch.h>
static char *embedding[] = { "", "-e", "" };
EXTERN_C void xs_init(pTHX);
SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown);
SWITCH_MODULE_DEFINITION(mod_perl, mod_perl_load, mod_perl_shutdown, NULL);
static struct {
PerlInterpreter *my_perl;
} globals;
static void destroy_perl(PerlInterpreter ** to_destroy)
{
perl_destruct(*to_destroy);
perl_free(*to_destroy);
*to_destroy = NULL;
}
static PerlInterpreter *clone_perl(void)
{
return perl_clone(globals.my_perl, CLONEf_COPY_STACKS | CLONEf_KEEP_PTR_TABLE);
}
static void perl_function(switch_core_session_t *session, char *data)
{
char *uuid = switch_core_session_get_uuid(session);
char code[1024];
PerlInterpreter *my_perl = clone_perl();
sprintf(code, "package fs_perl;\n" "$SWITCH_ENV{UUID} = \"%s\";\n" "chdir(\"%s/perl\");\n", uuid, SWITCH_GLOBAL_dirs.base_dir);
Perl_eval_pv(my_perl, code, TRUE);
Perl_eval_pv(my_perl, data, TRUE);
destroy_perl(&my_perl);
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown)
{
if (globals.my_perl) {
perl_destruct(globals.my_perl);
perl_free(globals.my_perl);
globals.my_perl = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Unallocated perl interpreter.\n");
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load)
{
switch_application_interface_t *app_interface;
PerlInterpreter *my_perl;
char code[1024];
if (!(my_perl = perl_alloc())) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl intrepreter\n");
return SWITCH_STATUS_MEMERR;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Allocated perl intrepreter.\n");
PERL_SET_CONTEXT(my_perl);
perl_construct(my_perl);
perl_parse(my_perl, xs_init, 3, embedding, NULL);
perl_run(my_perl);
globals.my_perl = my_perl;
sprintf(code, "use lib '%s/perl';use fs_perl;use freeswitch\n", SWITCH_GLOBAL_dirs.base_dir);
Perl_eval_pv(my_perl, code, TRUE);
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "perl", NULL, NULL, perl_function, NULL, SAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
*/

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="mod_perl"
ProjectGUID="{7B077E7F-1BE7-4291-AB86-55E527B25CAC}"
RootNamespace="mod_perl"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="if not exist perlxsi.c perl -MExtUtils::Embed -e xsinit"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="@compiler.opts"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE;MULTIPLICITY;EMBED_PERL"
UsePrecompiledHeader="0"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="if not exist perlxsi.c perl -MExtUtils::Embed -e xsinit"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="@compiler.opts"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;MULTIPLICITY;EMBED_PERL"
UsePrecompiledHeader="0"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\mod_perl.c"
>
</File>
<File
RelativePath=".\perlxsi.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1 +0,0 @@
#define PERL_LIB "C:\\perl\\lib\\CORE\\perl58.lib"

View File

@ -1 +0,0 @@
#define PERL_LIB "@PERL_LIB@"

View File

@ -1,18 +0,0 @@
#ifdef __ICC
#pragma warning (disable:1419)
#endif
#include <EXTERN.h>
#include <perl.h>
EXTERN_C void xs_init(pTHX);
EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
EXTERN_C void xs_init(pTHX)
{
char *file = __FILE__;
dXSUB_SYS;
/* DynaLoader is a special case */
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
}

File diff suppressed because it is too large Load Diff