Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
cb09b09f
提交
cb09b09f
authored
5月 08, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
whatever
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@5102
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
83f84876
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
37 行增加
和
13 行删除
+37
-13
Makefile
src/mod/languages/mod_python/Makefile
+4
-4
mod_python.c
src/mod/languages/mod_python/mod_python.c
+32
-8
mod_spidermonkey.h
src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
+1
-1
没有找到文件。
src/mod/languages/mod_python/Makefile
浏览文件 @
cb09b09f
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
# and define these variables to impact your build
# and define these variables to impact your build
LOCAL_CFLAGS
=
-I
$(PREFIX)
/include/python2.
4
/
LOCAL_CFLAGS
=
-I
$(PREFIX)
/include/python2.
5
/
LOCAL_LDFLAGS
=
-lpython2
.
4
-L
$(PREFIX)
/lib/python2.4
/config/
-lutil
-lstdc
++
LOCAL_LDFLAGS
=
-lpython2
.
5
-L
$(PREFIX)
/lib/python2.5
/config/
-lutil
-lstdc
++
LOCAL_OBJS
=
freeswitch_python.o mod_python_wrap.o
LOCAL_OBJS
=
freeswitch_python.o mod_python_wrap.o
include
../../../../build/modmake.rules
include
../../../../build/modmake.rules
...
@@ -14,7 +14,7 @@ SWIGCFILE=../../../switch_swig.c
...
@@ -14,7 +14,7 @@ SWIGCFILE=../../../switch_swig.c
SWIGIFILE
=
../../../switch_swig.i
SWIGIFILE
=
../../../switch_swig.i
local_depend
:
local_depend
:
MAKE
=
$(MAKE)
$(BASE)
/build/buildlib.sh
$(BASE)
install
Python-2.
4.3
.tgz
--prefix
=
$(PREFIX)
--enable-threads
CFLAGSFORSHARED
=
"-fPIC"
MAKE
=
$(MAKE)
$(BASE)
/build/buildlib.sh
$(BASE)
install
Python-2.
5.1
.tgz
--prefix
=
$(PREFIX)
--enable-threads
CFLAGSFORSHARED
=
"-fPIC"
reswig
:
reswig
:
swig
-python
-shadow
-c
++
-o
mod_python_wrap.cpp mod_python.i
swig
-python
-shadow
-c
++
-o
mod_python_wrap.cpp mod_python.i
...
@@ -26,5 +26,5 @@ switch_swig.o: $(SWIGCFILE) Makefile
...
@@ -26,5 +26,5 @@ switch_swig.o: $(SWIGCFILE) Makefile
$(CC)
-w
$(CFLAGS)
-c
$<
-o
$@
$(CC)
-w
$(CFLAGS)
-c
$<
-o
$@
local_install
:
local_install
:
cp
-f
freeswitch.py
$(PREFIX)
/lib/python2.
4
/site-packages/
cp
-f
freeswitch.py
$(PREFIX)
/lib/python2.
5
/site-packages/
src/mod/languages/mod_python/mod_python.c
浏览文件 @
cb09b09f
...
@@ -57,7 +57,7 @@ static void eval_some_python(char *uuid, char *args)
...
@@ -57,7 +57,7 @@ static void eval_some_python(char *uuid, char *args)
char
*
argv
[
128
]
=
{
0
};
char
*
argv
[
128
]
=
{
0
};
int
argc
;
int
argc
;
int
lead
=
0
;
int
lead
=
0
;
char
*
script
=
NULL
;
char
*
script
=
NULL
,
*
script_path
=
NULL
,
*
path
=
NULL
;
if
(
args
)
{
if
(
args
)
{
dupargs
=
strdup
(
args
);
dupargs
=
strdup
(
args
);
...
@@ -80,27 +80,47 @@ static void eval_some_python(char *uuid, char *args)
...
@@ -80,27 +80,47 @@ static void eval_some_python(char *uuid, char *args)
lead
=
1
;
lead
=
1
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"running %s
\n
"
,
script
);
if
(
switch_is_file_path
(
script
))
{
script_path
=
script
;
if
((
script
=
strrchr
(
script_path
,
*
SWITCH_PATH_SEPARATOR
)))
{
script
++
;
}
else
{
script
=
script_path
;
}
}
else
if
((
path
=
switch_mprintf
(
"%s%s%s"
,
SWITCH_GLOBAL_dirs
.
script_dir
,
SWITCH_PATH_SEPARATOR
,
script
)))
{
script_path
=
path
;
}
if
(
script_path
)
{
if
(
!
switch_file_exists
(
script_path
,
NULL
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot Open File: %s
\n
"
,
script_path
);
goto
done
;
}
}
if
((
pythonfile
=
fopen
(
script
,
"r"
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"running %s
\n
"
,
script_path
);
PyEval_AcquireLock
();
if
((
pythonfile
=
fopen
(
script_path
,
"r"
)))
{
tstate
=
Py_NewInterpreter
();
tstate
=
Py_NewInterpreter
();
PyEval_ReleaseLock
();
if
(
!
tstate
)
{
if
(
!
tstate
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"error acquiring tstate
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"error acquiring tstate
\n
"
);
goto
done
;
goto
done
;
}
}
PyThreadState_Clear
(
tstate
);
init_freeswitch
();
init_freeswitch
();
PyRun_SimpleString
(
"from freeswitch import *"
);
PySys_SetArgv
(
argc
-
lead
,
&
argv
[
lead
]);
PySys_SetArgv
(
argc
-
lead
,
&
argv
[
lead
]);
PyRun_SimpleFile
(
pythonfile
,
""
);
PyRun_SimpleFile
(
pythonfile
,
script
);
Py_EndInterpreter
(
tstate
);
Py_EndInterpreter
(
tstate
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"error running %s
\n
"
,
script
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"error running %s
\n
"
,
script
_path
);
}
}
...
@@ -111,6 +131,7 @@ static void eval_some_python(char *uuid, char *args)
...
@@ -111,6 +131,7 @@ static void eval_some_python(char *uuid, char *args)
}
}
switch_safe_free
(
dupargs
);
switch_safe_free
(
dupargs
);
switch_safe_free
(
path
);
}
}
static
void
python_function
(
switch_core_session_t
*
session
,
char
*
data
)
static
void
python_function
(
switch_core_session_t
*
session
,
char
*
data
)
...
@@ -214,6 +235,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
...
@@ -214,6 +235,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
PyEval_ReleaseLock
();
PyEval_ReleaseLock
();
eval_some_python
(
NULL
,
"init_python.py"
);
PyThreadState_Swap
(
NULL
);
/* indicate that the module should continue to be loaded */
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
src/mod/languages/mod_spidermonkey/mod_spidermonkey.h
浏览文件 @
cb09b09f
...
@@ -85,7 +85,7 @@ int eval_some_js(char *code, JSContext * cx, JSObject * obj, jsval * rval)
...
@@ -85,7 +85,7 @@ int eval_some_js(char *code, JSContext * cx, JSObject * obj, jsval * rval)
cptr
=
code
+
1
;
cptr
=
code
+
1
;
script
=
JS_CompileScript
(
cx
,
obj
,
cptr
,
strlen
(
cptr
),
"inline"
,
1
);
script
=
JS_CompileScript
(
cx
,
obj
,
cptr
,
strlen
(
cptr
),
"inline"
,
1
);
}
else
{
}
else
{
if
(
*
code
==
'/'
)
{
if
(
switch_is_file_path
(
code
)
)
{
script_name
=
code
;
script_name
=
code
;
}
else
if
((
path
=
switch_mprintf
(
"%s%s%s"
,
SWITCH_GLOBAL_dirs
.
script_dir
,
SWITCH_PATH_SEPARATOR
,
code
)))
{
}
else
if
((
path
=
switch_mprintf
(
"%s%s%s"
,
SWITCH_GLOBAL_dirs
.
script_dir
,
SWITCH_PATH_SEPARATOR
,
code
)))
{
script_name
=
path
;
script_name
=
path
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论