Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9b488fbf
提交
9b488fbf
authored
6月 04, 2012
作者:
Raymond Chandler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pnp
上级
d2bc9a2b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
64 行增加
和
4 行删除
+64
-4
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+5
-1
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+24
-0
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+35
-3
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
9b488fbf
...
...
@@ -28,6 +28,7 @@
* Paul D. Tinsley <pdt at jackhammer.org>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
* Raymond Chandler <intralanman@gmail.com>
*
*
* mod_sofia.h -- SOFIA SIP Endpoint
...
...
@@ -517,7 +518,8 @@ struct sofia_gateway {
typedef
enum
{
PRES_TYPE_NONE
=
0
,
PRES_TYPE_FULL
=
1
,
PRES_TYPE_PASSIVE
=
2
PRES_TYPE_PASSIVE
=
2
,
PRES_TYPE_PNP
=
3
}
sofia_presence_type_t
;
typedef
enum
{
...
...
@@ -586,6 +588,8 @@ struct sofia_profile {
char
*
rtcp_audio_interval_msec
;
char
*
rtcp_video_interval_msec
;
char
*
jb_msec
;
char
*
pnp_prov_url
;
char
*
pnp_notify_profile
;
sofia_cid_type_t
cid_type
;
sofia_dtmf_t
dtmf_type
;
int
auto_restart
;
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
9b488fbf
...
...
@@ -2138,6 +2138,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")),
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")),
TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")),
TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")),
NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
...
...
@@ -4417,10 +4418,16 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else if (!strcasecmp(val, "bypass-media-after-att-xfer")) {
profile->media_options |= MEDIA_OPT_BYPASS_AFTER_ATT_XFER;
}
} else if (!strcasecmp(var, "pnp-provision-url")) {
profile->pnp_prov_url = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "pnp-notify-profile")) {
profile->pnp_notify_profile = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "manage-presence")) {
if (!strcasecmp(val, "passive")) {
profile->pres_type = PRES_TYPE_PASSIVE;
} else if (!strcasecmp(val, "pnp")) {
profile->pres_type = PRES_TYPE_PNP;
} else if (switch_true(val)) {
profile->pres_type = PRES_TYPE_FULL;
}
...
...
@@ -4875,6 +4882,23 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
}
if (profile->pres_type == PRES_TYPE_PNP) {
if (!profile->pnp_prov_url) {
profile->pnp_prov_url = switch_core_sprintf(profile->pool, "http://%s/provision/", mod_sofia_globals.guess_ip);
}
if (!profile->pnp_notify_profile) {
profile->pnp_notify_profile = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
if (!profile->extsipip) {
profile->extsipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "we're configured to provision to [%s] on profile [%s]\n",
profile->pnp_prov_url, profile->pnp_notify_profile);
}
config_sofia_profile_urls(profile);
if (sofia_test_pflag(profile, PFLAG_TLS) && !profile->tls_cert_dir) {
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
9b488fbf
...
...
@@ -27,6 +27,7 @@
* Ken Rice <krice@freeswitch.org>
* Paul D. Tinsley <pdt at jackhammer.org>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Raymond Chandler <intralanman@gmail.com>
*
*
* sofia_presence.c -- SOFIA SIP Endpoint (presence code)
...
...
@@ -3273,7 +3274,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
int
sent_reply
=
0
;
sip_contact_t
const
*
contact
;
const
char
*
ipv6
;
const
char
*
contact_user
;
const
char
*
contact_user
=
NULL
;
const
char
*
contact_host
=
NULL
;
const
char
*
contact_port
=
NULL
;
sofia_nat_parse_t
np
=
{
{
0
}
};
int
found_proto
=
0
;
char
to_tag
[
13
]
=
""
;
...
...
@@ -3295,8 +3298,11 @@ void sofia_presence_handle_sip_i_subscribe(int status,
switch_stun_random_string
(
to_tag
,
12
,
NULL
);
//contact_host = sip->sip_contact->m_url->url_host;
contact_user
=
sip
->
sip_contact
->
m_url
->
url_user
;
if
(
sip
->
sip_contact
&&
sip
->
sip_contact
->
m_url
)
{
contact_host
=
sip
->
sip_contact
->
m_url
->
url_host
;
contact_port
=
sip
->
sip_contact
->
m_url
->
url_port
;
contact_user
=
sip
->
sip_contact
->
m_url
->
url_user
;
}
//tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
...
...
@@ -3645,6 +3651,32 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
}
if
(
sip
->
sip_event
&&
sip
->
sip_event
->
o_type
&&
!
strcasecmp
(
sip
->
sip_event
->
o_type
,
"ua-profile"
)
&&
contact_host
)
{
switch_event_t
*
params
;
char
*
uri
=
NULL
;
if
(
contact_port
)
{
uri
=
switch_mprintf
(
"sip:%s:%s"
,
contact_host
,
contact_port
);
}
else
{
uri
=
switch_mprintf
(
"sip:%s"
,
contact_host
);
}
if
(
uri
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"sending pnp NOTIFY to %s
\n
"
,
uri
);
switch_event_create
(
&
params
,
SWITCH_EVENT_NOTIFY
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"profile"
,
profile
->
pnp_notify_profile
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"event-string"
,
sip
->
sip_event
->
o_type
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"to-uri"
,
uri
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"from-uri"
,
uri
);
switch_event_add_header_string
(
params
,
SWITCH_STACK_BOTTOM
,
"content-type"
,
"application/url"
);
switch_event_add_body
(
params
,
profile
->
pnp_prov_url
);
switch_event_fire
(
&
params
);
switch_safe_free
(
uri
);
}
}
end:
if
(
strcasecmp
(
event
,
"call-info"
)
&&
strcasecmp
(
event
,
"line-seize"
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论