Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
16f5637f
提交
16f5637f
authored
5月 08, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@8303
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
6231ceb0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
63 行增加
和
34 行删除
+63
-34
mod_voicemail.c
src/mod/applications/mod_voicemail/mod_voicemail.c
+17
-5
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+44
-29
sofia_reg.c
src/mod/endpoints/mod_sofia/sofia_reg.c
+2
-0
没有找到文件。
src/mod/applications/mod_voicemail/mod_voicemail.c
浏览文件 @
16f5637f
...
...
@@ -2156,7 +2156,7 @@ SWITCH_STANDARD_APP(voicemail_function)
static
void
message_query_handler
(
switch_event_t
*
event
)
{
char
*
account
=
switch_event_get_header
(
event
,
"message-account"
);
int
sent
=
0
;
int
created
=
0
;
switch_event_t
*
new_event
=
NULL
;
if
(
account
)
{
...
...
@@ -2194,8 +2194,7 @@ static void message_query_handler(switch_event_t *event)
switch_event_add_header
(
new_event
,
SWITCH_STACK_BOTTOM
,
"MWI-Message-Account"
,
account
);
switch_event_add_header
(
new_event
,
SWITCH_STACK_BOTTOM
,
"MWI-Voice-Message"
,
"%d/%d (%d/%d)"
,
total_new_messages
,
total_saved_messages
,
total_new_urgent_messages
,
total_saved_urgent_messages
);
switch_event_fire
(
&
new_event
);
sent
++
;
created
++
;
}
}
}
...
...
@@ -2205,13 +2204,26 @@ static void message_query_handler(switch_event_t *event)
}
if
(
!
sent
)
{
if
(
!
created
)
{
if
(
switch_event_create
(
&
new_event
,
SWITCH_EVENT_MESSAGE_WAITING
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
new_event
,
SWITCH_STACK_BOTTOM
,
"MWI-Messages-Waiting"
,
"no"
);
switch_event_add_header
(
new_event
,
SWITCH_STACK_BOTTOM
,
"MWI-Message-Account"
,
account
);
switch_event_fire
(
&
new_event
);
}
}
if
(
new_event
)
{
switch_event_header_t
*
hp
;
for
(
hp
=
event
->
headers
;
hp
;
hp
=
hp
->
next
)
{
if
(
!
strncasecmp
(
hp
->
name
,
"vm-"
,
3
))
{
switch_event_add_header
(
new_event
,
SWITCH_STACK_BOTTOM
,
hp
->
name
+
3
,
hp
->
value
);
}
}
switch_event_fire
(
&
new_event
);
}
}
#define VOICEMAIL_SYNTAX "rss [<host> <port> <uri> <user> <domain>]"
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
16f5637f
...
...
@@ -188,6 +188,11 @@ char *sofia_presence_translate_rpid(char *in, char *ext)
return
r
;
}
struct
mwi_helper
{
sofia_profile_t
*
profile
;
int
total
;
};
static
void
actual_sofia_presence_mwi_event_handler
(
switch_event_t
*
event
)
{
char
*
account
,
*
dup_account
,
*
yn
,
*
host
,
*
user
;
...
...
@@ -195,8 +200,9 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
sofia_profile_t
*
profile
=
NULL
;
switch_stream_handle_t
stream
=
{
0
};
switch_event_header_t
*
hp
;
int
count
=
0
;
struct
mwi_helper
h
=
{
0
};
char
*
pname
=
NULL
;
switch_assert
(
event
!=
NULL
);
if
(
!
(
account
=
switch_event_get_header
(
event
,
"mwi-message-account"
)))
{
...
...
@@ -213,11 +219,31 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
switch_assert
(
dup_account
!=
NULL
);
sofia_glue_get_user_host
(
dup_account
,
&
user
,
&
host
);
if
(
!
host
||
!
(
profile
=
sofia_glue_find_profile
(
host
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find profile for host %s
\n
"
,
switch_str_nil
(
host
));
return
;
if
((
pname
=
switch_event_get_header
(
event
,
"sofia-profile"
)))
{
if
((
profile
=
sofia_glue_find_profile
(
pname
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"using profile %s
\n
"
,
pname
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"no profile %s
\n
"
,
pname
);
}
}
if
(
!
profile
)
{
if
(
!
host
||
!
(
profile
=
sofia_glue_find_profile
(
host
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find profile %s
\n
"
,
switch_str_nil
(
host
));
switch_safe_free
(
dup_account
);
return
;
}
}
if
(
profile
->
domain_name
&&
profile
->
domain_name
!=
host
)
{
host
=
profile
->
domain_name
;
}
h
.
profile
=
profile
;
h
.
total
=
0
;
SWITCH_STANDARD_STREAM
(
stream
);
for
(
hp
=
event
->
headers
;
hp
;
hp
=
hp
->
next
)
{
...
...
@@ -239,19 +265,18 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
stream
.
data
,
user
,
host
);
switch_assert
(
sql
!=
NULL
);
sofia_glue_execute_sql_callback
(
profile
,
SWITCH_FALSE
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_mwi_callback
,
&
count
);
&
h
);
switch_safe_free
(
sql
);
if
(
!
count
)
{
if
(
h
.
total
)
{
sql
=
switch_mprintf
(
"select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'"
,
stream
.
data
,
user
,
host
);
...
...
@@ -263,7 +288,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
profile
->
ireg_mutex
,
sql
,
sofia_presence_mwi_callback2
,
profile
);
&
h
);
switch_safe_free
(
sql
);
}
...
...
@@ -640,6 +665,7 @@ static int sofia_presence_sub_reg_callback(void *pArg, int argc, char **argv, ch
if
(
!
strcasecmp
(
event_name
,
"message-summary"
))
{
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MESSAGE_QUERY
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Message-Account"
,
"sip:%s@%s"
,
user
,
host
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"VM-Sofia-Profile"
,
"%s"
,
profile
->
name
);
switch_event_fire
(
&
event
);
}
return
0
;
...
...
@@ -1073,18 +1099,15 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
char
*
expires
=
argv
[
10
];
char
*
body
=
argv
[
13
];
char
*
exp
;
sofia_profile_t
*
profile
=
NULL
;
//
sofia_profile_t *profile = NULL;
char
*
id
=
NULL
;
nua_handle_t
*
nh
;
int
expire_sec
=
atoi
(
expires
);
int
*
total
=
(
int
*
)
pArg
;
//int *total = (int *) pArg;
struct
mwi_helper
*
h
=
(
struct
mwi_helper
*
)
pArg
;
if
(
!
(
profile
=
sofia_glue_find_profile
(
sub_to_host
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find profile for host %s
\n
"
,
sub_to_host
);
return
0
;
}
if
(
!
(
nh
=
nua_handle_by_call_id
(
profile
->
nua
,
call_id
)))
{
if
(
!
(
nh
=
nua_handle_by_call_id
(
h
->
profile
->
nua
,
call_id
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find handle for %s
\n
"
,
call_id
);
return
0
;
}
...
...
@@ -1103,8 +1126,7 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
switch_safe_free
(
id
);
switch_safe_free
(
exp
);
sofia_glue_release_profile
(
profile
);
(
*
total
)
++
;
h
->
total
++
;
return
0
;
}
...
...
@@ -1118,25 +1140,20 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char
char
*
event
=
"message-summary"
;
char
*
contact
=
argv
[
2
];
char
*
body
=
argv
[
3
];
sofia_profile_t
*
profile
=
NULL
;
char
*
id
=
NULL
;
nua_handle_t
*
nh
;
struct
mwi_helper
*
h
=
(
struct
mwi_helper
*
)
pArg
;
if
(
!
(
profile
=
sofia_glue_find_profile
(
sub_to_host
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot find profile for host %s
\n
"
,
sub_to_host
);
return
0
;
}
id
=
switch_mprintf
(
"sip:%s@%s"
,
sub_to_user
,
sub_to_host
);
contact
=
sofia_glue_get_url_from_contact
(
contact
,
0
);
nh
=
nua_handle
(
profile
->
nua
,
NULL
,
nh
=
nua_handle
(
h
->
profile
->
nua
,
NULL
,
NUTAG_URL
(
contact
),
SIPTAG_FROM_STR
(
id
),
SIPTAG_TO_STR
(
id
),
SIPTAG_CONTACT_STR
(
profile
->
url
),
SIPTAG_CONTACT_STR
(
h
->
profile
->
url
),
TAG_END
());
nua_notify
(
nh
,
...
...
@@ -1145,8 +1162,6 @@ static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char
switch_safe_free
(
id
);
sofia_glue_release_profile
(
profile
);
return
0
;
}
...
...
src/mod/endpoints/mod_sofia/sofia_reg.c
浏览文件 @
16f5637f
...
...
@@ -688,12 +688,14 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
if
(
regtype
==
REG_REGISTER
)
{
char
*
new_contact
=
NULL
;
if
(
exptime
)
{
new_contact
=
switch_mprintf
(
"%s;expires=%ld"
,
contact_str
,
(
long
)
exptime
);
nua_respond
(
nh
,
SIP_200_OK
,
SIPTAG_CONTACT_STR
(
new_contact
),
NUTAG_WITH_THIS
(
nua
),
TAG_END
());
switch_safe_free
(
new_contact
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MESSAGE_QUERY
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Message-Account"
,
"sip:%s@%s"
,
to_user
,
to_host
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"VM-Sofia-Profile"
,
"%s"
,
profile
->
name
);
switch_event_fire
(
&
event
);
}
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论