Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
4ee1722f
提交
4ee1722f
authored
10月 22, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add presence_map
上级
4ceca189
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
76 行增加
和
0 行删除
+76
-0
internal.xml
conf/sip_profiles/internal.xml
+3
-0
switch_ivr.h
src/include/switch_ivr.h
+1
-0
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+1
-0
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+12
-0
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+8
-0
switch_ivr.c
src/switch_ivr.c
+51
-0
没有找到文件。
conf/sip_profiles/internal.xml
浏览文件 @
4ee1722f
...
...
@@ -43,6 +43,9 @@
<!-- <param name="shutdown-on-fail" value="true"/> -->
<param
name=
"sip-trace"
value=
"no"
/>
<param
name=
"sip-capture"
value=
"no"
/>
<!-- Use presence_map.conf.xml to convert extension regex to presence protos for routing -->
<!-- <param name="presence-proto-lookup" value="true"/> -->
<!-- Don't be picky about negotiated DTMF just always offer 2833 and accept both 2833 and INFO -->
...
...
src/include/switch_ivr.h
浏览文件 @
4ee1722f
...
...
@@ -933,6 +933,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_insert_file
(
switch_core_session_t
*
session
,
const
char
*
file
,
const
char
*
insert_file
,
switch_size_t
sample_point
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_create_message_reply
(
switch_event_t
**
reply
,
switch_event_t
*
message
,
const
char
*
new_proto
);
SWITCH_DECLARE
(
char
*
)
switch_ivr_check_presence_mapping
(
const
char
*
exten_name
,
const
char
*
domain_name
);
/** @} */
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
4ee1722f
...
...
@@ -253,6 +253,7 @@ typedef enum {
PFLAG_AUTO_ASSIGN_PORT
,
PFLAG_AUTO_ASSIGN_TLS_PORT
,
PFLAG_SHUTDOWN
,
PFLAG_PRESENCE_MAP
,
/* No new flags below this line */
PFLAG_MAX
}
PFLAGS
;
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
4ee1722f
...
...
@@ -2875,6 +2875,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
}
else
{
sofia_clear_pflag
(
profile
,
PFLAG_LOG_AUTH_FAIL
);
}
}
else
if
(
!
strcasecmp
(
var
,
"presence-proto-lookup"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_PRESENCE_MAP
);
}
else
{
sofia_clear_pflag
(
profile
,
PFLAG_PRESENCE_MAP
);
}
}
else
if
(
!
strcasecmp
(
var
,
"liberal-dtmf"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_LIBERAL_DTMF
);
...
...
@@ -3590,6 +3596,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
}
else
{
sofia_clear_pflag
(
profile
,
PFLAG_LOG_AUTH_FAIL
);
}
}
else
if
(
!
strcasecmp
(
var
,
"presence-proto-lookup"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_PRESENCE_MAP
);
}
else
{
sofia_clear_pflag
(
profile
,
PFLAG_PRESENCE_MAP
);
}
}
else
if
(
!
strcasecmp
(
var
,
"liberal-dtmf"
))
{
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_LIBERAL_DTMF
);
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
4ee1722f
...
...
@@ -2632,6 +2632,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
char
*
my_to_user
=
NULL
;
char
*
sql
,
*
event
=
NULL
;
char
*
proto
=
"sip"
;
char
*
alt_proto
=
NULL
;
char
*
d_user
=
NULL
;
char
*
contact_str
=
""
;
const
char
*
call_id
=
NULL
;
...
...
@@ -2647,6 +2648,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
const
char
*
ipv6
;
const
char
*
contact_user
;
sofia_nat_parse_t
np
=
{
{
0
}
};
int
found_proto
=
0
;
if
(
!
sip
)
{
return
;
...
...
@@ -2730,6 +2732,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
nua_respond
(
nh
,
SIP_404_NOT_FOUND
,
NUTAG_WITH_THIS_MSG
(
de
->
data
->
e_msg
),
TAG_END
());
goto
end
;
}
found_proto
++
;
}
call_id
=
sip
->
sip_call_id
->
i_id
;
...
...
@@ -2740,6 +2744,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
sip
->
sip_expires
->
ex_delta
=
31536000
;
}
if
(
sofia_test_pflag
(
profile
,
PFLAG_PRESENCE_MAP
)
&&
!
found_proto
&&
(
alt_proto
=
switch_ivr_check_presence_mapping
(
to_user
,
to_host
)))
{
proto
=
alt_proto
;
}
if
((
sub_state
==
nua_substate_active
)
&&
(
switch_stristr
(
"dialog"
,
(
const
char
*
)
event
)))
{
...
...
@@ -3047,6 +3054,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
switch_safe_free
(
d_user
);
switch_safe_free
(
to_str
);
switch_safe_free
(
contact_str
);
switch_safe_free
(
alt_proto
);
if
(
!
sent_reply
)
{
nua_respond
(
nh
,
481
,
"INVALID SUBSCRIPTION"
,
TAG_END
());
...
...
src/switch_ivr.c
浏览文件 @
4ee1722f
...
...
@@ -3137,6 +3137,57 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_create_message_reply(switch_event_t *
return
status
;
}
SWITCH_DECLARE
(
char
*
)
switch_ivr_check_presence_mapping
(
const
char
*
exten_name
,
const
char
*
domain_name
)
{
char
*
cf
=
"presence_map.conf"
;
switch_xml_t
cfg
,
xml
,
x_domains
,
x_domain
,
x_exten
;
char
*
r
=
NULL
;
switch_regex_t
*
re
=
NULL
;
int
proceed
=
0
,
ovector
[
100
];
if
(
!
(
xml
=
switch_xml_open_cfg
(
cf
,
&
cfg
,
NULL
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Open of %s failed
\n
"
,
cf
);
return
NULL
;
}
if
(
!
(
x_domains
=
switch_xml_child
(
cfg
,
"domains"
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't find any domains!
\n
"
);
return
NULL
;
}
for
(
x_domain
=
switch_xml_child
(
x_domains
,
"domain"
);
x_domain
;
x_domain
=
x_domain
->
next
)
{
const
char
*
dname
=
switch_xml_attr
(
x_domain
,
"name"
);
if
(
!
dname
||
strcasecmp
(
domain_name
,
dname
))
continue
;
for
(
x_exten
=
switch_xml_child
(
x_domain
,
"exten"
);
x_exten
;
x_exten
=
x_exten
->
next
)
{
const
char
*
regex
=
switch_xml_attr
(
x_exten
,
"regex"
);
const
char
*
proto
=
switch_xml_attr
(
x_exten
,
"proto"
);
if
(
regex
&&
proto
)
{
proceed
=
switch_regex_perform
(
exten_name
,
regex
,
&
re
,
ovector
,
sizeof
(
ovector
)
/
sizeof
(
ovector
[
0
]));
switch_regex_safe_free
(
re
);
if
(
proceed
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"Mapping %s@%s to proto %s matching expression [%s]
\n
"
,
exten_name
,
domain_name
,
proto
,
regex
);
r
=
strdup
(
proto
);
goto
end
;
}
}
}
}
end
:
if
(
xml
)
{
switch_xml_free
(
xml
);
}
return
r
;
}
/* For Emacs:
* Local Variables:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论