Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c378f0d7
提交
c378f0d7
authored
1月 12, 2012
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-3794 try this
上级
b8fdbc48
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
54 行增加
和
13 行删除
+54
-13
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+54
-13
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
c378f0d7
...
@@ -858,6 +858,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
...
@@ -858,6 +858,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
proto
=
SOFIA_CHAT_PROTO
;
proto
=
SOFIA_CHAT_PROTO
;
}
}
//DUMP_EVENT(event);
if
(
rpid
&&
!
strcasecmp
(
rpid
,
"n/a"
))
{
if
(
rpid
&&
!
strcasecmp
(
rpid
,
"n/a"
))
{
rpid
=
NULL
;
rpid
=
NULL
;
...
@@ -878,8 +879,9 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
...
@@ -878,8 +879,9 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
if
(
event
->
event_id
==
SWITCH_EVENT_ROSTER
)
{
if
(
event
->
event_id
==
SWITCH_EVENT_ROSTER
)
{
struct
presence_helper
helper
=
{
0
};
struct
presence_helper
helper
=
{
0
};
if
(
!
mod_sofia_globals
.
profile_hash
)
if
(
!
mod_sofia_globals
.
profile_hash
)
{
return
;
return
;
}
if
(
from
)
{
if
(
from
)
{
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
sql
=
switch_mprintf
(
"select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
...
@@ -1358,6 +1360,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1358,6 +1360,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
char
to_buf
[
128
]
=
""
;
char
to_buf
[
128
]
=
""
;
switch_event_header_t
*
hp
;
switch_event_header_t
*
hp
;
char
*
free_me
=
NULL
;
char
*
free_me
=
NULL
;
int
do_event
=
1
;
if
(
argc
>
5
)
{
if
(
argc
>
5
)
{
uuid
=
argv
[
5
];
uuid
=
argv
[
5
];
...
@@ -1383,6 +1386,13 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1383,6 +1386,13 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
}
}
}
}
if
(
!
zstr
(
uuid
)
&&
!
switch_ivr_uuid_exists
(
uuid
))
{
if
(
mod_sofia_globals
.
debug_presence
>
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"%s SKIPPING NOT FOUND UUID %s
\n
"
,
profile
->
name
,
uuid
);
}
do_event
=
0
;
}
if
(
zstr
(
proto
))
{
if
(
zstr
(
proto
))
{
proto
=
NULL
;
proto
=
NULL
;
}
}
...
@@ -1391,7 +1401,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1391,7 +1401,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"%s PRESENCE_PROBE %s@%s
\n
"
,
profile
->
name
,
user
,
host
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"%s PRESENCE_PROBE %s@%s
\n
"
,
profile
->
name
,
user
,
host
);
}
}
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_PRESENCE_IN
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
do_event
&&
switch_event_create
(
&
event
,
SWITCH_EVENT_PRESENCE_IN
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"proto"
,
proto
?
proto
:
SOFIA_CHAT_PROTO
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"proto"
,
proto
?
proto
:
SOFIA_CHAT_PROTO
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"login"
,
profile
->
url
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"login"
,
profile
->
url
);
...
@@ -1437,9 +1447,14 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
...
@@ -1437,9 +1447,14 @@ 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
);
h
->
rowcount
++
;
h
->
rowcount
++
;
return
0
;
return
0
;
}
}
...
@@ -1662,6 +1677,8 @@ static void send_presence_notify(sofia_profile_t *profile,
...
@@ -1662,6 +1677,8 @@ static void send_presence_notify(sofia_profile_t *profile,
sip_cseq_t
*
cseq
=
NULL
;
sip_cseq_t
*
cseq
=
NULL
;
uint32_t
callsequence
;
uint32_t
callsequence
;
uint32_t
now
=
(
uint32_t
)
switch_epoch_time_now
(
NULL
);
uint32_t
now
=
(
uint32_t
)
switch_epoch_time_now
(
NULL
);
const
char
*
tp
;
char
*
our_contact
=
profile
->
url
,
*
our_contact_dup
=
NULL
;
if
(
expires
)
{
if
(
expires
)
{
long
ltmp
=
atol
(
expires
);
long
ltmp
=
atol
(
expires
);
...
@@ -1692,12 +1709,24 @@ static void send_presence_notify(sofia_profile_t *profile,
...
@@ -1692,12 +1709,24 @@ static void send_presence_notify(sofia_profile_t *profile,
switch_snprintf
(
sstr
,
sizeof
(
sstr
),
"terminated;reason=noresource"
);
switch_snprintf
(
sstr
,
sizeof
(
sstr
),
"terminated;reason=noresource"
);
}
}
tmp
=
(
char
*
)
contact
;
tmp
=
(
char
*
)
contact
;
contact
=
sofia_glue_get_url_from_contact
(
tmp
,
0
);
contact
=
sofia_glue_get_url_from_contact
(
tmp
,
0
);
if
((
tp
=
switch_stristr
(
"transport="
,
contact
)))
{
tp
+=
10
;
}
if
(
zstr
(
tp
))
{
tp
=
"udp"
;
}
if
(
remote_ip
&&
remote_port
)
{
if
(
remote_ip
&&
remote_port
)
{
route
=
switch_mprintf
(
"sip:%s:%s"
,
remote_ip
,
remote_port
);
route
=
switch_mprintf
(
"sip:%s:%s;transport=%s"
,
remote_ip
,
remote_port
,
tp
);
}
if
(
!
switch_stristr
(
"transport="
,
our_contact
))
{
our_contact_dup
=
switch_mprintf
(
"<%s;transport=%s>"
,
our_contact
,
tp
);
our_contact
=
our_contact_dup
;
}
}
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
if
(
mod_sofia_globals
.
debug_presence
>
1
)
{
...
@@ -1708,7 +1737,7 @@ static void send_presence_notify(sofia_profile_t *profile,
...
@@ -1708,7 +1737,7 @@ static void send_presence_notify(sofia_profile_t *profile,
contact
,
contact
,
full_to
,
full_to
,
full_from
,
full_from
,
profile
->
url
,
our_contact
,
call_id
,
call_id
,
expires_str
,
expires_str
,
event
,
event
,
...
@@ -1727,7 +1756,7 @@ static void send_presence_notify(sofia_profile_t *profile,
...
@@ -1727,7 +1756,7 @@ static void send_presence_notify(sofia_profile_t *profile,
NUTAG_URL
(
contact
),
NUTAG_URL
(
contact
),
SIPTAG_FROM_STR
(
full_to
),
SIPTAG_FROM_STR
(
full_to
),
SIPTAG_TO_STR
(
full_from
),
SIPTAG_TO_STR
(
full_from
),
SIPTAG_CONTACT_STR
(
profile
->
url
),
SIPTAG_CONTACT_STR
(
our_contact
),
SIPTAG_CALL_ID_STR
(
call_id
),
SIPTAG_CALL_ID_STR
(
call_id
),
TAG_IF
(
*
expires_str
,
SIPTAG_EXPIRES_STR
(
expires_str
)),
TAG_IF
(
*
expires_str
,
SIPTAG_EXPIRES_STR
(
expires_str
)),
SIPTAG_SUBSCRIPTION_STATE_STR
(
sstr
),
SIPTAG_SUBSCRIPTION_STATE_STR
(
sstr
),
...
@@ -1740,6 +1769,7 @@ static void send_presence_notify(sofia_profile_t *profile,
...
@@ -1740,6 +1769,7 @@ static void send_presence_notify(sofia_profile_t *profile,
TAG_END
());
TAG_END
());
switch_safe_free
(
route
);
switch_safe_free
(
route
);
switch_safe_free
(
our_contact_dup
);
}
}
...
@@ -2138,6 +2168,12 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2138,6 +2168,12 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
char
*
clean_to_user
=
NULL
;
char
*
clean_to_user
=
NULL
;
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"
);
if
(
call_state
&&
!
strcasecmp
(
call_state
,
"cs_hangup"
))
{
astate
=
"hangup"
;
}
if
(
event_status
&&
!
strncasecmp
(
event_status
,
"hold"
,
4
))
{
if
(
event_status
&&
!
strncasecmp
(
event_status
,
"hold"
,
4
))
{
holding
=
1
;
holding
=
1
;
...
@@ -2202,7 +2238,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2202,7 +2238,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
}
}
//if (strcasecmp(event_status, "Registered")) {
if
(
!
zstr
(
uuid
))
{
if
(
!
zstr
(
uuid
))
{
if
(
!
zstr
(
answer_state
))
{
if
(
!
zstr
(
answer_state
))
{
astate
=
answer_state
;
astate
=
answer_state
;
...
@@ -2328,14 +2363,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2328,14 +2363,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
switch_copy_string
(
helper
->
last_uuid
,
uuid
,
sizeof
(
helper
->
last_uuid
));
switch_copy_string
(
helper
->
last_uuid
,
uuid
,
sizeof
(
helper
->
last_uuid
));
}
}
if
(
zstr
(
astate
))
astate
=
""
;
if
(
!
is_dialog
&&
(
zstr
(
astate
)
||
strcasecmp
(
astate
,
"hangup"
))
)
{
if
(
!
is_dialog
)
{
switch_set_string
(
status_line
,
status
);
switch_set_string
(
status_line
,
status
);
if
(
in
)
{
if
(
in
)
{
open
=
"open"
;
open
=
"open"
;
if
(
switch_false
(
resub
))
{
if
(
switch_false
(
resub
))
{
int
term
;
const
char
*
direction
=
switch_event_get_header
(
helper
->
event
,
"Caller-Direction"
);
const
char
*
direction
=
switch_event_get_header
(
helper
->
event
,
"Caller-Direction"
);
const
char
*
op
,
*
what
=
"Ring"
;
const
char
*
op
,
*
what
=
"Ring"
;
...
@@ -2377,11 +2414,14 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2377,11 +2414,14 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
rpid
=
"on-the-phone"
;
rpid
=
"on-the-phone"
;
force_status
=
1
;
force_status
=
1
;
}
else
if
(
!
strcmp
(
astate
,
"terminated"
))
{
rpid
=
"online"
;
dialog_rpid
=
""
;
force_event_status
=
"Available"
;
term
=
1
;
}
}
if
(
!
term
&&
!
strcmp
(
status
,
"hold"
))
{
if
(
!
strcmp
(
status
,
"hold"
))
{
rpid
=
"on-the-phone"
;
rpid
=
"on-the-phone"
;
if
(
!
zstr
(
op
))
{
if
(
!
zstr
(
op
))
{
switch_snprintf
(
status_line
,
sizeof
(
status_line
),
"Hold %s"
,
op
);
switch_snprintf
(
status_line
,
sizeof
(
status_line
),
"Hold %s"
,
op
);
...
@@ -2441,7 +2481,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2441,7 +2481,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
pl
=
gen_pidf
(
user_agent
,
clean_id
,
profile
->
url
,
open
,
rpid
,
prpid
,
status
,
&
ct
);
pl
=
gen_pidf
(
user_agent
,
clean_id
,
profile
->
url
,
open
,
rpid
,
prpid
,
status
,
&
ct
);
}
}
...
@@ -2455,6 +2494,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
...
@@ -2455,6 +2494,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
}
}
}
}
send_presence_notify
(
profile
,
full_to
,
full_from
,
contact
,
expires
,
call_id
,
event
,
ip
,
port
,
ct
,
pl
,
NULL
);
send_presence_notify
(
profile
,
full_to
,
full_from
,
contact
,
expires
,
call_id
,
event
,
ip
,
port
,
ct
,
pl
,
NULL
);
switch_safe_free
(
free_me
);
switch_safe_free
(
free_me
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论