Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ad5297ca
提交
ad5297ca
authored
7月 27, 2012
作者:
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adding codec nogotiation code
上级
04d787ce
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
75 行增加
和
15 行删除
+75
-15
media_gateway_cmd_handler.c
...d/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
+21
-7
media_gateway_stack.h
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
+2
-2
media_gateway_utils.c
src/mod/endpoints/mod_media_gateway/media_gateway_utils.c
+52
-6
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
浏览文件 @
ad5297ca
...
...
@@ -198,7 +198,7 @@ switch_status_t mg_is_ito_pkg_req(megaco_profile_t* mg_profile, MgMgcoCommand *c
*
*
*/
switch_status_t
mg_prc_descriptors
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
cmd
,
mg_termination_t
*
term
)
switch_status_t
mg_prc_descriptors
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
cmd
,
mg_termination_t
*
term
,
CmMemListCp
*
memCp
)
{
CmSdpMedProtoFmts
*
format
;
TknU8
*
fmt
;
...
...
@@ -301,7 +301,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
}
}
mgco_handle_
sdp
(
&
local
->
sdp
,
term
,
MG_SDP_LOCAL
);
mgco_handle_
incoming_sdp
(
&
local
->
sdp
,
term
,
MG_SDP_LOCAL
,
mg_profile
,
memCp
);
break
;
}
...
...
@@ -313,7 +313,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
remote
=
&
mediaPar
->
u
.
remote
;
sdp
=
remote
->
sdp
.
info
[
0
];
/* for Matt - same like local descriptor */
mgco_handle_
sdp
(
&
remote
->
sdp
,
term
,
MG_SDP_REMOTE
);
mgco_handle_
incoming_sdp
(
&
remote
->
sdp
,
term
,
MG_SDP_REMOTE
,
mg_profile
,
memCp
);
break
;
}
...
...
@@ -406,12 +406,12 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
if
(
mgStream
->
sl
.
remote
.
pres
.
pres
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Got remote stream media description:
\n
"
);
mgco_handle_
sdp
(
&
mgStream
->
sl
.
remote
.
sdp
,
term
,
MG_SDP_LOCAL
);
mgco_handle_
incoming_sdp
(
&
mgStream
->
sl
.
remote
.
sdp
,
term
,
MG_SDP_LOCAL
,
mg_profile
,
memCp
);
}
if
(
mgStream
->
sl
.
local
.
pres
.
pres
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Got local stream media description:
\n
"
);
mgco_handle_
sdp
(
&
mgStream
->
sl
.
local
.
sdp
,
term
,
MG_SDP_REMOTE
);
mgco_handle_
incoming_sdp
(
&
mgStream
->
sl
.
local
.
sdp
,
term
,
MG_SDP_REMOTE
,
mg_profile
,
memCp
);
}
break
;
...
...
@@ -610,7 +610,14 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/********************************************************************/
ret
=
mg_prc_descriptors
(
mg_profile
,
inc_cmd
,
term
);
ret
=
mg_prc_descriptors
(
mg_profile
,
inc_cmd
,
term
,
&
inc_cmd
->
u
.
mgCmdInd
[
0
]
->
memCp
);
/* IF there is any error , return */
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
goto
error
;
}
/* TODO - locally assigned SDP must be the part of termination...which we can use to fill responses*/
...
...
@@ -1067,7 +1074,14 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
/********************************************************************/
ret
=
mg_prc_descriptors
(
mg_profile
,
inc_cmd
,
term
);
ret
=
mg_prc_descriptors
(
mg_profile
,
inc_cmd
,
term
,
&
inc_cmd
->
u
.
mgCmdInd
[
0
]
->
memCp
);
/* IF there is any error , return */
if
(
term
->
mg_error_code
&&
(
*
term
->
mg_error_code
==
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
)){
mg_util_set_err_string
(
&
errTxt
,
" Unsupported Codec "
);
err_code
=
MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT
;
goto
error
;
}
/* SDP updated to termination */
megaco_activate_termination
(
term
);
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
浏览文件 @
ad5297ca
...
...
@@ -141,7 +141,7 @@ typedef enum {
(_reqId)->id.val = 0xFFFFFFFF;
switch_status_t
mg_prc_descriptors
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
inc_cmd
,
mg_termination_t
*
term
);
switch_status_t
mg_prc_descriptors
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
inc_cmd
,
mg_termination_t
*
term
,
CmMemListCp
*
memCp
);
void
handle_sng_log
(
uint8_t
level
,
char
*
fmt
,
...);
void
handle_mgco_sta_ind
(
Pst
*
pst
,
SuId
suId
,
MgMgtSta
*
msg
);
void
handle_mgco_txn_sta_ind
(
Pst
*
pst
,
SuId
suId
,
MgMgcoInd
*
msg
);
...
...
@@ -166,7 +166,7 @@ int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, megaco_profile_t* mg_cfg, m
switch_status_t
mg_is_ito_pkg_req
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
cmd
);
switch_status_t
mg_send_end_of_axn
(
SuId
suId
,
MgMgcoTransId
*
transId
,
MgMgcoContextId
*
ctxtId
,
TknU32
*
peerId
);
void
mgco_handle_
sdp
(
CmSdpInfoSet
*
sdp
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
);
void
mgco_handle_
incoming_sdp
(
CmSdpInfoSet
*
sdp
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
,
megaco_profile_t
*
mg_profile
,
CmMemListCp
*
memCp
);
void
mg_util_set_ctxt_string
(
MgStr
*
errTxt
,
MgMgcoContextId
*
ctxtId
);
switch_status_t
handle_mg_add_cmd
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
inc_cmd
,
MgMgcoContextId
*
new_ctxtId
);
switch_status_t
handle_mg_subtract_cmd
(
megaco_profile_t
*
mg_profile
,
MgMgcoCommand
*
inc_cmd
);
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_utils.c
浏览文件 @
ad5297ca
...
...
@@ -421,7 +421,7 @@ void mg_util_set_cmd_name_string (MgStr *errTxt, MgMgcoCommand *cmd)
}
/*****************************************************************************************************************************/
void
mgco_
print_sdp_attr_set
(
CmSdpAttrSet
*
s
)
void
mgco_
handle_sdp_attr_set
(
CmSdpAttrSet
*
s
,
mg_termination_t
*
term
)
{
int
i
=
0x00
;
if
(
s
->
numComp
.
pres
)
{
...
...
@@ -461,6 +461,9 @@ void mgco_print_sdp_attr_set(CmSdpAttrSet *s)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\t
PTIME = %ld
\n
"
,
(
NOTPRSNT
!=
a
->
u
.
ptime
.
pres
)
?
a
->
u
.
ptime
.
val
:-
1
);
#endif
if
(
MG_TERM_RTP
==
term
->
type
){
term
->
u
.
rtp
.
ptime
=
a
->
u
.
ptime
.
val
;
}
break
;
}
case
CM_SDP_ATTR_RECVONLY
:
...
...
@@ -786,7 +789,30 @@ void mgco_print_CmSdpU8OrNil(CmSdpU8OrNil* p)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"CmSdpU8OrNil: Value = %d
\n
"
,
(
NOTPRSNT
!=
p
->
val
.
pres
)
?
p
->
val
.
val
:-
1
);
}
void
mgco_print_sdp_media_param
(
CmSdpMedPar
*
s
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
)
const
char
*
mg_get_codec_name
(
megaco_profile_t
*
mg_profile
,
int
iana_code
)
{
int
i
=
0x00
;
const
switch_codec_implementation_t
*
codecs
[
16
];
char
*
codec_prefs
[
16
]
=
{
0
};
char
*
szcodec_prefs
;
int
codec_count
;
szcodec_prefs
=
strdup
(
mg_profile
->
codec_prefs
);
codec_count
=
switch_split
(
szcodec_prefs
,
','
,
codec_prefs
);
/* Get the list of codecs, by preference */
switch_loadable_module_get_codecs_sorted
(
codecs
,
switch_arraylen
(
codecs
),
codec_prefs
,
switch_arraylen
(
codec_prefs
));
/* see if received codec is present in our codec supported list */
for
(
i
=
0
;
codecs
[
i
]
&&
i
<
codec_count
;
i
++
)
{
if
(
iana_code
==
codecs
[
i
]
->
ianacode
){
return
codecs
[
i
]
->
iananame
;
}
}
return
NULL
;
}
void
mgco_handle_sdp_media_param
(
CmSdpMedPar
*
s
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
,
megaco_profile_t
*
mg_profile
,
CmSdpAttrSet
*
attrSet
,
CmMemListCp
*
memCp
)
{
int
i
=
0x00
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"***** Media Parameter ***********
\n
"
);
...
...
@@ -837,6 +863,26 @@ void mgco_print_sdp_media_param(CmSdpMedPar *s, mg_termination_t* term, mgco_sdp
}
}
}
/* Ideally remote descriptor should have supported codec..but just in case calling remove un-supported codecs api */
mg_rem_unsupported_codecs
(
mg_profile
,
term
,
r
,
attrSet
,
memCp
);
/* now whatever we have , that will be suported one */
if
((
NOTPRSNT
!=
r
->
num
.
pres
)
&&
(
0
!=
r
->
num
.
val
)
&&
(
NULL
!=
r
->
fmts
[
0
])){
const
char
*
name
=
mg_get_codec_name
(
mg_profile
,
r
->
fmts
[
0
]
->
val
.
val
);
if
(
name
){
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
" Updating codec to[%d], name[%s]
\n
"
,
r
->
fmts
[
0
]
->
val
.
val
,
name
);
if
(
MG_TERM_RTP
==
term
->
type
){
term
->
u
.
rtp
.
codec
=
name
;
}
}
else
{
/* ERROR */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
" NO Codec Name found against iana[%d]
\n
"
,
r
->
fmts
[
0
]
->
val
.
val
);
}
}
break
;
}
...
...
@@ -854,7 +900,7 @@ void mgco_print_sdp_media_param(CmSdpMedPar *s, mg_termination_t* term, mgco_sdp
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"****************
\n
"
);
}
void
mgco_handle_
sdp
(
CmSdpInfoSet
*
sdp
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
)
void
mgco_handle_
incoming_sdp
(
CmSdpInfoSet
*
sdp
,
mg_termination_t
*
term
,
mgco_sdp_types_e
sdp_type
,
megaco_profile_t
*
mg_profile
,
CmMemListCp
*
memCp
)
{
int
i
;
...
...
@@ -1021,7 +1067,7 @@ void mgco_handle_sdp(CmSdpInfoSet *sdp, mg_termination_t* term, mgco_sdp_types_e
/************************************************************************************************************************/
/* Attribute Set */
mgco_
print_sdp_attr_set
(
&
s
->
attrSet
);
mgco_
handle_sdp_attr_set
(
&
s
->
attrSet
,
term
);
/************************************************************************************************************************/
/* Media Descriptor Set */
...
...
@@ -1077,7 +1123,7 @@ void mgco_handle_sdp(CmSdpInfoSet *sdp, mg_termination_t* term, mgco_sdp_types_e
break
;
}
}
mgco_
print_sdp_media_param
(
&
f
->
par
,
term
,
sdp_type
);
mgco_
handle_sdp_media_param
(
&
f
->
par
,
term
,
sdp_type
,
mg_profile
,
&
desc
->
attrSet
,
memCp
);
}
/*info */
...
...
@@ -1097,7 +1143,7 @@ void mgco_handle_sdp(CmSdpInfoSet *sdp, mg_termination_t* term, mgco_sdp_types_e
}
/* attribute set */
mgco_
print_sdp_attr_set
(
&
desc
->
attrSet
);
mgco_
handle_sdp_attr_set
(
&
desc
->
attrSet
,
term
);
if
(
desc
->
field
.
mediaType
.
val
==
CM_SDP_MEDIA_AUDIO
&&
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论