Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
460298ff
提交
460298ff
authored
12月 13, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@6773
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
bf3dd13e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
67 行增加
和
6 行删除
+67
-6
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+2
-2
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+65
-4
没有找到文件。
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
460298ff
...
...
@@ -1736,7 +1736,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
switch_odbc_handle_exec
(
profile
->
master_odbc
,
reg_sql
,
NULL
);
}
if
(
switch_odbc_handle_exec
(
profile
->
master_odbc
,
"
delete from sip_subscriptions where sip_user !
= ''"
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
if
(
switch_odbc_handle_exec
(
profile
->
master_odbc
,
"
select * from sip_subscriptions where sip_user =
= ''"
,
NULL
)
!=
SWITCH_ODBC_SUCCESS
)
{
switch_odbc_handle_exec
(
profile
->
master_odbc
,
"DROP TABLE sip_subscriptions"
,
NULL
);
switch_odbc_handle_exec
(
profile
->
master_odbc
,
sub_sql
,
NULL
);
}
...
...
@@ -1754,7 +1754,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
}
switch_core_db_test_reactive
(
profile
->
master_db
,
"select sip_user from sip_registrations"
,
"DROP TABLE sip_registrations"
,
reg_sql
);
switch_core_db_test_reactive
(
profile
->
master_db
,
"
delete from sip_subscriptions where sip_user !
= ''"
,
"DROP TABLE sip_subscriptions"
,
sub_sql
);
switch_core_db_test_reactive
(
profile
->
master_db
,
"
select * from sip_subscriptions where sip_user =
= ''"
,
"DROP TABLE sip_subscriptions"
,
sub_sql
);
switch_core_db_test_reactive
(
profile
->
master_db
,
"select * from sip_authentication"
,
"DROP TABLE sip_authentication"
,
auth_sql
);
}
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
460298ff
...
...
@@ -35,6 +35,7 @@
#include "mod_sofia.h"
static
int
sofia_presence_mwi_callback
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
);
static
int
sofia_presence_mwi_callback2
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
);
static
int
sofia_presence_sub_reg_callback
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
);
static
int
sofia_presence_resub_callback
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
);
static
int
sofia_presence_sub_callback
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
);
...
...
@@ -182,7 +183,8 @@ void 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
;
switch_assert
(
event
!=
NULL
);
if
(
!
(
account
=
switch_event_get_header
(
event
,
"mwi-message-account"
)))
{
...
...
@@ -224,7 +226,7 @@ void sofia_presence_mwi_event_handler(switch_event_t *event)
sql
=
switch_mprintf
(
"select *,'%q' from sip_subscriptions where event='message-summary' and sub_to_user='%q' and sub_to_host='%q'"
,
stream
.
data
,
user
,
host
);
switch_safe_free
(
stream
.
data
);
switch_assert
(
sql
!=
NULL
);
sofia_glue_execute_sql_callback
(
profile
,
...
...
@@ -232,9 +234,31 @@ void sofia_presence_mwi_event_handler(switch_event_t *event)
profile
->
ireg_mutex
,
sql
,
sofia_presence_mwi_callback
,
profile
);
&
count
);
switch_safe_free
(
sql
);
if
(
!
count
)
{
sql
=
switch_mprintf
(
"select *,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'"
,
stream
.
data
,
user
,
host
);
switch_assert
(
sql
!=
NULL
);
sofia_glue_execute_sql_callback
(
profile
,
SWITCH_FALSE
,
profile
->
ireg_mutex
,
sql
,
sofia_presence_mwi_callback2
,
profile
);
switch_safe_free
(
sql
);
}
switch_safe_free
(
stream
.
data
);
switch_safe_free
(
dup_account
);
if
(
profile
)
{
sofia_glue_release_profile
(
profile
);
...
...
@@ -622,6 +646,7 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
char
*
id
=
NULL
;
nua_handle_t
*
nh
;
int
expire_sec
=
atoi
(
expires
);
int
*
total
=
(
int
*
)
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
);
...
...
@@ -643,10 +668,46 @@ static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char *
nua_notify
(
nh
,
SIPTAG_SUBSCRIPTION_STATE_STR
(
exp
),
SIPTAG_EVENT_STR
(
event
),
SIPTAG_CONTENT_TYPE_STR
(
"application/simple-message-summary"
),
SIPTAG_PAYLOAD_STR
(
body
),
TAG_END
());
switch_safe_free
(
id
);
switch_safe_free
(
exp
);
sofia_glue_release_profile
(
profile
);
*
total
++
;
return
0
;
}
static
int
sofia_presence_mwi_callback2
(
void
*
pArg
,
int
argc
,
char
**
argv
,
char
**
columnNames
)
{
char
*
sub_to_user
=
argv
[
1
];
char
*
sub_to_host
=
argv
[
2
];
char
*
event
=
"message-summary"
;
char
*
body
=
argv
[
7
];
sofia_profile_t
*
profile
=
NULL
;
char
*
id
=
NULL
;
nua_handle_t
*
nh
;
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
);
nh
=
nua_handle
(
profile
->
nua
,
NULL
,
SIPTAG_FROM_STR
(
id
),
SIPTAG_TO_STR
(
id
),
SIPTAG_CONTACT_STR
(
profile
->
url
),
TAG_END
());
nua_notify
(
nh
,
NUTAG_NEWSUB
(
1
),
SIPTAG_EVENT_STR
(
event
),
SIPTAG_CONTENT_TYPE_STR
(
"application/simple-message-summary"
),
SIPTAG_PAYLOAD_STR
(
body
),
TAG_END
());
switch_safe_free
(
id
);
sofia_glue_release_profile
(
profile
);
return
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论