Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
303de52b
提交
303de52b
authored
2月 15, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3794 more fun
上级
eb4cac9b
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
62 行增加
和
62 行删除
+62
-62
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+44
-44
switch_channel.c
src/switch_channel.c
+18
-18
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
303de52b
...
@@ -635,42 +635,42 @@ static void do_normal_probe(switch_event_t *event)
...
@@ -635,42 +635,42 @@ static void do_normal_probe(switch_event_t *event)
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
sql
=
switch_mprintf
(
"select sip_registrations.sip_user, "
sql
=
switch_mprintf
(
"select sip_registrations.sip_user, "
"sip_registrations.sub_host, "
"sip_registrations.sub_host, "
"sip_registrations.status, "
"sip_registrations.status, "
"sip_registrations.rpid, "
"sip_registrations.rpid, "
"'', "
"'', "
"sip_dialogs.uuid, "
"sip_dialogs.uuid, "
"sip_dialogs.state, "
"sip_dialogs.state, "
"sip_dialogs.direction, "
"sip_dialogs.direction, "
"sip_dialogs.sip_to_user, "
"sip_dialogs.sip_to_user, "
"sip_dialogs.sip_to_host, "
"sip_dialogs.sip_to_host, "
"sip_presence.status,"
"sip_presence.status,"
"sip_presence.rpid,"
"sip_presence.rpid,"
"sip_dialogs.presence_id, "
"sip_dialogs.presence_id, "
"sip_presence.open_closed,"
"sip_presence.open_closed,"
"'%q','%q','%q' "
"'%q','%q','%q' "
"from sip_registrations "
"from sip_registrations "
"left join sip_dialogs on "
"left join sip_dialogs on "
"sip_dialogs.hostname = sip_registrations.hostname and sip_dialogs.profile_name = sip_registrations.profile_name and ("
"sip_dialogs.hostname = sip_registrations.hostname and sip_dialogs.profile_name = sip_registrations.profile_name and ("
"sip_dialogs.presence_id = sip_registrations.sip_user %q '@' %q sip_registrations.sub_host "
"sip_dialogs.presence_id = sip_registrations.sip_user %q '@' %q sip_registrations.sub_host "
"or (sip_dialogs.sip_from_user = sip_registrations.sip_user "
"or (sip_dialogs.sip_from_user = sip_registrations.sip_user "
"and sip_dialogs.sip_from_host = sip_registrations.sip_host)) "
"and sip_dialogs.sip_from_host = sip_registrations.sip_host)) "
"left join sip_presence on "
"left join sip_presence on "
"sip_presence.hostname=sip_registrations.hostname and "
"sip_presence.hostname=sip_registrations.hostname and "
"(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and "
"(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and "
"sip_registrations.profile_name=sip_presence.profile_name) "
"sip_registrations.profile_name=sip_presence.profile_name) "
"where sip_registrations.hostname='%q' and sip_registrations.profile_name='%q' and sip_dialogs.call_info_state != 'seized' "
"where sip_registrations.hostname='%q' and sip_registrations.profile_name='%q' and sip_dialogs.call_info_state != 'seized' "
"and sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
"and sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and "
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
"(sip_registrations.orig_server_host='%q' or sip_registrations.sub_host='%q' "
"))"
,
"))"
,
dh
.
status
,
dh
.
rpid
,
switch_str_nil
(
sub_call_id
),
dh
.
status
,
dh
.
rpid
,
switch_str_nil
(
sub_call_id
),
switch_sql_concat
(),
switch_sql_concat
(),
switch_sql_concat
(),
switch_sql_concat
(),
mod_sofia_globals
.
hostname
,
profile
->
name
,
probe_euser
,
probe_host
,
probe_euser
,
probe_host
,
probe_host
);
mod_sofia_globals
.
hostname
,
profile
->
name
,
probe_euser
,
probe_host
,
probe_euser
,
probe_host
,
probe_host
);
switch_assert
(
sql
);
switch_assert
(
sql
);
...
@@ -1115,7 +1115,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
...
@@ -1115,7 +1115,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
}
}
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_dialog_callback
,
&
dh
);
sofia_glue_execute_sql_callback
(
profile
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_dialog_callback
,
&
dh
);
switch_safe_free
(
sql
);
switch_safe_free
(
sql
);
...
@@ -1563,7 +1563,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1563,7 +1563,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"call-id"
,
call_id
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"call-id"
,
call_id
);
}
}
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"resub"
,
"true"
);
//
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "resub", "true");
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"status"
,
status
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"status"
,
status
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
rpid
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
rpid
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
...
@@ -1595,12 +1595,9 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1595,12 +1595,9 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
}
}
}
}
switch_event_fire
(
&
event
);
switch_event_fire
(
&
event
);
}
}
switch_safe_free
(
free_me
);
switch_safe_free
(
free_me
);
...
@@ -2415,7 +2412,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2415,7 +2412,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
char
*
clean_from_user
=
NULL
;
char
*
clean_from_user
=
NULL
;
int
force_status
=
0
;
int
force_status
=
0
;
const
char
*
call_state
=
switch_event_get_header
(
helper
->
event
,
"channel-state"
);
const
char
*
call_state
=
switch_event_get_header
(
helper
->
event
,
"channel-state"
);
char
*
call_info_state
=
switch_event_get_header
(
helper
->
event
,
"presence-call-info-state"
);
if
(
user_agent
&&
switch_stristr
(
"snom"
,
user_agent
)
&&
uuid
)
{
if
(
user_agent
&&
switch_stristr
(
"snom"
,
user_agent
)
&&
uuid
)
{
default_dialog
=
"full"
;
default_dialog
=
"full"
;
...
@@ -2532,7 +2529,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2532,7 +2529,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
}
}
if
(
sofia_test_pflag
(
profile
,
PFLAG_PRESENCE_DISABLE_EARLY
)
&&
!
strcasecmp
(
astate
,
"early"
))
{
if
(
sofia_test_pflag
(
profile
,
PFLAG_PRESENCE_DISABLE_EARLY
)
&&
(
!
zstr
(
call_info_state
)
&&
(
!
strcasecmp
(
call_info_state
,
"alterting"
)
||
!
strcasecmp
(
call_info_state
,
"progressing"
))))
{
goto
end
;
goto
end
;
}
}
...
@@ -3552,14 +3550,16 @@ void sofia_presence_handle_sip_i_subscribe(int status,
...
@@ -3552,14 +3550,16 @@ void sofia_presence_handle_sip_i_subscribe(int status,
switch_event_fire
(
&
sevent
);
switch_event_fire
(
&
sevent
);
}
}
}
else
if
(
!
strcasecmp
(
event
,
"presence"
))
{
}
else
if
(
!
strcasecmp
(
event
,
"presence"
))
{
if
(
switch_event_create
(
&
sevent
,
SWITCH_EVENT_PRESENCE_
IN
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create
(
&
sevent
,
SWITCH_EVENT_PRESENCE_
PROBE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"proto"
,
SOFIA_CHAT_PROTO
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"proto"
,
SOFIA_CHAT_PROTO
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"login"
,
profile
->
name
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"login"
,
profile
->
name
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"presence-source"
,
"subscribe"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"presence-source"
,
"subscribe"
);
switch_event_add_header
(
sevent
,
SWITCH_STACK_BOTTOM
,
"from"
,
"%s@%s"
,
from_user
,
from_host
);
switch_event_add_header
(
sevent
,
SWITCH_STACK_BOTTOM
,
"from"
,
"%s@%s"
,
to_user
,
to_host
);
switch_event_add_header
(
sevent
,
SWITCH_STACK_BOTTOM
,
"to"
,
"%s@%s"
,
to_user
,
to_host
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"alt_event_type"
,
"dialog"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
"unknown"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
"unknown"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"status"
,
"Registered"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"status"
,
"Registered"
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"call-id"
,
call_id
);
switch_event_add_header_string
(
sevent
,
SWITCH_STACK_BOTTOM
,
"
sub-
call-id"
,
call_id
);
switch_event_fire
(
&
sevent
);
switch_event_fire
(
&
sevent
);
}
}
}
}
...
...
src/switch_channel.c
浏览文件 @
303de52b
...
@@ -604,6 +604,7 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
...
@@ -604,6 +604,7 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
switch_event_t
*
event
;
switch_event_t
*
event
;
switch_event_types_t
type
=
SWITCH_EVENT_PRESENCE_IN
;
switch_event_types_t
type
=
SWITCH_EVENT_PRESENCE_IN
;
const
char
*
call_info
=
NULL
;
const
char
*
call_info
=
NULL
;
char
*
call_info_state
=
"active"
;
if
(
!
status
)
{
if
(
!
status
)
{
type
=
SWITCH_EVENT_PRESENCE_OUT
;
type
=
SWITCH_EVENT_PRESENCE_OUT
;
...
@@ -634,31 +635,30 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
...
@@ -634,31 +635,30 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"alt_event_type"
,
"dialog"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"alt_event_type"
,
"dialog"
);
if
(
call_info
)
{
char
*
call_info_state
=
"active"
;
if
(
!
switch_channel_up_nosig
(
channel
))
{
call_info_state
=
"idle"
;
}
else
if
(
!
strcasecmp
(
status
,
"hold-private"
))
{
call_info_state
=
"held-private"
;
}
else
if
(
!
strcasecmp
(
status
,
"hold"
))
{
call_info_state
=
"held"
;
}
else
if
(
!
switch_channel_test_flag
(
channel
,
CF_ANSWERED
))
{
if
(
channel
->
direction
==
SWITCH_CALL_DIRECTION_OUTBOUND
)
{
call_info_state
=
"progressing"
;
}
else
{
call_info_state
=
"alerting"
;
}
}
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-info-state"
,
call_info_state
);
if
(
!
switch_channel_up_nosig
(
channel
))
{
call_info_state
=
"idle"
;
}
else
if
(
!
strcasecmp
(
status
,
"hold-private"
))
{
call_info_state
=
"held-private"
;
}
else
if
(
!
strcasecmp
(
status
,
"hold"
))
{
call_info_state
=
"held"
;
}
else
if
(
!
switch_channel_test_flag
(
channel
,
CF_ANSWERED
))
{
if
(
channel
->
direction
==
SWITCH_CALL_DIRECTION_OUTBOUND
)
{
call_info_state
=
"progressing"
;
}
else
{
call_info_state
=
"alerting"
;
}
}
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-info-state"
,
call_info_state
);
if
(
call_info
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-info"
,
call_info
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-info"
,
call_info
);
}
}
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-direction"
,
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"presence-call-direction"
,
channel
->
direction
==
SWITCH_CALL_DIRECTION_OUTBOUND
?
"outbound"
:
"inbound"
);
channel
->
direction
==
SWITCH_CALL_DIRECTION_OUTBOUND
?
"outbound"
:
"inbound"
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"event_count"
,
"%d"
,
channel
->
event_count
++
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"event_count"
,
"%d"
,
channel
->
event_count
++
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Presence-Calling-File"
,
file
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Presence-Calling-File"
,
file
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Presence-Calling-Function"
,
func
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Presence-Calling-Function"
,
func
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论