Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
860d2a6c
提交
860d2a6c
authored
5月 25, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add capture dp app
上级
c1c75952
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
8 行删除
+35
-8
switch_regex.h
src/include/switch_regex.h
+2
-0
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+23
-0
mod_dialplan_xml.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
+1
-8
switch_regex.c
src/switch_regex.c
+9
-0
没有找到文件。
src/include/switch_regex.h
浏览文件 @
860d2a6c
...
...
@@ -73,6 +73,8 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c
SWITCH_DECLARE
(
void
)
switch_capture_regex
(
switch_regex_t
*
re
,
int
match_count
,
const
char
*
field_data
,
int
*
ovector
,
const
char
*
var
,
switch_cap_callback_t
callback
,
void
*
user_data
);
SWITCH_DECLARE
(
void
)
switch_regex_set_var_callback
(
const
char
*
var
,
const
char
*
val
,
void
*
user_data
);
#define switch_regex_safe_free(re) if (re) {\
switch_regex_free(re);\
re = NULL;\
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
860d2a6c
...
...
@@ -2308,6 +2308,26 @@ SWITCH_STANDARD_APP(stop_displace_session_function)
switch_ivr_stop_displace_session
(
session
,
data
);
}
SWITCH_STANDARD_APP
(
capture_function
)
{
char
*
argv
[
3
]
=
{
0
};
int
argc
;
switch_regex_t
*
re
=
NULL
;
int
ovector
[
30
]
=
{
0
};
char
*
lbuf
;
int
proceed
;
if
(
!
zstr
(
data
)
&&
(
lbuf
=
switch_core_session_strdup
(
session
,
data
))
&&
(
argc
=
switch_separate_string
(
lbuf
,
'|'
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
]))))
==
3
)
{
if
((
proceed
=
switch_regex_perform
(
argv
[
1
],
argv
[
2
],
&
re
,
ovector
,
sizeof
(
ovector
)
/
sizeof
(
ovector
[
0
]))))
{
switch_capture_regex
(
re
,
proceed
,
argv
[
1
],
ovector
,
argv
[
0
],
switch_regex_set_var_callback
,
session
);
}
switch_regex_safe_free
(
re
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"No data specified.
\n
"
);
}
}
SWITCH_STANDARD_APP
(
record_function
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
...
...
@@ -3740,6 +3760,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP
(
app_interface
,
"bind_digit_action"
,
"bind a key sequence or regex to an action"
,
"bind a key sequence or regex to an action"
,
bind_digit_action_function
,
BIND_DIGIT_ACTION_USAGE
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"capture"
,
"capture data into a var"
,
"capture data into a var"
,
capture_function
,
"<varname>|<data>|<regex>"
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"clear_digit_action"
,
"clear all digit bindings"
,
""
,
clear_digit_action_function
,
CLEAR_DIGIT_ACTION_USAGE
,
SAF_SUPPORT_NOMEDIA
);
...
...
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
浏览文件 @
860d2a6c
...
...
@@ -79,13 +79,6 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
return
status
;
}
static
void
set_var_callback
(
const
char
*
var
,
const
char
*
val
,
void
*
user_data
)
{
switch_core_session_t
*
session
=
(
switch_core_session_t
*
)
user_data
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_add_variable_var_check
(
channel
,
var
,
val
,
SWITCH_FALSE
,
SWITCH_STACK_PUSH
);
}
static
int
parse_exten
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
caller_profile
,
switch_xml_t
xexten
,
switch_caller_extension_t
**
extension
)
{
switch_xml_t
xcond
,
xaction
,
xexpression
;
...
...
@@ -231,7 +224,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
}
else
{
if
(
field
&&
strchr
(
expression
,
'('
))
{
switch_channel_set_variable
(
channel
,
"DP_MATCH"
,
NULL
);
switch_capture_regex
(
re
,
proceed
,
field_data
,
ovector
,
"DP_MATCH"
,
set_var_callback
,
session
);
switch_capture_regex
(
re
,
proceed
,
field_data
,
ovector
,
"DP_MATCH"
,
s
witch_regex_s
et_var_callback
,
session
);
}
for
(
xaction
=
switch_xml_child
(
xcond
,
"action"
);
xaction
;
xaction
=
xaction
->
next
)
{
...
...
src/switch_regex.c
浏览文件 @
860d2a6c
...
...
@@ -249,6 +249,15 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(const char *target, const cha
return
switch_regex_match_partial
(
target
,
expression
,
&
partial
);
}
SWITCH_DECLARE
(
void
)
switch_regex_set_var_callback
(
const
char
*
var
,
const
char
*
val
,
void
*
user_data
)
{
switch_core_session_t
*
session
=
(
switch_core_session_t
*
)
user_data
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_add_variable_var_check
(
channel
,
var
,
val
,
SWITCH_FALSE
,
SWITCH_STACK_PUSH
);
}
/* For Emacs:
* Local Variables:
* mode:c
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论