Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
94763ea5
提交
94763ea5
authored
11月 01, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-4681 --resolve
上级
43dfc703
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
36 行增加
和
12 行删除
+36
-12
switch_core.h
src/include/switch_core.h
+9
-1
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+14
-5
switch_core_session.c
src/switch_core_session.c
+13
-6
没有找到文件。
src/include/switch_core.h
浏览文件 @
94763ea5
...
@@ -825,14 +825,22 @@ SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *str
...
@@ -825,14 +825,22 @@ SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *str
*/
*/
SWITCH_DECLARE
(
void
)
switch_core_session_hupall
(
_In_
switch_call_cause_t
cause
);
SWITCH_DECLARE
(
void
)
switch_core_session_hupall
(
_In_
switch_call_cause_t
cause
);
typedef
enum
{
SHT_NONE
=
0
,
SHT_UNANSWERED
=
(
1
<<
0
),
SHT_ANSWERED
=
(
1
<<
1
)
}
switch_hup_type_t
;
/*!
/*!
\brief Hangup all sessions which match a specific channel variable
\brief Hangup all sessions which match a specific channel variable
\param var_name The variable name to look for
\param var_name The variable name to look for
\param var_val The value to look for
\param var_val The value to look for
\param cause the hangup cause to apply to the hungup channels
\param cause the hangup cause to apply to the hungup channels
*/
*/
SWITCH_DECLARE
(
void
)
switch_core_session_hupall_matching_var
(
_In_
const
char
*
var_name
,
_In_
const
char
*
var_val
,
_In_
switch_call_cause_t
cause
);
SWITCH_DECLARE
(
uint32_t
)
switch_core_session_hupall_matching_var_ans
(
_In_
const
char
*
var_name
,
_In_
const
char
*
var_val
,
_In_
switch_call_cause_t
cause
,
switch_hup_type_t
type
);
SWITCH_DECLARE
(
switch_console_callback_match_t
*
)
switch_core_session_findall_matching_var
(
const
char
*
var_name
,
const
char
*
var_val
);
SWITCH_DECLARE
(
switch_console_callback_match_t
*
)
switch_core_session_findall_matching_var
(
const
char
*
var_name
,
const
char
*
var_val
);
#define switch_core_session_hupall_matching_var(_vn, _vv, _c) switch_core_session_hupall_matching_var_ans(_vn, _vv, _c, SHT_UNANSWERED | SHT_ANSWERED)
/*!
/*!
\brief Hangup all sessions that belong to an endpoint
\brief Hangup all sessions that belong to an endpoint
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
94763ea5
...
@@ -8539,11 +8539,13 @@ static void conference_send_presence(conference_obj_t *conference)
...
@@ -8539,11 +8539,13 @@ static void conference_send_presence(conference_obj_t *conference)
}
}
}
}
#if 0
static
void
kickall_matching_var
(
conference_obj_t
*
conference
,
const
char
*
var
,
const
char
*
val
)
static
uint32_t
kickall_matching_var(conference_obj_t *conference, const char *var, const char *val)
{
{
conference_member_t *member = NULL;
conference_member_t *member = NULL;
const char *vval = NULL;
const char *vval = NULL;
uint32_t r = 0;
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->member_mutex);
switch_mutex_lock(conference->member_mutex);
...
@@ -8560,14 +8562,18 @@ static void kickall_matching_var(conference_obj_t *conference, const char *var,
...
@@ -8560,14 +8562,18 @@ static void kickall_matching_var(conference_obj_t *conference, const char *var,
if (vval && !strcmp(vval, val)) {
if (vval && !strcmp(vval, val)) {
switch_set_flag_locked(member, MFLAG_KICKED);
switch_set_flag_locked(member, MFLAG_KICKED);
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_session_kill_channel
(
member
->
session
,
SWITCH_SIG_BREAK
);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
r++;
}
}
}
}
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
switch_mutex_unlock(conference->mutex);
return r;
}
}
#endif
static void call_setup_event_handler(switch_event_t *event)
static void call_setup_event_handler(switch_event_t *event)
{
{
...
@@ -8631,8 +8637,11 @@ static void call_setup_event_handler(switch_event_t *event)
...
@@ -8631,8 +8637,11 @@ static void call_setup_event_handler(switch_event_t *event)
}
}
} else if (!strcasecmp(action, "end")) {
} else if (!strcasecmp(action, "end")) {
//switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING);
if (switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING)) {
kickall_matching_var
(
conference
,
"conference_call_key"
,
key
);
send_conference_notify(conference, "SIP/2.0 200 OK\r\n", call_id, SWITCH_TRUE);
} else {
send_conference_notify(conference, "SIP/2.0 481 Failure\r\n", call_id, SWITCH_TRUE);
}
status = SWITCH_STATUS_SUCCESS;
status = SWITCH_STATUS_SUCCESS;
}
}
...
...
src/switch_core_session.c
浏览文件 @
94763ea5
...
@@ -204,18 +204,20 @@ struct str_node {
...
@@ -204,18 +204,20 @@ struct str_node {
struct
str_node
*
next
;
struct
str_node
*
next
;
};
};
SWITCH_DECLARE
(
void
)
switch_core_session_hupall_matching_var
(
const
char
*
var_name
,
const
char
*
var_val
,
switch_call_cause_t
cause
)
SWITCH_DECLARE
(
uint32_t
)
switch_core_session_hupall_matching_var_ans
(
const
char
*
var_name
,
const
char
*
var_val
,
switch_call_cause_t
cause
,
switch_hup_type_t
type
)
{
{
switch_hash_index_t
*
hi
;
switch_hash_index_t
*
hi
;
void
*
val
;
void
*
val
;
switch_core_session_t
*
session
;
switch_core_session_t
*
session
;
switch_memory_pool_t
*
pool
;
switch_memory_pool_t
*
pool
;
struct
str_node
*
head
=
NULL
,
*
np
;
struct
str_node
*
head
=
NULL
,
*
np
;
uint32_t
r
=
0
;
switch_core_new_memory_pool
(
&
pool
);
switch_core_new_memory_pool
(
&
pool
);
if
(
!
var_val
)
if
(
!
var_val
)
return
;
return
r
;
switch_mutex_lock
(
runtime
.
session_hash_mutex
);
switch_mutex_lock
(
runtime
.
session_hash_mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
session_manager
.
session_table
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
for
(
hi
=
switch_hash_first
(
NULL
,
session_manager
.
session_table
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
...
@@ -223,10 +225,13 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
...
@@ -223,10 +225,13 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
if
(
val
)
{
if
(
val
)
{
session
=
(
switch_core_session_t
*
)
val
;
session
=
(
switch_core_session_t
*
)
val
;
if
(
switch_core_session_read_lock
(
session
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_session_read_lock
(
session
)
==
SWITCH_STATUS_SUCCESS
)
{
np
=
switch_core_alloc
(
pool
,
sizeof
(
*
np
));
int
ans
=
switch_channel_test_flag
(
switch_core_session_get_channel
(
session
),
CF_ANSWERED
);
np
->
str
=
switch_core_strdup
(
pool
,
session
->
uuid_str
);
if
((
ans
&&
(
type
&
SHT_ANSWERED
))
||
(
!
ans
&&
(
type
&
SHT_UNANSWERED
)))
{
np
->
next
=
head
;
np
=
switch_core_alloc
(
pool
,
sizeof
(
*
np
));
head
=
np
;
np
->
str
=
switch_core_strdup
(
pool
,
session
->
uuid_str
);
np
->
next
=
head
;
head
=
np
;
}
switch_core_session_rwunlock
(
session
);
switch_core_session_rwunlock
(
session
);
}
}
}
}
...
@@ -239,6 +244,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
...
@@ -239,6 +244,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
if
(
switch_channel_up_nosig
(
session
->
channel
)
&&
if
(
switch_channel_up_nosig
(
session
->
channel
)
&&
(
this_val
=
switch_channel_get_variable
(
session
->
channel
,
var_name
))
&&
(
!
strcmp
(
this_val
,
var_val
)))
{
(
this_val
=
switch_channel_get_variable
(
session
->
channel
,
var_name
))
&&
(
!
strcmp
(
this_val
,
var_val
)))
{
switch_channel_hangup
(
session
->
channel
,
cause
);
switch_channel_hangup
(
session
->
channel
,
cause
);
r
++
;
}
}
switch_core_session_rwunlock
(
session
);
switch_core_session_rwunlock
(
session
);
}
}
...
@@ -246,6 +252,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
...
@@ -246,6 +252,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
switch_core_destroy_memory_pool
(
&
pool
);
switch_core_destroy_memory_pool
(
&
pool
);
return
r
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论