Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
96943abe
提交
96943abe
authored
12月 15, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@6808
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
87b14806
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
46 行增加
和
12 行删除
+46
-12
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+9
-0
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+37
-12
没有找到文件。
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
96943abe
...
...
@@ -2107,6 +2107,15 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
su_free
(
profile
->
home
,
tmp
);
}
#if 0
if (sofia_test_pflag(profile, PFLAG_PRESENCE)) {
char *tmp = switch_mprintf("%s@%s", switch_str_nil(switch_channel_get_variable(channel, "sip_to_user")), switch_str_nil(switch_channel_get_variable(channel, "sip_to_host")));
switch_assert(tmp);
switch_channel_set_variable(channel, "presence_id", tmp);
free(tmp);
}
#endif
check_decode
(
displayname
,
session
);
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
from_user
,
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
96943abe
...
...
@@ -413,14 +413,14 @@ void sofia_presence_event_handler(switch_event_t *event)
case
SWITCH_EVENT_PRESENCE_IN
:
sql
=
switch_mprintf
(
"select *,1,'%q','%q' from sip_subscriptions where
proto='%q' and
(event='%q' or event='%q') and sub_to_user='%q' and sub_to_host='%q'"
,
status
,
rpid
,
proto
,
event_type
,
alt_event_type
,
euser
,
host
);
(
"select *,1,'%q','%q' from sip_subscriptions where (event='%q' or event='%q') and sub_to_user='%q' and sub_to_host='%q'"
,
status
,
rpid
,
event_type
,
alt_event_type
,
euser
,
host
);
break
;
case
SWITCH_EVENT_PRESENCE_OUT
:
sql
=
switch_mprintf
(
"select *,0,'%q','%q' from sip_subscriptions where
proto='%q' and
(event='%q' or event='%q') and sub_to_user='%q' and sub_to_host='%q'"
,
status
,
rpid
,
proto
,
event_type
,
alt_event_type
,
euser
,
host
);
(
"select *,0,'%q','%q' from sip_subscriptions where (event='%q' or event='%q') and sub_to_user='%q' and sub_to_host='%q'"
,
status
,
rpid
,
event_type
,
alt_event_type
,
euser
,
host
);
break
;
default:
break
;
...
...
@@ -436,6 +436,7 @@ void sofia_presence_event_handler(switch_event_t *event)
if
(
sql
)
{
struct
presence_helper
helper
;
helper
.
profile
=
profile
;
helper
.
event
=
event
;
sofia_glue_execute_sql_callback
(
profile
,
...
...
@@ -507,6 +508,12 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"status"
,
"%s"
,
status
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"rpid"
,
"%s"
,
rpid
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"event_type"
,
"presence"
);
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", SOFIA_CHAT_PROTO);
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", "CS_HANGUP");
//switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", "void");
switch_event_fire
(
&
event
);
}
...
...
@@ -550,7 +557,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
struct
presence_helper
*
helper
=
(
struct
presence_helper
*
)
pArg
;
sofia_profile_t
*
profile
=
helper
->
profile
;
char
*
pl
;
char
*
id
,
*
note
;
char
*
clean_id
=
NULL
,
*
id
=
NULL
,
*
note
;
uint32_t
in
=
atoi
(
argv
[
13
]);
char
*
status
=
argv
[
14
];
char
*
rpid
=
argv
[
15
];
...
...
@@ -567,6 +574,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
char
*
open
;
char
*
prpid
;
int
done
=
0
;
const
char
*
ct
;
if
(
!
(
nh
=
(
nua_handle_t
*
)
switch_core_hash_find
(
profile
->
sub_hash
,
call_id
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find handle for %s
\n
"
,
call_id
);
...
...
@@ -592,6 +601,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
open
=
"closed"
;
}
clean_id
=
switch_mprintf
(
"sip:%s@%s"
,
sub_to_user
,
sub_to_host
);
if
(
!
strcasecmp
(
sub_to_host
,
host
))
{
/* same host */
id
=
switch_mprintf
(
"sip:%s+%s@%s"
,
proto
,
sub_to_user
,
sub_to_host
);
...
...
@@ -610,15 +621,23 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
const
char
*
uuid
=
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"unique-id"
));
const
char
*
state
=
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"channel-state"
));
const
char
*
status
=
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"status"
));
SWITCH_STANDARD_STREAM
(
stream
);
const
char
*
astate
=
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"answer-state"
));
SWITCH_STANDARD_STREAM
(
stream
);
if
(
!
strcasecmp
(
state
,
"cs_hangup"
))
{
astate
=
"terminated"
;
}
else
if
(
!
strcasecmp
(
astate
,
"answered"
))
{
astate
=
"confirmed"
;
}
else
if
(
!
strcasecmp
(
astate
,
"ringing"
))
{
astate
=
"early"
;
}
stream
.
write_function
(
&
stream
,
"<?xml version=
\"
1.0
\"
?>
\n
"
"<dialog-info xmlns=
\"
urn:ietf:params:xml:ns:dialog-info
\"
"
"version=
\"
%s
\"
state=
\"
full
\"
entity=
\"
%s
\"
>
\n
"
,
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"event_count"
)),
to
);
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"event_count"
)),
clean_id
);
if
(
!
strcasecmp
(
state
,
"RING"
))
{
stream
.
write_function
(
&
stream
,
"<dialog id=
\"
%s
\"
direction=
\"
recipient
\"
>
\n
"
,
uuid
);
...
...
@@ -626,14 +645,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
stream
.
write_function
(
&
stream
,
"<dialog id=
\"
%s
\"
>
\n
"
,
uuid
);
}
stream
.
write_function
(
&
stream
,
"<state>%s</state>
\n
"
,
switch_str_nil
(
switch_event_get_header
(
helper
->
event
,
"answer-state"
)));
stream
.
write_function
(
&
stream
,
"<state>%s</state>
\n
"
,
astate
);
if
(
!
strcasecmp
(
status
,
"hold"
))
{
stream
.
write_function
(
&
stream
,
"<local>
\n
<target uri=
\"
%s
\"
>
\n
"
"<param pname=
\"
+sip.rendering
\"
pvalue=
\"
no
\"
>
\n
"
"</target>
\n
</local>
\n
"
,
to
);
"<param pname=
\"
+sip.rendering
\"
pvalue=
\"
no
\"
>
\n
"
"</target>
\n
</local>
\n
"
,
clean_id
);
}
stream
.
write_function
(
&
stream
,
"</dialog>
\n
</dialog-info>
\n
"
);
pl
=
stream
.
data
;
ct
=
"application/dialog-info+xml"
;
printf
(
"%s
\n
"
,
pl
);
}
else
{
pl
=
switch_mprintf
(
"<?xml version='1.0' encoding='UTF-8'?>
\r\n
"
"<presence xmlns='urn:ietf:params:xml:ns:pidf'
\r\n
"
...
...
@@ -661,18 +684,20 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
"</presence>"
,
id
,
id
,
profile
->
url
,
open
,
status
,
prpid
,
open
,
rpid
,
note
);
ct
=
"application/pidf+xml"
;
}
nua_notify
(
nh
,
NUTAG_NEWSUB
(
1
),
SIPTAG_SUBSCRIPTION_STATE_STR
(
"active;expires=3600"
),
SIPTAG_EVENT_STR
(
event
),
SIPTAG_CONTENT_TYPE_STR
(
"application/pidf+xml"
),
SIPTAG_PAYLOAD_STR
(
pl
),
TAG_END
());
SIPTAG_EVENT_STR
(
event
),
SIPTAG_CONTENT_TYPE_STR
(
ct
),
SIPTAG_PAYLOAD_STR
(
pl
),
TAG_END
());
if
(
done
)
{
switch_core_hash_delete
(
profile
->
sub_hash
,
call_id
);
}
switch_safe_free
(
id
);
switch_safe_free
(
clean_id
);
switch_safe_free
(
note
);
switch_safe_free
(
pl
);
switch_safe_free
(
to
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论