Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
84d56ee5
提交
84d56ee5
authored
7月 17, 2012
作者:
Mathieu Rene
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'nsg-4.3' of git.sangoma.com:smg_freeswitch into nsg-4.3
上级
36719e30
9a817c7a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
39 行增加
和
533 行删除
+39
-533
media_gateway.c
src/mod/endpoints/mod_media_gateway/media_gateway.c
+2
-1
media_gateway_cli.c
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
+6
-1
media_gateway_cmd_handler.c
...d/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
+22
-5
media_gateway_stack.h
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
+1
-1
mod_media_gateway.c
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c
+8
-525
没有找到文件。
src/mod/endpoints/mod_media_gateway/media_gateway.c
浏览文件 @
84d56ee5
...
@@ -74,6 +74,7 @@ mg_context_t *megaco_get_context(megaco_profile_t *profile, uint32_t context_id)
...
@@ -74,6 +74,7 @@ mg_context_t *megaco_get_context(megaco_profile_t *profile, uint32_t context_id)
mg_context_t
*
megaco_choose_context
(
megaco_profile_t
*
profile
)
mg_context_t
*
megaco_choose_context
(
megaco_profile_t
*
profile
)
{
{
mg_context_t
*
ctx
;
mg_context_t
*
ctx
;
int
i
=
0x0
;;
switch_thread_rwlock_wrlock
(
profile
->
contexts_rwlock
);
switch_thread_rwlock_wrlock
(
profile
->
contexts_rwlock
);
/* Try the next one */
/* Try the next one */
...
@@ -86,7 +87,7 @@ mg_context_t *megaco_choose_context(megaco_profile_t *profile)
...
@@ -86,7 +87,7 @@ mg_context_t *megaco_choose_context(megaco_profile_t *profile)
if
((
profile
->
contexts_bitmap
[
profile
->
next_context_id
%
8
]
&
(
1
<<
(
profile
->
next_context_id
/
8
)))
==
0
)
{
if
((
profile
->
contexts_bitmap
[
profile
->
next_context_id
%
8
]
&
(
1
<<
(
profile
->
next_context_id
/
8
)))
==
0
)
{
/* Found! */
/* Found! */
profile
->
contexts_bitmap
[
profile
->
next_context_id
%
8
]
|=
1
<<
(
profile
->
next_context_id
/
8
);
profile
->
contexts_bitmap
[
profile
->
next_context_id
%
8
]
|=
1
<<
(
profile
->
next_context_id
/
8
);
i
nt
i
=
profile
->
next_context_id
%
MG_CONTEXT_MODULO
;
i
=
profile
->
next_context_id
%
MG_CONTEXT_MODULO
;
ctx
=
malloc
(
sizeof
*
ctx
);
ctx
=
malloc
(
sizeof
*
ctx
);
ctx
->
context_id
=
profile
->
next_context_id
;
ctx
->
context_id
=
profile
->
next_context_id
;
ctx
->
profile
=
profile
;
ctx
->
profile
=
profile
;
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
浏览文件 @
84d56ee5
...
@@ -26,6 +26,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
...
@@ -26,6 +26,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
int
argc
;
int
argc
;
char
*
argv
[
10
];
char
*
argv
[
10
];
char
*
dup
=
NULL
;
char
*
dup
=
NULL
;
int
wild
=
0x00
;
megaco_profile_t
*
profile
=
NULL
;
megaco_profile_t
*
profile
=
NULL
;
if
(
zstr
(
cmd
))
{
if
(
zstr
(
cmd
))
{
...
@@ -107,12 +108,16 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
...
@@ -107,12 +108,16 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
}
}
if
(
profile
)
{
if
(
profile
)
{
if
(
!
zstr
(
argv
[
7
])
&&
!
strcasecmp
(
argv
[
7
],
"wild"
)){
wild
=
0x01
;
}
printf
(
"Input to Send Service Change command : "
printf
(
"Input to Send Service Change command : "
"Profile Name[%s], term-id[%s] method[%s] reason[%s]
\n
"
,
"Profile Name[%s], term-id[%s] method[%s] reason[%s]
\n
"
,
profile
->
name
,
argv
[
4
],
argv
[
5
],
argv
[
6
]);
profile
->
name
,
argv
[
4
],
argv
[
5
],
argv
[
6
]);
megaco_profile_release
(
profile
);
megaco_profile_release
(
profile
);
mg_send_service_change
(
profile
->
idx
,
argv
[
4
],
atoi
(
argv
[
5
]),
atoi
(
argv
[
6
]));
mg_send_service_change
(
profile
->
idx
,
argv
[
4
],
atoi
(
argv
[
5
]),
atoi
(
argv
[
6
])
,
wild
);
}
else
{
}
else
{
stream
->
write_function
(
stream
,
"-ERR No such profile
\n
"
);
stream
->
write_function
(
stream
,
"-ERR No such profile
\n
"
);
}
}
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
浏览文件 @
84d56ee5
...
@@ -273,10 +273,14 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
...
@@ -273,10 +273,14 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
MgMgcoMediaDesc
*
media
;
MgMgcoMediaDesc
*
media
;
MgMgcoCtxt
ctxt
;
MgMgcoCtxt
ctxt
;
switch_status_t
ret
;
switch_status_t
ret
;
uint8_t
wild
=
0x00
;
memset
(
&
reply
,
0
,
sizeof
(
reply
));
memset
(
&
reply
,
0
,
sizeof
(
reply
));
audit
=
&
auditReq
->
u
.
mgCmdReq
[
0
]
->
cmd
.
u
.
aval
;
audit
=
&
auditReq
->
u
.
mgCmdReq
[
0
]
->
cmd
.
u
.
aval
;
wild
=
auditReq
->
u
.
mgCmdReq
[
0
]
->
wild
.
pres
;
switch_log_printf
(
SWITCH_CHANNEL_LOG_CLEAN
,
SWITCH_LOG_INFO
,
"%s :: wild card request = %s
\n
"
,
__FUNCTION__
,(
1
==
wild
)
?
"TRUE"
:
"FALSE"
);
if
(
NOTPRSNT
==
audit
->
pres
.
pres
){
if
(
NOTPRSNT
==
audit
->
pres
.
pres
){
switch_log_printf
(
SWITCH_CHANNEL_LOG_CLEAN
,
SWITCH_LOG_ERROR
,
"Audit structure not present..rejecting
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG_CLEAN
,
SWITCH_LOG_ERROR
,
"Audit structure not present..rejecting
\n
"
);
...
@@ -498,6 +502,11 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
...
@@ -498,6 +502,11 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
reply
.
cmdType
.
pres
=
PRSNT_NODEF
;
reply
.
cmdType
.
pres
=
PRSNT_NODEF
;
reply
.
cmdType
.
val
=
CH_CMD_TYPE_RSP
;
reply
.
cmdType
.
val
=
CH_CMD_TYPE_RSP
;
if
(
wild
){
reply
.
u
.
mgCmdRsp
[
0
]
->
wild
.
pres
=
PRSNT_NODEF
;
}
/* send command reply */
/* send command reply */
sng_mgco_send_cmd
(
suId
,
&
reply
);
sng_mgco_send_cmd
(
suId
,
&
reply
);
...
@@ -942,9 +951,12 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
...
@@ -942,9 +951,12 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
int
ret
=
0x00
;
int
ret
=
0x00
;
MgMgcoTermId
*
termId
;
MgMgcoTermId
*
termId
;
MgMgcoCtxt
ctxt
;
MgMgcoCtxt
ctxt
;
uint8_t
wild
=
0x00
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
wild
=
req
->
u
.
mgCmdReq
[
0
]
->
wild
.
pres
;
/*copy transaction-id*/
/*copy transaction-id*/
memcpy
(
&
cmd
.
transId
,
&
req
->
transId
,
sizeof
(
MgMgcoTransId
));
memcpy
(
&
cmd
.
transId
,
&
req
->
transId
,
sizeof
(
MgMgcoTransId
));
...
@@ -959,6 +971,10 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
...
@@ -959,6 +971,10 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
return
ret
;
return
ret
;
}
}
if
(
wild
){
cmd
.
u
.
mgCmdRsp
[
0
]
->
wild
.
pres
=
PRSNT_NODEF
;
}
cmd
.
u
.
mgCmdRsp
[
0
]
->
pres
.
pres
=
PRSNT_NODEF
;
cmd
.
u
.
mgCmdRsp
[
0
]
->
pres
.
pres
=
PRSNT_NODEF
;
cmd
.
u
.
mgCmdRsp
[
0
]
->
type
.
pres
=
PRSNT_NODEF
;
cmd
.
u
.
mgCmdRsp
[
0
]
->
type
.
pres
=
PRSNT_NODEF
;
cmd
.
u
.
mgCmdRsp
[
0
]
->
type
.
val
=
MGT_SUB
;
cmd
.
u
.
mgCmdRsp
[
0
]
->
type
.
val
=
MGT_SUB
;
...
@@ -1007,7 +1023,7 @@ U32 get_txn_id(){
...
@@ -1007,7 +1023,7 @@ U32 get_txn_id(){
* SuId - Service User ID for MG SAP - it will be same like mg_profile_t->idx (refer to media_gateway_xml.c->mg_sap_id)
* SuId - Service User ID for MG SAP - it will be same like mg_profile_t->idx (refer to media_gateway_xml.c->mg_sap_id)
* term_name - String format defined termination name
* term_name - String format defined termination name
*/
*/
switch_status_t
mg_send_service_change
(
SuId
suId
,
const
char
*
term_name
,
uint8_t
method
,
MgServiceChangeReason_e
reason
)
switch_status_t
mg_send_service_change
(
SuId
suId
,
const
char
*
term_name
,
uint8_t
method
,
MgServiceChangeReason_e
reason
,
uint8_t
wild
)
{
{
MgMgcoSvcChgPar
srvPar
;
MgMgcoSvcChgPar
srvPar
;
MgMgcoTermId
*
termId
;
MgMgcoTermId
*
termId
;
...
@@ -1054,9 +1070,6 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
...
@@ -1054,9 +1070,6 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
/*mgUtlCpyMgMgcoSvcChgPar(&svc->parm, &srvPar, &request.u.mgCmdReq[0]->memCp);*/
/*mgUtlCpyMgMgcoSvcChgPar(&svc->parm, &srvPar, &request.u.mgCmdReq[0]->memCp);*/
printf
(
"reason[%p = %s], len[%d]
\n
"
,
svc
->
parm
.
reason
.
val
,
svc
->
parm
.
reason
.
val
,
svc
->
parm
.
reason
.
len
);
if
(
mgUtlGrowList
((
void
***
)
&
svc
->
termIdLst
.
terms
,
sizeof
(
MgMgcoTermIdLst
),
if
(
mgUtlGrowList
((
void
***
)
&
svc
->
termIdLst
.
terms
,
sizeof
(
MgMgcoTermIdLst
),
&
svc
->
termIdLst
.
num
,
&
request
.
u
.
mgCmdReq
[
0
]
->
memCp
)
!=
ROK
)
&
svc
->
termIdLst
.
num
,
&
request
.
u
.
mgCmdReq
[
0
]
->
memCp
)
!=
ROK
)
{
{
...
@@ -1073,8 +1086,12 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
...
@@ -1073,8 +1086,12 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
mg_fill_mgco_termid
(
termId
,
(
char
*
)
term_name
,
strlen
(
term_name
),
&
request
.
u
.
mgCmdReq
[
0
]
->
memCp
);
mg_fill_mgco_termid
(
termId
,
(
char
*
)
term_name
,
strlen
(
term_name
),
&
request
.
u
.
mgCmdReq
[
0
]
->
memCp
);
if
(
wild
){
request
.
u
.
mgCmdReq
[
0
]
->
wild
.
pres
=
PRSNT_NODEF
;
}
printf
(
"reason[%p = %s], len[%d]
\n
"
,
svc
->
parm
.
reason
.
val
,
svc
->
parm
.
reason
.
val
,
svc
->
parm
.
reason
.
len
);
switch_log_printf
(
SWITCH_CHANNEL_LOG_CLEAN
,
SWITCH_LOG_INFO
,
"Sending %s Service Change for termId[%s] with reason[%s], len[%d]
\n
"
,
((
1
==
wild
)
?
"WildCard"
:
"Non Wild Card"
),
term_name
,
svc
->
parm
.
reason
.
val
,
svc
->
parm
.
reason
.
len
);
sng_mgco_send_cmd
(
suId
,
&
request
);
sng_mgco_send_cmd
(
suId
,
&
request
);
...
...
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
浏览文件 @
84d56ee5
...
@@ -155,7 +155,7 @@ switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq)
...
@@ -155,7 +155,7 @@ switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq)
void
mg_get_time_stamp
(
MgMgcoTimeStamp
*
timeStamp
);
void
mg_get_time_stamp
(
MgMgcoTimeStamp
*
timeStamp
);
switch_status_t
mg_fill_svc_change
(
MgMgcoSvcChgPar
*
srvPar
,
uint8_t
method
,
const
char
*
reason
);
switch_status_t
mg_fill_svc_change
(
MgMgcoSvcChgPar
*
srvPar
,
uint8_t
method
,
const
char
*
reason
);
void
mg_fill_null_context
(
MgMgcoContextId
*
ctxt
);
void
mg_fill_null_context
(
MgMgcoContextId
*
ctxt
);
switch_status_t
mg_send_service_change
(
SuId
suId
,
const
char
*
term_name
,
uint8_t
method
,
MgServiceChangeReason_e
reason
);
switch_status_t
mg_send_service_change
(
SuId
suId
,
const
char
*
term_name
,
uint8_t
method
,
MgServiceChangeReason_e
reason
,
uint8_t
wild
);
switch_status_t
mg_create_mgco_command
(
MgMgcoCommand
*
cmd
,
uint8_t
apiType
,
uint8_t
cmdType
);
switch_status_t
mg_create_mgco_command
(
MgMgcoCommand
*
cmd
,
uint8_t
apiType
,
uint8_t
cmdType
);
...
...
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c
浏览文件 @
84d56ee5
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论