Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2a8841ab
提交
2a8841ab
authored
8月 22, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change mod_sofia to use new core based recovery engine
上级
66677c94
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
57 行增加
和
246 行删除
+57
-246
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+12
-31
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+3
-8
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+6
-8
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+36
-199
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
2a8841ab
...
...
@@ -87,11 +87,11 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
sofia_glue_tech_absorb_sdp
(
tech_pvt
);
}
if
(
s
ofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
)
||
sofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING_BRIDGE
))
{
if
(
s
witch_channel_test_flag
(
tech_pvt
->
channel
,
CF_RECOVERING
)
||
switch_channel_test_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING_BRIDGE
))
{
sofia_set_flag
(
tech_pvt
,
TFLAG_RECOVERED
);
}
if
(
sofia_test_flag
(
tech_pvt
,
TFLAG_OUTBOUND
)
||
s
ofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING
))
{
if
(
sofia_test_flag
(
tech_pvt
,
TFLAG_OUTBOUND
)
||
s
witch_channel_test_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING
))
{
const
char
*
var
;
if
((
var
=
switch_channel_get_variable
(
channel
,
SOFIA_SECURE_MEDIA_VARIABLE
))
&&
!
zstr
(
var
))
{
...
...
@@ -115,10 +115,10 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
if
(
s
ofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING_BRIDGE
))
{
if
(
s
witch_channel_test_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING_BRIDGE
))
{
switch_channel_set_state
(
channel
,
CS_RESET
);
}
else
{
if
(
s
ofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING
))
{
if
(
s
witch_channel_test_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING
))
{
switch_channel_set_state
(
channel
,
CS_EXECUTE
);
}
else
{
/* Move channel's state machine to ROUTING */
...
...
@@ -167,7 +167,7 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
switch_channel_get_name
(
switch_core_session_get_channel
(
session
)));
if
(
s
ofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING_BRIDGE
))
{
if
(
s
witch_channel_test_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING_BRIDGE
))
{
switch_core_session_t
*
other_session
=
NULL
;
const
char
*
uuid
=
switch_core_session_get_uuid
(
session
);
...
...
@@ -200,7 +200,7 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
}
}
s
ofia_clear_flag
(
tech_pvt
,
TFLAG
_RECOVERING_BRIDGE
);
s
witch_channel_clear_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING_BRIDGE
);
}
...
...
@@ -232,7 +232,7 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session)
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
s
ofia_clear_flag
(
tech_pvt
,
TFLAG
_RECOVERING
);
s
witch_channel_clear_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING
);
if
(
!
sofia_test_flag
(
tech_pvt
,
TFLAG_HOLD_LOCK
))
{
sofia_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
...
...
@@ -423,7 +423,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
const
char
*
ps_cause
=
NULL
,
*
use_my_cause
;
const
char
*
gateway_name
=
NULL
;
sofia_gateway_t
*
gateway_ptr
=
NULL
;
int
rec
;
if
((
gateway_name
=
switch_channel_get_variable
(
channel
,
"sip_gateway_name"
)))
{
gateway_ptr
=
sofia_reg_find_gateway
(
gateway_name
);
...
...
@@ -435,12 +434,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_mutex_lock
(
tech_pvt
->
sofia_mutex
);
rec
=
sofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
);
sofia_clear_flag
(
tech_pvt
,
TFLAG_RECOVERING
);
if
(
!
rec
)
{
sofia_glue_tech_untrack
(
tech_pvt
->
profile
,
session
,
SWITCH_TRUE
);
}
if
(
!
switch_channel_test_flag
(
channel
,
CF_ANSWERED
))
{
if
(
switch_channel_direction
(
channel
)
==
SWITCH_CALL_DIRECTION_OUTBOUND
)
{
...
...
@@ -1541,9 +1534,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch
(
msg
->
message_id
)
{
case
SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH
:
case
SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC
:
{
sofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
}
break
;
case
SWITCH_MESSAGE_INDICATE_PROXY_MEDIA
:
{
...
...
@@ -1666,7 +1656,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
{
switch_channel_set_variable
(
channel
,
SOFIA_REPLACES_HEADER
,
NULL
);
sofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
sofia_set_flag
(
tech_pvt
,
TFLAG_SIMPLIFY
);
...
...
@@ -1753,8 +1742,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
case
SWITCH_MESSAGE_INDICATE_UNBRIDGE
:
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
sofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
if
(
sofia_test_flag
(
tech_pvt
,
TFLAG_JB_PAUSED
))
{
sofia_clear_flag
(
tech_pvt
,
TFLAG_JB_PAUSED
);
if
(
switch_channel_test_flag
(
tech_pvt
->
channel
,
CF_JITTERBUFFER
))
{
...
...
@@ -1787,8 +1774,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
rtp_flush_read_buffer
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLUSH_ONCE
);
}
//sofia_glue_tech_untrack(tech_pvt->profile, session);
}
goto
end
;
case
SWITCH_MESSAGE_INDICATE_AUDIO_SYNC
:
...
...
@@ -3620,13 +3605,14 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
if
(
!
strcasecmp
(
argv
[
1
],
"recover"
))
{
if
(
argv
[
2
]
&&
!
strcasecmp
(
argv
[
2
],
"flush"
))
{
sofia_glue_profile_recover
(
profile
,
SWITCH_TRUE
);
stream
->
write_function
(
stream
,
"Flushing recovery database.
\n
"
);
}
else
{
int
x
=
sofia_glue_profile_recover
(
profile
,
SWITCH_FALSE
);
if
(
x
)
{
stream
->
write_function
(
stream
,
"Recovered %d
call
(s)
\n
"
,
x
);
stream
->
write_function
(
stream
,
"Recovered %d
session
(s)
\n
"
,
x
);
}
else
{
stream
->
write_function
(
stream
,
"No
call
s to recover.
\n
"
);
stream
->
write_function
(
stream
,
"No
session
s to recover.
\n
"
);
}
}
...
...
@@ -5609,12 +5595,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_CUSTOM
,
MY_EVENT_RECOVERY
,
sofia_glue_track_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_TRAP
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
...
...
@@ -5641,6 +5621,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
sofia_endpoint_interface
->
interface_name
=
"sofia"
;
sofia_endpoint_interface
->
io_routines
=
&
sofia_io_routines
;
sofia_endpoint_interface
->
state_handler
=
&
sofia_event_handlers
;
sofia_endpoint_interface
->
recover_callback
=
sofia_recover_callback
;
management_interface
=
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_MANAGEMENT_INTERFACE
);
management_interface
->
relative_oid
=
"1001"
;
...
...
@@ -5732,7 +5713,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
switch_event_unbind_callback
(
sofia_presence_event_handler
);
switch_event_unbind_callback
(
sofia_presence_mwi_event_handler
);
switch_event_unbind_callback
(
sofia_glue_track_event_handler
);
switch_event_unbind_callback
(
general_event_handler
);
switch_event_unbind_callback
(
event_handler
);
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
2a8841ab
...
...
@@ -37,6 +37,7 @@
/*Defines etc..*/
/*************************************************************************************************************************************************************/
#define SOFIA_RECOVER "sofia"
#define MANUAL_BYE 1
#define SQL_CACHE_TIMEOUT 300
#define DEFAULT_NONCE_TTL 60
...
...
@@ -246,7 +247,6 @@ typedef enum {
PFLAG_LOG_AUTH_FAIL
,
PFLAG_FORWARD_MWI_NOTIFY
,
PFLAG_TRACK_CALLS
,
PFLAG_TRACK_CALLS_EVENTS
,
PFLAG_DESTROY
,
PFLAG_EXTENDED_INFO_PARSING
,
PFLAG_T38_PASSTHRU
,
...
...
@@ -327,9 +327,6 @@ typedef enum {
TFLAG_PASS_RFC2833
,
TFLAG_UPDATING_DISPLAY
,
TFLAG_ENABLE_SOA
,
TFLAG_TRACKED
,
TFLAG_RECOVERING
,
TFLAG_RECOVERING_BRIDGE
,
TFLAG_T38_PASSTHRU
,
TFLAG_RECOVERED
,
TFLAG_AUTOFLUSH_DURING_BRIDGE
,
...
...
@@ -957,7 +954,7 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
void
event_handler
(
switch_event_t
*
event
);
void
sofia_presence_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_mwi_event_handler
(
switch_event_t
*
event
);
void
sofia_glue_track_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_cancel
(
void
);
switch_status_t
config_sofia
(
int
reload
,
char
*
profile_name
);
void
sofia_reg_auth_challenge
(
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_dispatch_event_t
*
de
,
...
...
@@ -1161,8 +1158,6 @@ void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t
void
sofia_update_callee_id
(
switch_core_session_t
*
session
,
sofia_profile_t
*
profile
,
sip_t
const
*
sip
,
switch_bool_t
send
);
void
sofia_send_callee_id
(
switch_core_session_t
*
session
,
const
char
*
name
,
const
char
*
number
);
int
sofia_sla_supported
(
sip_t
const
*
sip
);
void
sofia_glue_tech_untrack
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
,
switch_bool_t
force
);
void
sofia_glue_tech_track
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
);
int
sofia_glue_recover
(
switch_bool_t
flush
);
int
sofia_glue_profile_recover
(
sofia_profile_t
*
profile
,
switch_bool_t
flush
);
void
sofia_profile_destroy
(
sofia_profile_t
*
profile
);
...
...
@@ -1192,7 +1187,7 @@ char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool);
void
sofia_presence_check_subscriptions
(
sofia_profile_t
*
profile
,
time_t
now
);
void
sofia_msg_thread_start
(
int
idx
);
void
crtp_init
(
switch_loadable_module_interface_t
*
module_interface
);
int
sofia_recover_callback
(
switch_core_session_t
*
session
);
/* For Emacs:
* Local Variables:
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
2a8841ab
...
...
@@ -1123,7 +1123,7 @@ static void our_sofia_event_callback(nua_event_t event,
}
extract_header_vars
(
profile
,
sip
,
session
,
nh
);
s
ofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
s
witch_core_recovery_track
(
session
);
sofia_set_flag
(
tech_pvt
,
TFLAG_GOT_ACK
);
}
}
...
...
@@ -4479,9 +4479,6 @@ switch_status_t config_sofia(int reload, char *profile_name)
}
else
if
(
!
strcasecmp
(
var
,
"track-calls"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS
);
}
else
if
(
!
strcasecmp
(
val
,
"events"
))
{
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS
);
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS_EVENTS
);
}
}
else
if
(
!
strcasecmp
(
var
,
"NDLB-received-in-nat-reg-contact"
)
&&
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_RECIEVED_IN_NAT_REG_CONTACT
);
...
...
@@ -5780,7 +5777,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
}
if
((
!
switch_channel_test_flag
(
channel
,
CF_EARLY_MEDIA
)
&&
!
switch_channel_test_flag
(
channel
,
CF_ANSWERED
)
&&
!
switch_channel_test_flag
(
channel
,
CF_RING_READY
))
||
s
ofia_test_flag
(
tech_pvt
,
TFLAG
_RECOVERING
))
{
!
switch_channel_test_flag
(
channel
,
CF_RING_READY
))
||
s
witch_channel_test_flag
(
channel
,
CF
_RECOVERING
))
{
const
char
*
from_user
=
""
,
*
from_host
=
""
,
*
to_user
=
""
,
*
to_host
=
""
,
*
contact_user
=
""
,
*
contact_host
=
""
;
const
char
*
user_agent
=
""
,
*
call_id
=
""
;
const
char
*
to_tag
=
""
;
...
...
@@ -5860,8 +5857,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
extract_header_vars
(
profile
,
sip
,
session
,
nh
);
extract_vars
(
profile
,
sip
,
session
);
s
ofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
s
ofia_clear_flag
(
tech_pvt
,
TFLAG
_RECOVERING
);
s
witch_core_recovery_track
(
session
);
s
witch_channel_clear_flag
(
tech_pvt
->
channel
,
CF
_RECOVERING
);
}
}
...
...
@@ -7984,7 +7981,7 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
switch_channel_set_variable_printf
(
channel
,
"sip_recieved_port"
,
"%d"
,
network_port
);
switch_channel_set_variable_printf
(
channel
,
"sip_via_rport"
,
"%d"
,
network_port
);
s
ofia_glue_tech_track
(
tech_pvt
->
profile
,
session
);
s
witch_core_recovery_track
(
session
);
}
if
(
sofia_test_pflag
(
profile
,
PFLAG_MANAGE_SHARED_APPEARANCE
))
{
...
...
@@ -8351,6 +8348,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
}
switch_channel_set_variable
(
channel
,
"sofia_profile_name"
,
profile
->
name
);
switch_channel_set_variable
(
channel
,
"recovery_profile_name"
,
profile
->
name
);
switch_channel_set_variable
(
channel
,
"sofia_profile_domain_name"
,
profile
->
domain_name
);
if
(
!
zstr
(
sip
->
sip_from
->
a_display
))
{
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
2a8841ab
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论