Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
079f4845
提交
079f4845
authored
6月 08, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add check_sync to sofia cli (like flush_inbound_reg without the unreg)
上级
1d3417a9
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
103 行增加
和
0 行删除
+103
-0
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+15
-0
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+2
-0
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+86
-0
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
079f4845
...
...
@@ -3273,6 +3273,19 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
goto
done
;
}
if
(
!
strcasecmp
(
argv
[
1
],
"check_sync"
))
{
if
(
argc
>
2
)
{
sofia_reg_check_call_id
(
profile
,
argv
[
2
]);
stream
->
write_function
(
stream
,
"+OK syncing all registrations matching specified call_id
\n
"
);
}
else
{
sofia_reg_check_sync
(
profile
);
stream
->
write_function
(
stream
,
"+OK syncing all registrations
\n
"
);
}
goto
done
;
}
if
(
!
strcasecmp
(
argv
[
1
],
"flush_inbound_reg"
))
{
int
reboot
=
0
;
...
...
@@ -3853,6 +3866,7 @@ SWITCH_STANDARD_API(sofia_function)
" watchdog <on|off>
\n\n
"
"sofia profile <name> [start | stop | restart | rescan]
\n
"
" flush_inbound_reg [<call_id> | <[user]@domain>] [reboot]
\n
"
" check_sync [<call_id> | <[user]@domain>]
\n
"
" [register | unregister] [<gateway name> | all]
\n
"
" killgw <gateway name>
\n
"
" [stun-auto-disable | stun-enabled] [true | false]]
\n
"
...
...
@@ -5158,6 +5172,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles restart"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles flush_inbound_reg"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles check_sync"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles register ::sofia::list_profile_gateway"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles unregister ::sofia::list_profile_gateway"
);
switch_console_set_complete
(
"add sofia profile ::sofia::list_profiles killgw ::sofia::list_profile_gateway"
);
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
079f4845
...
...
@@ -983,6 +983,8 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt);
switch_status_t
sofia_glue_tech_proxy_remote_addr
(
private_object_t
*
tech_pvt
);
void
sofia_presence_event_thread_start
(
void
);
void
sofia_reg_expire_call_id
(
sofia_profile_t
*
profile
,
const
char
*
call_id
,
int
reboot
);
void
sofia_reg_check_call_id
(
sofia_profile_t
*
profile
,
const
char
*
call_id
);
void
sofia_reg_check_sync
(
sofia_profile_t
*
profile
);
switch_status_t
sofia_glue_tech_choose_video_port
(
private_object_t
*
tech_pvt
,
int
force
);
switch_status_t
sofia_glue_tech_set_video_codec
(
private_object_t
*
tech_pvt
,
int
force
);
char
*
sofia_glue_get_register_host
(
const
char
*
uri
);
...
...
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
079f4845
...
...
@@ -733,6 +733,92 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
}
int
sofia_reg_check_callback
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
)
{
sofia_profile_t
*
profile
=
(
sofia_profile_t
*
)
pArg
;
sofia_reg_send_reboot
(
profile
,
argv
[
1
],
argv
[
2
],
argv
[
3
],
argv
[
7
],
argv
[
11
]);
return
0
;
}
void
sofia_reg_check_call_id
(
sofia_profile_t
*
profile
,
const
char
*
call_id
)
{
char
*
sql
=
NULL
;
char
*
sqlextra
=
NULL
;
char
*
dup
=
strdup
(
call_id
);
char
*
host
=
NULL
,
*
user
=
NULL
;
switch_assert
(
dup
);
if
((
host
=
strchr
(
dup
,
'@'
)))
{
*
host
++
=
'\0'
;
user
=
dup
;
}
else
{
host
=
dup
;
}
if
(
!
host
)
{
host
=
"none"
;
}
if
(
zstr
(
user
))
{
sqlextra
=
switch_mprintf
(
" or (sip_host='%q')"
,
host
);
}
else
{
sqlextra
=
switch_mprintf
(
" or (sip_user='%q' and sip_host='%q')"
,
user
,
host
);
}
sql
=
switch_mprintf
(
"select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip"
" from sip_registrations where call_id='%q' %s"
,
call_id
,
sqlextra
);
switch_mutex_lock
(
profile
->
ireg_mutex
);
sofia_glue_execute_sql_callback
(
profile
,
NULL
,
sql
,
sofia_reg_check_callback
,
profile
);
switch_mutex_unlock
(
profile
->
ireg_mutex
);
switch_safe_free
(
sql
);
switch_safe_free
(
sqlextra
);
switch_safe_free
(
dup
);
}
void
sofia_reg_check_sync
(
sofia_profile_t
*
profile
)
{
char
sql
[
1024
];
switch_mutex_lock
(
profile
->
ireg_mutex
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"select call_id,sip_user,sip_host,contact,status,rpid,expires"
",user_agent,server_user,server_host,profile_name,network_ip"
" from sip_registrations where expires > 0"
);
sofia_glue_execute_sql_callback
(
profile
,
NULL
,
sql
,
sofia_reg_del_callback
,
profile
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"delete from sip_registrations where expires > 0 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_actually_execute_sql
(
profile
,
sql
,
NULL
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"delete from sip_presence where expires > 0 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_actually_execute_sql
(
profile
,
sql
,
NULL
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"delete from sip_authentication where expires > 0 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_actually_execute_sql
(
profile
,
sql
,
NULL
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"select sub_to_user,sub_to_host,call_id from sip_subscriptions where expires >= -1 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_execute_sql_callback
(
profile
,
NULL
,
sql
,
sofia_sub_del_callback
,
profile
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"delete from sip_subscriptions where expires >= -1 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_actually_execute_sql
(
profile
,
sql
,
NULL
);
switch_snprintf
(
sql
,
sizeof
(
sql
),
"delete from sip_dialogs where expires >= -1 and hostname='%s'"
,
mod_sofia_globals
.
hostname
);
sofia_glue_actually_execute_sql
(
profile
,
sql
,
NULL
);
switch_mutex_unlock
(
profile
->
ireg_mutex
);
}
char
*
sofia_reg_find_reg_url
(
sofia_profile_t
*
profile
,
const
char
*
user
,
const
char
*
host
,
char
*
val
,
switch_size_t
len
)
{
struct
callback_t
cbt
=
{
0
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论