Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
cc45f89d
提交
cc45f89d
authored
8月 13, 2012
作者:
Kapil Gupta
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mid code changes as per modified xml
上级
35126a35
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
50 行增加
和
11 行删除
+50
-11
media_gateway_xml.c
src/mod/endpoints/mod_media_gateway/media_gateway_xml.c
+50
-11
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway_xml.c
浏览文件 @
cc45f89d
...
...
@@ -12,7 +12,8 @@
static
switch_xml_config_item_t
*
get_instructions
(
megaco_profile_t
*
profile
)
;
static
switch_xml_config_item_t
*
get_peer_instructions
(
mg_peer_profile_t
*
profile
)
;
static
int
mg_sap_id
;
static
switch_status_t
modify_mid
(
char
**
pmid
);
static
switch_status_t
modify_mg_profile_mid
(
megaco_profile_t
*
profile
,
char
**
pmid
)
;
static
switch_status_t
modify_mg_peer_mid
(
mg_peer_profile_t
*
peer_profile
,
char
**
pmid
)
;
/****************************************************************************************************************************/
switch_status_t
config_profile
(
megaco_profile_t
*
profile
,
switch_bool_t
reload
)
...
...
@@ -59,7 +60,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
profile
->
total_peers
++
;
}
if
(
SWITCH_STATUS_FALSE
==
(
status
=
modify_m
id
(
&
profile
->
mid
))){
if
(
SWITCH_STATUS_FALSE
==
(
status
=
modify_m
g_profile_mid
(
profile
,
&
profile
->
mid
))){
goto
done
;
}
...
...
@@ -176,7 +177,7 @@ else
goto
done
;
}
if
(
SWITCH_STATUS_FALSE
==
(
status
=
modify_m
id
(
&
peer_profile
->
mid
)))
{
if
(
SWITCH_STATUS_FALSE
==
(
status
=
modify_m
g_peer_mid
(
peer_profile
,
&
peer_profile
->
mid
)))
{
goto
done
;
}
...
...
@@ -287,6 +288,7 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
9
};
#if 0
static switch_xml_config_enum_item_t opt_default_codec_enum[] = {
{ "PCMA", MEGACO_CODEC_PCMA},
{ "PCMU", MEGACO_CODEC_PCMU},
...
...
@@ -294,6 +296,7 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
{ "G.723.1", MEGACO_CODEC_G723_1},
{ "ILBC", MEGACO_CODEC_ILBC },
};
#endif
switch_xml_config_item_t
instructions
[]
=
{
/* parameter name type reloadable pointer default value options structure */
...
...
@@ -304,10 +307,10 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
SWITCH_CONFIG_ITEM
(
"domain-name"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
my_domain
,
""
,
&
switch_config_string_strdup
,
""
,
"domain name"
),
SWITCH_CONFIG_ITEM
(
"message-identifier"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
mid
,
""
,
&
switch_config_string_strdup
,
""
,
"message identifier "
),
SWITCH_CONFIG_ITEM
(
"default-codec"
,
SWITCH_CONFIG_ENUM
,
CONFIG_RELOADABLE
,
&
profile
->
default_codec
,
"PCMU"
,
&
opt_default_codec_enum
,
""
,
"default codec"
),
//
SWITCH_CONFIG_ITEM("default-codec", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &profile->default_codec, "PCMU", &opt_default_codec_enum, "", "default codec"),
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-len"
,
SWITCH_CONFIG_INT
,
CONFIG_RELOADABLE
,
&
profile
->
rtp_termination_id_len
,
""
,
&
opt_termination_id_len
,
""
,
"rtp termination id"
),
SWITCH_CONFIG_ITEM
(
"rtp-termination-id-len
gth
"
,
SWITCH_CONFIG_INT
,
CONFIG_RELOADABLE
,
&
profile
->
rtp_termination_id_len
,
""
,
&
opt_termination_id_len
,
""
,
"rtp termination id"
),
SWITCH_CONFIG_ITEM
(
"codec-prefs"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
codec_prefs
,
""
,
&
switch_config_string_strdup
,
""
,
"codec preferences, coma-separated"
),
SWITCH_CONFIG_ITEM_END
()
};
...
...
@@ -318,22 +321,57 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
}
/****************************************************************************************************************************/
static
switch_status_t
modify_mg_peer_mid
(
mg_peer_profile_t
*
peer_profile
,
char
**
pmid
)
{
char
*
mid
=
*
pmid
;
switch_assert
(
mid
);
switch_assert
(
peer_profile
);
if
(
!
strcasecmp
(
mid
,
"IP-PORT"
)){
*
pmid
=
switch_mprintf
(
"[%s]:%s"
,
peer_profile
->
ipaddr
,
peer_profile
->
port
);
}
else
if
(
!
strcasecmp
(
mid
,
"IP"
)){
*
pmid
=
switch_mprintf
(
"[%s]"
,
peer_profile
->
ipaddr
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Invalid mid-type[%s]
\n
"
,
mid
);
return
SWITCH_STATUS_FALSE
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Updated PEER MID [%s]
\n
"
,
*
pmid
);
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
modify_m
id
(
char
**
pmid
)
static
switch_status_t
modify_m
g_profile_mid
(
megaco_profile_t
*
profile
,
char
**
pmid
)
{
char
*
mid
=
*
pmid
;
char
*
dup
;
char
*
val
[
10
];
int
count
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
//
char* dup;
//
char* val[10];
//
int count;
//switch_status_t status = SWITCH_STATUS_SUCCESS
;
switch_assert
(
mid
);
switch_assert
(
profile
);
if
(
!
strcasecmp
(
mid
,
"IP-PORT"
)){
*
pmid
=
switch_mprintf
(
"[%s]:%s"
,
profile
->
my_ipaddr
,
profile
->
port
);
}
else
if
(
!
strcasecmp
(
mid
,
"IP"
)){
*
pmid
=
switch_mprintf
(
"[%s]"
,
profile
->
my_ipaddr
);
}
else
if
(
!
strcasecmp
(
mid
,
"DOMAIN"
)){
*
pmid
=
switch_mprintf
(
"<%s>"
,
profile
->
my_domain
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Invalid mid-type[%s]
\n
"
,
mid
);
return
SWITCH_STATUS_FALSE
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Updated MG MID [%s]
\n
"
,
*
pmid
);
return
SWITCH_STATUS_SUCCESS
;
#if 0
dup = strdup(mid);
/* If MID type is IP then add mid into [] brackets ,
* If MID type is domain then add mid into <> brackets *
*/
count = switch_split(dup, '.', val);
if(!count) {
...
...
@@ -367,9 +405,10 @@ static switch_status_t modify_mid(char** pmid)
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added proper brackets to MID = %s \n",mid);
status = SWITCH_STATUS_SUCCESS;
done:
return status;
#endif
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论