Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8a292bf0
提交
8a292bf0
authored
1月 04, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stupid crap
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@279
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
c81645c5
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
96 行增加
和
95 行删除
+96
-95
switch_core.h
src/include/switch_core.h
+1
-1
mod_exosip.c
src/mod/endpoints/mod_exosip/mod_exosip.c
+80
-84
switch_core.c
src/switch_core.c
+12
-8
switch_loadable_module.c
src/switch_loadable_module.c
+3
-2
没有找到文件。
src/include/switch_core.h
浏览文件 @
8a292bf0
...
...
@@ -78,7 +78,7 @@ SWITCH_DECLARE(switch_status) switch_core_hash_insert(switch_hash *hash, char *k
SWITCH_DECLARE
(
switch_status
)
switch_core_hash_insert_dup
(
switch_hash
*
hash
,
char
*
key
,
void
*
data
);
SWITCH_DECLARE
(
switch_status
)
switch_core_hash_delete
(
switch_hash
*
hash
,
char
*
key
);
SWITCH_DECLARE
(
void
*
)
switch_core_hash_find
(
switch_hash
*
hash
,
char
*
key
);
SWITCH_DECLARE
(
void
)
switch_core_launch_thread
(
void
*
(
*
func
)(
switch_thread
*
,
void
*
),
void
*
obj
);
SWITCH_DECLARE
(
void
)
switch_core_launch_thread
(
void
*
(
*
func
)(
switch_thread
*
,
void
*
),
void
*
obj
,
switch_memory_pool
*
pool
);
SWITCH_DECLARE
(
FILE
*
)
switch_core_data_channel
(
switch_text_channel
channel
);
SWITCH_DECLARE
(
void
)
switch_core_session_launch_thread
(
switch_core_session
*
session
,
void
*
(
*
func
)(
switch_thread
*
,
void
*
),
void
*
obj
);
SWITCH_DECLARE
(
switch_status
)
switch_core_timer_init
(
switch_timer
*
timer
,
char
*
timer_name
,
int
interval
,
int
samples
,
switch_memory_pool
*
pool
);
...
...
src/mod/endpoints/mod_exosip/mod_exosip.c
浏览文件 @
8a292bf0
...
...
@@ -734,18 +734,18 @@ static const switch_loadable_module_interface exosip_module_interface = {
/*.application_interface*/
NULL
};
#if 1
SWITCH_MOD_DECLARE
(
switch_status
)
switch_module_shutdown
(
void
)
{
if
(
globals
.
running
)
{
globals
.
running
=
-
1
;
while
(
globals
.
running
)
{
switch_yield
(
1000
);
switch_yield
(
1000
00
);
}
}
return
SWITCH_STATUS_SUCCESS
;
}
#endif
SWITCH_MOD_DECLARE
(
switch_status
)
switch_module_load
(
const
switch_loadable_module_interface
**
interface
,
char
*
filename
)
{
/* NOTE: **interface is **_interface because the common lib redefines interface to struct in some situations */
...
...
@@ -1240,10 +1240,82 @@ static void log_event(eXosip_event_t *je)
static
void
*
monitor_thread_run
(
void
)
static
int
config_exosip
(
int
reload
)
{
switch_config
cfg
;
char
*
var
,
*
val
;
char
*
cf
=
"exosip.conf"
;
globals
.
bytes_per_frame
=
DEFAULT_BYTES_PER_FRAME
;
switch_core_hash_init
(
&
globals
.
call_hash
,
module_pool
);
if
(
!
switch_config_open_file
(
&
cfg
,
cf
))
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"open of %s failed
\n
"
,
cf
);
return
SWITCH_STATUS_TERM
;
}
globals
.
rtp_start
=
16384
;
globals
.
rtp_end
=
32768
;
while
(
switch_config_next_pair
(
&
cfg
,
&
var
,
&
val
))
{
if
(
!
strcasecmp
(
cfg
.
category
,
"settings"
))
{
if
(
!
strcmp
(
var
,
"debug"
))
{
globals
.
debug
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"port"
))
{
globals
.
port
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"dialplan"
))
{
set_global_dialplan
(
val
);
}
else
if
(
!
strcmp
(
var
,
"rtp_min_port"
))
{
globals
.
rtp_start
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"rtp_max_port"
))
{
globals
.
rtp_end
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"codec_ms"
))
{
globals
.
codec_ms
=
atoi
(
val
);
}
}
}
if
(
!
globals
.
codec_ms
)
{
globals
.
codec_ms
=
20
;
}
if
(
!
globals
.
port
)
{
globals
.
port
=
5060
;
}
switch_config_close_file
(
&
cfg
);
if
(
!
globals
.
dialplan
)
{
set_global_dialplan
(
"default"
);
}
switch_mutex_init
(
&
globals
.
port_lock
,
SWITCH_MUTEX_NESTED
,
module_pool
);
/* Setup the user agent */
eXosip_set_user_agent
(
"FreeSWITCH"
);
return
0
;
}
SWITCH_MOD_DECLARE
(
switch_status
)
switch_module_runtime
(
void
)
{
eXosip_event_t
*
event
=
NULL
;
config_exosip
(
0
);
if
(
eXosip_init
())
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"eXosip_init initialization failed!
\n
"
);
return
SWITCH_STATUS_TERM
;
}
if
(
eXosip_listen_addr
(
IPPROTO_UDP
,
NULL
,
globals
.
port
,
AF_INET
,
0
))
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"eXosip_listen_addr failed!
\n
"
);
return
SWITCH_STATUS_TERM
;
}
globals
.
running
=
1
;
while
(
globals
.
running
>
0
)
{
if
(
!
(
event
=
eXosip_event_wait
(
0
,
100
)))
{
...
...
@@ -1323,87 +1395,11 @@ static void *monitor_thread_run(void)
eXosip_event_free
(
event
);
}
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Monitor Thread Exiting
\n
"
);
globals
.
running
=
0
;
return
NULL
;
}
static
int
config_exosip
(
int
reload
)
{
switch_config
cfg
;
char
*
var
,
*
val
;
char
*
cf
=
"exosip.conf"
;
globals
.
bytes_per_frame
=
DEFAULT_BYTES_PER_FRAME
;
switch_core_hash_init
(
&
globals
.
call_hash
,
module_pool
);
if
(
!
switch_config_open_file
(
&
cfg
,
cf
))
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"open of %s failed
\n
"
,
cf
);
return
SWITCH_STATUS_TERM
;
}
globals
.
rtp_start
=
16384
;
globals
.
rtp_end
=
32768
;
while
(
switch_config_next_pair
(
&
cfg
,
&
var
,
&
val
))
{
if
(
!
strcasecmp
(
cfg
.
category
,
"settings"
))
{
if
(
!
strcmp
(
var
,
"debug"
))
{
globals
.
debug
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"port"
))
{
globals
.
port
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"dialplan"
))
{
set_global_dialplan
(
val
);
}
else
if
(
!
strcmp
(
var
,
"rtp_min_port"
))
{
globals
.
rtp_start
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"rtp_max_port"
))
{
globals
.
rtp_end
=
atoi
(
val
);
}
else
if
(
!
strcmp
(
var
,
"codec_ms"
))
{
globals
.
codec_ms
=
atoi
(
val
);
}
}
}
if
(
!
globals
.
codec_ms
)
{
globals
.
codec_ms
=
20
;
}
if
(
!
globals
.
port
)
{
globals
.
port
=
5060
;
}
switch_config_close_file
(
&
cfg
);
if
(
!
globals
.
dialplan
)
{
set_global_dialplan
(
"default"
);
}
if
(
eXosip_init
())
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"eXosip_init initialization failed!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
eXosip_listen_addr
(
IPPROTO_UDP
,
NULL
,
globals
.
port
,
AF_INET
,
0
))
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"eXosip_listen_addr failed!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
switch_mutex_init
(
&
globals
.
port_lock
,
SWITCH_MUTEX_NESTED
,
module_pool
);
/* Setup the user agent */
eXosip_set_user_agent
(
"FreeSWITCH"
);
monitor_thread_run
();
eXosip_quit
();
return
0
;
}
SWITCH_MOD_DECLARE
(
switch_status
)
switch_module_runtime
(
void
)
{
config_exosip
(
0
);
globals
.
running
=
0
;
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Monitor Thread Exiting
\n
"
);
//switch_sleep(2000000);
return
SWITCH_STATUS_TERM
;
}
src/switch_core.c
浏览文件 @
8a292bf0
...
...
@@ -1594,32 +1594,36 @@ the core to have any clue and keeping switch_loadable_module.c from needing any
*/
SWITCH_DECLARE
(
void
)
switch_core_launch_thread
(
switch_thread_start_t
func
,
void
*
obj
)
SWITCH_DECLARE
(
void
)
switch_core_launch_thread
(
switch_thread_start_t
func
,
void
*
obj
,
switch_memory_pool
*
pool
)
{
switch_thread
*
thread
;
switch_threadattr_t
*
thd_attr
;
switch_threadattr_t
*
thd_attr
=
NULL
;
switch_core_thread_session
*
ts
;
switch_memory_pool
*
pool
=
NULL
;
int
mypool
;
switch_threadattr_create
(
&
thd_attr
,
runtime
.
memory_pool
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
mypool
=
pool
?
0
:
1
;
if
(
switch_core_new_memory_pool
(
&
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
!
pool
&&
switch_core_new_memory_pool
(
&
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Could not allocate memory pool
\n
"
);
return
;
}
switch_threadattr_create
(
&
thd_attr
,
pool
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
if
(
!
(
ts
=
switch_core_alloc
(
pool
,
sizeof
(
*
ts
))))
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Could not allocate memory
\n
"
);
}
else
{
ts
->
pool
=
pool
;
if
(
mypool
)
{
ts
->
pool
=
pool
;
}
ts
->
objs
[
0
]
=
obj
;
switch_thread_create
(
&
thread
,
thd_attr
,
func
,
ts
,
ts
->
pool
pool
);
}
...
...
src/switch_loadable_module.c
浏览文件 @
8a292bf0
...
...
@@ -84,9 +84,10 @@ static void *switch_loadable_module_exec(switch_thread *thread, void *obj)
if
(
ts
->
pool
)
{
switch_memory_pool
*
pool
=
ts
->
pool
;
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Destroying Pool for %s
\n
"
,
module
->
interface
->
module_name
);
switch_core_destroy_memory_pool
(
&
pool
);
}
switch_yield
(
1000000
);
return
NULL
;
}
...
...
@@ -173,7 +174,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem
module
->
lib
=
dso
;
if
(
module
->
switch_module_runtime
)
{
switch_core_launch_thread
(
switch_loadable_module_exec
,
module
);
switch_core_launch_thread
(
switch_loadable_module_exec
,
module
,
loadable_modules
.
pool
);
}
*
new_module
=
module
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论