Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5f02dd8b
提交
5f02dd8b
authored
8月 29, 2012
作者:
Kapil Gupta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding mg term license validation code
上级
d5ea03d6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
30 行增加
和
7 行删除
+30
-7
media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
+2
-1
media_gateway_xml.c
src/mod/endpoints/mod_media_gateway/media_gateway_xml.c
+26
-6
mod_media_gateway.h
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
+2
-0
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway.c
浏览文件 @
5f02dd8b
...
...
@@ -575,7 +575,7 @@ mg_context_t *megaco_choose_context(megaco_profile_t *profile)
}
switch_thread_rwlock_unlock
(
profile
->
contexts_rwlock
);
return
ctx
;
}
...
...
@@ -647,6 +647,7 @@ switch_status_t megaco_profile_start(const char *profilename)
profile
->
name
=
switch_core_strdup
(
pool
,
profilename
);
profile
->
next_context_id
++
;
profile
->
inact_tmr
=
0x00
;
profile
->
total_cfg_term
=
0x00
;
profile
->
peer_active
=
0x00
;
profile
->
mg_stats
=
switch_core_alloc
(
pool
,
sizeof
(
mg_stats_t
));
profile
->
inact_tmr_task_id
=
0x00
;
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_xml.c
浏览文件 @
5f02dd8b
...
...
@@ -25,10 +25,14 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
switch_xml_config_item_t
*
instructions
=
(
profile
?
get_instructions
(
profile
)
:
NULL
);
int
count
;
int
idx
;
int
ret
=
0
;
char
*
var
,
*
val
;
mg_peer_profile_t
*
peer_profile
=
NULL
;
switch_xml_config_item_t
*
instructions1
=
NULL
;
switch_memory_pool_t
*
pool
;
char
lic_sig_file
[
4096
];
memset
(
&
lic_sig_file
[
0
],
0
,
sizeof
(
lic_sig_file
));
if
(
!
(
xml
=
switch_xml_open_cfg
(
file
,
&
cfg
,
NULL
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Could not open %s
\n
"
,
file
);
...
...
@@ -64,10 +68,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
goto
done
;
}
profile
->
idx
=
++
mg_sap_id
;
if
((
mg_phys_terms
=
switch_xml_child
(
mg_interface
,
"physical_terminations"
)))
{
for
(
mg_term
=
switch_xml_child
(
mg_phys_terms
,
"map"
);
mg_term
;
mg_term
=
mg_term
->
next
)
{
// <map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map"1-15,17-31"/>
...
...
@@ -148,11 +150,28 @@ else
if
(
!
mg_interface
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error profile %s not found
\n
"
,
profile
->
name
);
return
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
}
if
((
profile
->
license
)
&&
(
'\0'
!=
profile
->
license
[
0
])){
sprintf
(
lic_sig_file
,
"%s.sig"
,
profile
->
license
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to get License file
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
MG_CHECK_LICENSE
(
profile
->
total_cfg_term
,
profile
->
license
,
&
lic_sig_file
[
0
],
ret
);
if
(
ret
){
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"License validation failed
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
/* go through the peer configuration and get the mg profile associated peers only */
if
(
!
(
mg_peers
=
switch_xml_child
(
cfg
,
"mg_peers"
)))
{
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
}
...
...
@@ -232,6 +251,8 @@ void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char
"Mapped termination [%s] to freetdm span: %s chan: %d
\n
"
,
term
->
name
,
term
->
u
.
tdm
.
span_name
,
term
->
u
.
tdm
.
channel
);
megaco_prepare_tdm_termination
(
term
);
profile
->
total_cfg_term
++
;
}
/****************************************************************************************************************************/
switch_status_t
mg_config_cleanup
(
megaco_profile_t
*
profile
)
...
...
@@ -291,7 +312,6 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
SWITCH_TRUE, /* enforce Max */
9
};
#endif
static switch_xml_config_int_options_t pre_buffer_len = {
SWITCH_TRUE, /* enforce min */
...
...
@@ -300,7 +320,6 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
10000
};
#if 0
static switch_xml_config_enum_item_t opt_default_codec_enum[] = {
{ "PCMA", MEGACO_CODEC_PCMA},
{ "PCMU", MEGACO_CODEC_PCMU},
...
...
@@ -323,8 +342,9 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
//SWITCH_CONFIG_ITEM("rtp-port-range", SWITCH_CONFIG_STRING, CONFIG_REQUIRED, &profile->rtp_port_range, "1-65535", &switch_config_string_strdup, "", "rtp port range"),
SWITCH_CONFIG_ITEM
(
"rtp-termination-id-prefix"
,
SWITCH_CONFIG_STRING
,
CONFIG_RELOADABLE
,
&
profile
->
rtp_termination_id_prefix
,
""
,
&
switch_config_string_strdup
,
""
,
"rtp termination prefix"
),
//SWITCH_CONFIG_ITEM("rtp-termination-id-length", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->rtp_termination_id_len, "", &opt_termination_id_len, "", "rtp termination id"),
SWITCH_CONFIG_ITEM
(
"tdm-pre-buffer-size"
,
SWITCH_CONFIG_INT
,
CONFIG_RELOADABLE
,
&
profile
->
tdm_pre_buffer_size
,
0
,
&
pre_buffer_len
,
""
,
"freetdm pre buffer size"
),
//
SWITCH_CONFIG_ITEM("tdm-pre-buffer-size", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->tdm_pre_buffer_size, 0, &pre_buffer_len, "", "freetdm pre buffer size"),
SWITCH_CONFIG_ITEM
(
"codec-prefs"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
codec_prefs
,
""
,
&
switch_config_string_strdup
,
""
,
"codec preferences, coma-separated"
),
SWITCH_CONFIG_ITEM
(
"license"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
license
,
"/usr/local/nsg/conf/license.txt"
,
&
switch_config_string_strdup
,
""
,
"License file"
),
SWITCH_CONFIG_ITEM_END
()
};
...
...
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h
浏览文件 @
5f02dd8b
...
...
@@ -217,8 +217,10 @@ struct megaco_profile_s {
char
*
my_ipaddr
;
/* local domain name */
char
*
port
;
/* port */
char
*
protocol_type
;
/* MEGACO/MGCP */
char
*
license
;
/* License file location/name */
int
protocol_version
;
/* Protocol supported version */
int
total_peers
;
int
total_cfg_term
;
megaco_codec_t
default_codec
;
char
*
rtp_port_range
;
char
*
rtp_termination_id_prefix
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论