forked from Mirrors/freeswitch
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4405 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
c64f6ce5c0
commit
58f7f5da9b
@ -1,43 +0,0 @@
|
|||||||
LCFLAGS=-fPIC -DZTS -DPTHREADS
|
|
||||||
CFLAGS += -fPIC -I../../../../libs/ruby-1.8.5/
|
|
||||||
RBMOD=freeswitch
|
|
||||||
LDFLAGS=-lruby-static -L$(PREFIX)/lib/
|
|
||||||
SWIGCFILE=../../../switch_swig.c
|
|
||||||
SWIGIFILE=../../../switch_swig.i
|
|
||||||
|
|
||||||
all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(RBMOD).$(DYNAMIC_LIB_EXTEN)
|
|
||||||
|
|
||||||
depends:
|
|
||||||
MAKE=$(MAKE) MOD_CFLAGS=-fPIC $(BASE)/build/buildlib.sh $(BASE) install ruby-1.8.5.tar.gz --prefix=$(PREFIX)
|
|
||||||
cp -f config.h ../../../../libs/ruby-1.8.5/
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
mod_ruby.c:
|
|
||||||
$(CC) $(LCFLAGS) $(CFLAGS) -c mod_ruby.c -o mod_ruby.o
|
|
||||||
|
|
||||||
reswig:
|
|
||||||
rm -f switch_swig_wrap.c config.m4 CREDITS *${RBMOD}*
|
|
||||||
swig -o switch_swig_wrap.c -l$(SWIGIFILE) -ignoremissing -DMULTIPLICITY -ruby -module $(RBMOD) $(SWIGCFILE)
|
|
||||||
|
|
||||||
switch_swig_wrap.o: switch_swig_wrap.c Makefile
|
|
||||||
$(CC) -w $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
switch_swig.o: $(SWIGCFILE) Makefile
|
|
||||||
$(CC) -w $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
|
|
||||||
$(RBMOD).$(DYNAMIC_LIB_EXTEN): $(MODNAME).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o Makefile
|
|
||||||
$(CC) $(SOLINK) -o rb_$(RBMOD).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o $(LDFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS) Makefile
|
|
||||||
$(CC) $(LCFLAGS) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~
|
|
||||||
|
|
||||||
install:
|
|
||||||
#cp -f rb_$(RBMOD).$(DYNAMIC_LIB_EXTEN) $(MDIR)
|
|
||||||
cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
|
|
@ -1,8 +0,0 @@
|
|||||||
Well here is what I know. As of now more or less the license
|
|
||||||
maybe compatible. I am releasing with the clause that if the
|
|
||||||
author of Ruby comes back and doesnt offer a license to us I
|
|
||||||
will be pulling it back from the tree. Im sorry but licensing
|
|
||||||
is licensing.
|
|
||||||
|
|
||||||
--Brian Fertig
|
|
||||||
mod_ruby - Developer/Maintainer
|
|
@ -1,175 +0,0 @@
|
|||||||
//#define PACKAGE_NAME ""
|
|
||||||
//#define PACKAGE_TARNAME ""
|
|
||||||
//#define PACKAGE_VERSION ""
|
|
||||||
//#define PACKAGE_STRING ""
|
|
||||||
//#define PACKAGE_BUGREPORT ""
|
|
||||||
#define USE_BUILTIN_FRAME_ADDRESS 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
|
||||||
#define HAVE_SYS_STAT_H 1
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
#define HAVE_STRINGS_H 1
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
|
||||||
#define HAVE_LONG_LONG 1
|
|
||||||
#define HAVE_OFF_T 1
|
|
||||||
#define SIZEOF_INT 4
|
|
||||||
#define SIZEOF_SHORT 2
|
|
||||||
#define SIZEOF_LONG 4
|
|
||||||
#define SIZEOF_LONG_LONG 8
|
|
||||||
#define SIZEOF___INT64 0
|
|
||||||
#define SIZEOF_OFF_T 8
|
|
||||||
#define SIZEOF_VOIDP 4
|
|
||||||
#define SIZEOF_FLOAT 4
|
|
||||||
#define SIZEOF_DOUBLE 8
|
|
||||||
#define SIZEOF_TIME_T 4
|
|
||||||
#define rb_pid_t pid_t
|
|
||||||
#define rb_gid_t gid_t
|
|
||||||
#define rb_uid_t uid_t
|
|
||||||
#define HAVE_PROTOTYPES 1
|
|
||||||
#define TOKEN_PASTE(x,y) x##y
|
|
||||||
#define HAVE_STDARG_PROTOTYPES 1
|
|
||||||
#define NORETURN(x) x __attribute__ ((noreturn))
|
|
||||||
#define HAVE_DECL_SYS_NERR 1
|
|
||||||
#define HAVE_LIBCRYPT 1
|
|
||||||
#define HAVE_LIBDL 1
|
|
||||||
#define HAVE_DIRENT_H 1
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
#define HAVE_SYS_WAIT_H 1
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
#define HAVE_UNISTD_H 1
|
|
||||||
#define HAVE_LIMITS_H 1
|
|
||||||
#define HAVE_SYS_FILE_H 1
|
|
||||||
#define HAVE_SYS_IOCTL_H 1
|
|
||||||
#define HAVE_SYS_SYSCALL_H 1
|
|
||||||
#define HAVE_FCNTL_H 1
|
|
||||||
#define HAVE_SYS_FCNTL_H 1
|
|
||||||
#define HAVE_SYS_SELECT_H 1
|
|
||||||
#define HAVE_SYS_TIME_H 1
|
|
||||||
#define HAVE_SYS_TIMES_H 1
|
|
||||||
#define HAVE_SYS_PARAM_H 1
|
|
||||||
#define HAVE_SYSCALL_H 1
|
|
||||||
#define HAVE_PWD_H 1
|
|
||||||
#define HAVE_GRP_H 1
|
|
||||||
#define HAVE_A_OUT_H 1
|
|
||||||
#define HAVE_UTIME_H 1
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
#define HAVE_SYS_RESOURCE_H 1
|
|
||||||
#define HAVE_NETINET_IN_SYSTM_H 1
|
|
||||||
#define HAVE_FLOAT_H 1
|
|
||||||
#define HAVE_PTHREAD_H 1
|
|
||||||
#define HAVE_UCONTEXT_H 1
|
|
||||||
#define SIZEOF_RLIM_T 8
|
|
||||||
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
|
|
||||||
#define HAVE_ST_BLKSIZE 1
|
|
||||||
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
|
|
||||||
#define HAVE_ST_BLOCKS 1
|
|
||||||
#define HAVE_STRUCT_STAT_ST_RDEV 1
|
|
||||||
#define HAVE_ST_RDEV 1
|
|
||||||
#define GETGROUPS_T gid_t
|
|
||||||
#define RETSIGTYPE void
|
|
||||||
#define HAVE_ALLOCA_H 1
|
|
||||||
#define HAVE_ALLOCA 1
|
|
||||||
#define _LARGEFILE_SOURCE 1
|
|
||||||
#define HAVE_FSEEKO 1
|
|
||||||
#define HAVE_FTELLO 1
|
|
||||||
#define HAVE_DUP2 1
|
|
||||||
#define HAVE_MEMMOVE 1
|
|
||||||
#define HAVE_STRCASECMP 1
|
|
||||||
#define HAVE_STRNCASECMP 1
|
|
||||||
#define HAVE_STRERROR 1
|
|
||||||
#define HAVE_STRFTIME 1
|
|
||||||
#define HAVE_STRCHR 1
|
|
||||||
#define HAVE_STRSTR 1
|
|
||||||
#define HAVE_STRTOUL 1
|
|
||||||
#define HAVE_CRYPT 1
|
|
||||||
#define HAVE_FLOCK 1
|
|
||||||
#define HAVE_VSNPRINTF 1
|
|
||||||
#define HAVE_ISNAN 1
|
|
||||||
#define HAVE_FINITE 1
|
|
||||||
#define HAVE_ISINF 1
|
|
||||||
#define HAVE_HYPOT 1
|
|
||||||
#define HAVE_ACOSH 1
|
|
||||||
#define HAVE_ERF 1
|
|
||||||
#define HAVE_FMOD 1
|
|
||||||
#define HAVE_KILLPG 1
|
|
||||||
#define HAVE_WAIT4 1
|
|
||||||
#define HAVE_WAITPID 1
|
|
||||||
#define HAVE_SYSCALL 1
|
|
||||||
#define HAVE_CHROOT 1
|
|
||||||
#define HAVE_FSYNC 1
|
|
||||||
#define HAVE_GETCWD 1
|
|
||||||
#define HAVE_TRUNCATE 1
|
|
||||||
#define HAVE_TIMES 1
|
|
||||||
#define HAVE_UTIMES 1
|
|
||||||
#define HAVE_FCNTL 1
|
|
||||||
#define HAVE_LOCKF 1
|
|
||||||
#define HAVE_LSTAT 1
|
|
||||||
#define HAVE_SYMLINK 1
|
|
||||||
#define HAVE_LINK 1
|
|
||||||
#define HAVE_READLINK 1
|
|
||||||
#define HAVE_SETITIMER 1
|
|
||||||
#define HAVE_SETEUID 1
|
|
||||||
#define HAVE_SETREUID 1
|
|
||||||
#define HAVE_SETRESUID 1
|
|
||||||
#define HAVE_SETEGID 1
|
|
||||||
#define HAVE_SETREGID 1
|
|
||||||
#define HAVE_SETRESGID 1
|
|
||||||
#define HAVE_PAUSE 1
|
|
||||||
#define HAVE_LCHOWN 1
|
|
||||||
#define HAVE_GETPGRP 1
|
|
||||||
#define HAVE_SETPGRP 1
|
|
||||||
#define HAVE_GETPGID 1
|
|
||||||
#define HAVE_SETPGID 1
|
|
||||||
#define HAVE_INITGROUPS 1
|
|
||||||
#define HAVE_GETGROUPS 1
|
|
||||||
#define HAVE_SETGROUPS 1
|
|
||||||
#define HAVE_GETPRIORITY 1
|
|
||||||
#define HAVE_GETRLIMIT 1
|
|
||||||
#define HAVE_SETRLIMIT 1
|
|
||||||
#define HAVE_SYSCONF 1
|
|
||||||
#define HAVE_DLOPEN 1
|
|
||||||
#define HAVE_SIGPROCMASK 1
|
|
||||||
#define HAVE_SIGACTION 1
|
|
||||||
#define HAVE__SETJMP 1
|
|
||||||
#define HAVE_SETSID 1
|
|
||||||
#define HAVE_TELLDIR 1
|
|
||||||
#define HAVE_SEEKDIR 1
|
|
||||||
#define HAVE_FCHMOD 1
|
|
||||||
#define HAVE_MKTIME 1
|
|
||||||
#define HAVE_TIMEGM 1
|
|
||||||
#define HAVE_COSH 1
|
|
||||||
#define HAVE_SINH 1
|
|
||||||
#define HAVE_TANH 1
|
|
||||||
#define HAVE_SETUID 1
|
|
||||||
#define HAVE_SETGID 1
|
|
||||||
#define HAVE_SETENV 1
|
|
||||||
#define HAVE_UNSETENV 1
|
|
||||||
#define HAVE_STRUCT_TM_TM_ZONE 1
|
|
||||||
#define HAVE_TM_ZONE 1
|
|
||||||
#define HAVE_STRUCT_TM_TM_GMTOFF 1
|
|
||||||
#define HAVE_DAYLIGHT 1
|
|
||||||
#define NEGATIVE_TIME_T 1
|
|
||||||
#define POSIX_SIGNAL 1
|
|
||||||
#define GETPGRP_VOID 1
|
|
||||||
#define SETPGRP_VOID 1
|
|
||||||
#define RSHIFT(x,y) ((x)>>(int)y)
|
|
||||||
#define FILE_READPTR _IO_read_ptr
|
|
||||||
#define FILE_READEND _IO_read_end
|
|
||||||
#define HUGE_ST_INO 1
|
|
||||||
#define HAVE__SC_CLK_TCK 1
|
|
||||||
#define STACK_GROW_DIRECTION -1
|
|
||||||
#define DEFAULT_KCODE KCODE_NONE
|
|
||||||
#define USE_ELF 1
|
|
||||||
#define DLEXT ".so"
|
|
||||||
#define RUBY_LIB "/usr/local/lib/ruby/1.8"
|
|
||||||
#define RUBY_SITE_LIB "/usr/local/lib/ruby/site_ruby"
|
|
||||||
#define RUBY_SITE_LIB2 "/usr/local/lib/ruby/site_ruby/1.8"
|
|
||||||
#define RUBY_PLATFORM "i686-linux"
|
|
||||||
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.8/i686-linux"
|
|
||||||
#define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/site_ruby/1.8/i686-linux"
|
|
@ -1,118 +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):
|
|
||||||
*
|
|
||||||
* Brian Fertig <brian.fertig@convergencetek.com>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* mod_ruby.c -- ruby Module
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _REENTRANT
|
|
||||||
#define _REENTRANT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
|
|
||||||
#include <ruby.h>
|
|
||||||
|
|
||||||
const char modname[] = "mod_ruby";
|
|
||||||
|
|
||||||
static void ruby_function(switch_core_session_t *session, char *data)
|
|
||||||
{
|
|
||||||
char *uuid = switch_core_session_get_uuid(session);
|
|
||||||
uint32_t ulen = strlen(uuid);
|
|
||||||
uint32_t len = strlen((char *) data) + ulen + 2;
|
|
||||||
char *mydata = switch_core_session_alloc(session, len);
|
|
||||||
int argc, state;
|
|
||||||
char *argv[5];
|
|
||||||
char ruby_code[1024];
|
|
||||||
|
|
||||||
snprintf(mydata, len, "%s %s", uuid, data);
|
|
||||||
|
|
||||||
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
|
||||||
|
|
||||||
sprintf(ruby_code, "$uuid=\"%s\"; include(\"%s\");\n", argv[0], argv[1]);
|
|
||||||
|
|
||||||
ruby_init();
|
|
||||||
|
|
||||||
ruby_init_loadpath();
|
|
||||||
|
|
||||||
ruby_script("embedded");
|
|
||||||
rb_load_file(data);
|
|
||||||
rb_p(rb_eval_string_protect(argv[1], &state));
|
|
||||||
if (state) {
|
|
||||||
VALUE error = rb_inspect(rb_gv_get("$!"));
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Your code is broken. \nHere is the error I found: %s\n",error);
|
|
||||||
}
|
|
||||||
state = ruby_exec();
|
|
||||||
state = ruby_cleanup(state);
|
|
||||||
ruby_finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
static const switch_application_interface_t ruby_application_interface = {
|
|
||||||
/*.interface_name */ "ruby",
|
|
||||||
/*.application_function */ ruby_function,
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
/* flags */ SAF_NONE, /* should we support no media mode here? If so, we need to detect the mode, and either disable the media functions or indicate media if/when we need */
|
|
||||||
/*.next*/ NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static switch_loadable_module_interface_t ruby_module_interface = {
|
|
||||||
/*.module_name */ modname,
|
|
||||||
/*.endpoint_interface */ NULL,
|
|
||||||
/*.timer_interface */ NULL,
|
|
||||||
/*.dialplan_interface */ NULL,
|
|
||||||
/*.codec_interface */ NULL,
|
|
||||||
/*.application_interface */ &ruby_application_interface,
|
|
||||||
/*.api_interface */ NULL,
|
|
||||||
/*.file_interface */ NULL,
|
|
||||||
/*.speech_interface */ NULL,
|
|
||||||
/*.directory_interface */ NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
|
||||||
{
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
|
||||||
*module_interface = &ruby_module_interface;
|
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For Emacs:
|
|
||||||
* Local Variables:
|
|
||||||
* mode:c
|
|
||||||
* indent-tabs-mode:nil
|
|
||||||
* tab-width:4
|
|
||||||
* c-basic-offset:4
|
|
||||||
* End:
|
|
||||||
* For VIM:
|
|
||||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
|
||||||
*/
|
|
@ -1,7 +0,0 @@
|
|||||||
%module fs_elmoscript
|
|
||||||
%{
|
|
||||||
#include "switch.h"
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include "/usr/local/freeswitch/include/switch.h"
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user