Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d82a7c7a
提交
d82a7c7a
authored
9月 02, 2008
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cleanup
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@9401
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
987f1b26
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
25 行删除
+22
-25
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+3
-3
switch_ivr_menu.c
src/switch_ivr_menu.c
+19
-22
没有找到文件。
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
d82a7c7a
...
@@ -1110,7 +1110,7 @@ SWITCH_STANDARD_APP(ivr_application_function)
...
@@ -1110,7 +1110,7 @@ SWITCH_STANDARD_APP(ivr_application_function)
if
(
channel
)
{
if
(
channel
)
{
switch_xml_t
cxml
=
NULL
,
cfg
=
NULL
,
xml_menus
=
NULL
,
xml_menu
=
NULL
;
switch_xml_t
cxml
=
NULL
,
cfg
=
NULL
,
xml_menus
=
NULL
,
xml_menu
=
NULL
;
/
/ Open the config from the xml registry
/
* Open the config from the xml registry */
switch_event_create
(
&
params
,
SWITCH_EVENT_MESSAGE
);
switch_event_create
(
&
params
,
SWITCH_EVENT_MESSAGE
);
switch_assert
(
params
);
switch_assert
(
params
);
switch_channel_event_set_data
(
channel
,
params
);
switch_channel_event_set_data
(
channel
,
params
);
...
@@ -1119,12 +1119,12 @@ SWITCH_STANDARD_APP(ivr_application_function)
...
@@ -1119,12 +1119,12 @@ SWITCH_STANDARD_APP(ivr_application_function)
if
((
xml_menus
=
switch_xml_child
(
cfg
,
"menus"
)))
{
if
((
xml_menus
=
switch_xml_child
(
cfg
,
"menus"
)))
{
xml_menu
=
switch_xml_find_child
(
xml_menus
,
"menu"
,
"name"
,
(
char
*
)
data
);
xml_menu
=
switch_xml_find_child
(
xml_menus
,
"menu"
,
"name"
,
(
char
*
)
data
);
/
/ if the menu was found
/
* if the menu was found */
if
(
xml_menu
!=
NULL
)
{
if
(
xml_menu
!=
NULL
)
{
switch_ivr_menu_xml_ctx_t
*
xml_ctx
=
NULL
;
switch_ivr_menu_xml_ctx_t
*
xml_ctx
=
NULL
;
switch_ivr_menu_t
*
menu_stack
=
NULL
;
switch_ivr_menu_t
*
menu_stack
=
NULL
;
/
/ build a menu tree and execute it
/
* build a menu tree and execute it */
if
(
switch_ivr_menu_stack_xml_init
(
&
xml_ctx
,
NULL
)
==
SWITCH_STATUS_SUCCESS
if
(
switch_ivr_menu_stack_xml_init
(
&
xml_ctx
,
NULL
)
==
SWITCH_STATUS_SUCCESS
#ifdef _TEST_CALLBACK_
#ifdef _TEST_CALLBACK_
&&
switch_ivr_menu_stack_xml_add_custom
(
xml_ctx
,
"custom"
,
&
menu_handler
)
==
SWITCH_STATUS_SUCCESS
&&
switch_ivr_menu_stack_xml_add_custom
(
xml_ctx
,
"custom"
,
&
menu_handler
)
==
SWITCH_STATUS_SUCCESS
...
...
src/switch_ivr_menu.c
浏览文件 @
d82a7c7a
...
@@ -481,8 +481,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
...
@@ -481,8 +481,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
}
}
}
}
if
(
switch_test_flag
(
menu
,
SWITCH_IVR_MENU_FLAG_STACK
))
{
// top level
if
(
switch_test_flag
(
menu
,
SWITCH_IVR_MENU_FLAG_STACK
))
{
/* top level */
if
(
switch_test_flag
(
stack
,
SWITCH_IVR_MENU_FLAG_FALLTOMAIN
))
{
/
/ catch the fallback and recover
if
(
switch_test_flag
(
stack
,
SWITCH_IVR_MENU_FLAG_FALLTOMAIN
))
{
/
* catch the fallback and recover */
switch_clear_flag
(
stack
,
SWITCH_IVR_MENU_FLAG_FALLTOMAIN
);
switch_clear_flag
(
stack
,
SWITCH_IVR_MENU_FLAG_FALLTOMAIN
);
status
=
SWITCH_STATUS_SUCCESS
;
status
=
SWITCH_STATUS_SUCCESS
;
running
=
1
;
running
=
1
;
...
@@ -552,7 +552,7 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
...
@@ -552,7 +552,7 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
{
{
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
/
/ if this action/function does not exist yet
/
* if this action/function does not exist yet */
if
(
xml_ctx
!=
NULL
&&
name
!=
NULL
&&
xml_ctx
->
pool
!=
NULL
&&
switch_ivr_menu_stack_xml_find
(
xml_ctx
,
name
)
==
NULL
)
{
if
(
xml_ctx
!=
NULL
&&
name
!=
NULL
&&
xml_ctx
->
pool
!=
NULL
&&
switch_ivr_menu_stack_xml_find
(
xml_ctx
,
name
)
==
NULL
)
{
switch_ivr_menu_xml_map_t
*
map
=
switch_core_alloc
(
xml_ctx
->
pool
,
sizeof
(
switch_ivr_menu_xml_map_t
));
switch_ivr_menu_xml_map_t
*
map
=
switch_core_alloc
(
xml_ctx
->
pool
,
sizeof
(
switch_ivr_menu_xml_map_t
));
...
@@ -562,7 +562,7 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
...
@@ -562,7 +562,7 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
map
->
function
=
function
;
map
->
function
=
function
;
if
(
map
->
name
!=
NULL
)
{
if
(
map
->
name
!=
NULL
)
{
/
/ insert map item at top of list
/
* insert map item at top of list */
map
->
next
=
xml_ctx
->
map
;
map
->
next
=
xml_ctx
->
map
;
xml_ctx
->
map
=
map
;
xml_ctx
->
map
=
map
;
status
=
SWITCH_STATUS_SUCCESS
;
status
=
SWITCH_STATUS_SUCCESS
;
...
@@ -581,7 +581,6 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
...
@@ -581,7 +581,6 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *
return
status
;
return
status
;
}
}
static
struct
iam_s
{
static
struct
iam_s
{
const
char
*
name
;
const
char
*
name
;
switch_ivr_action_t
action
;
switch_ivr_action_t
action
;
...
@@ -595,7 +594,6 @@ static struct iam_s {
...
@@ -595,7 +594,6 @@ static struct iam_s {
{
NULL
,
0
}
{
NULL
,
0
}
};
};
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_menu_str2action
(
const
char
*
action_name
,
switch_ivr_action_t
*
action
)
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_menu_str2action
(
const
char
*
action_name
,
switch_ivr_action_t
*
action
)
{
{
int
i
;
int
i
;
...
@@ -616,7 +614,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_na
...
@@ -616,7 +614,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_na
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
static
switch_bool_t
is_valid_action
(
const
char
*
action
)
static
switch_bool_t
is_valid_action
(
const
char
*
action
)
{
{
int
i
;
int
i
;
...
@@ -642,12 +639,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_x
...
@@ -642,12 +639,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_x
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
int
autocreated
=
0
;
int
autocreated
=
0
;
/
/ build a memory pool ?
/
* build a memory pool ? */
if
(
pool
==
NULL
)
{
if
(
pool
==
NULL
)
{
status
=
switch_core_new_memory_pool
(
&
pool
);
status
=
switch_core_new_memory_pool
(
&
pool
);
autocreated
=
1
;
autocreated
=
1
;
}
}
/
/ allocate the xml context
/
* allocate the xml context */
if
(
xml_menu_ctx
!=
NULL
&&
pool
!=
NULL
)
{
if
(
xml_menu_ctx
!=
NULL
&&
pool
!=
NULL
)
{
*
xml_menu_ctx
=
switch_core_alloc
(
pool
,
sizeof
(
switch_ivr_menu_xml_ctx_t
));
*
xml_menu_ctx
=
switch_core_alloc
(
pool
,
sizeof
(
switch_ivr_menu_xml_ctx_t
));
if
(
*
xml_menu_ctx
!=
NULL
)
{
if
(
*
xml_menu_ctx
!=
NULL
)
{
...
@@ -660,7 +657,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_x
...
@@ -660,7 +657,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_x
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
}
}
}
}
/
/ build the standard/default xml menu handler mappings
/
* build the standard/default xml menu handler mappings */
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
xml_menu_ctx
!=
NULL
&&
*
xml_menu_ctx
!=
NULL
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
xml_menu_ctx
!=
NULL
&&
*
xml_menu_ctx
!=
NULL
)
{
int
i
;
int
i
;
...
@@ -684,13 +681,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
...
@@ -684,13 +681,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
if
(
xml_menu_ctx
!=
NULL
&&
menu_stack
!=
NULL
&&
xml_menu
!=
NULL
)
{
if
(
xml_menu_ctx
!=
NULL
&&
menu_stack
!=
NULL
&&
xml_menu
!=
NULL
)
{
const
char
*
menu_name
=
switch_xml_attr_soft
(
xml_menu
,
"name"
);
// if the attr doesn't exist, return ""
const
char
*
menu_name
=
switch_xml_attr_soft
(
xml_menu
,
"name"
);
/* if the attr doesn't exist, return "" */
const
char
*
greet_long
=
switch_xml_attr
(
xml_menu
,
"greet-long"
);
// if the attr doesn't exist, return NULL
const
char
*
greet_long
=
switch_xml_attr
(
xml_menu
,
"greet-long"
);
/* if the attr doesn't exist, return NULL */
const
char
*
greet_short
=
switch_xml_attr
(
xml_menu
,
"greet-short"
);
// if the attr doesn't exist, return NULL
const
char
*
greet_short
=
switch_xml_attr
(
xml_menu
,
"greet-short"
);
/* if the attr doesn't exist, return NULL */
const
char
*
invalid_sound
=
switch_xml_attr
(
xml_menu
,
"invalid-sound"
);
// if the attr doesn't exist, return NULL
const
char
*
invalid_sound
=
switch_xml_attr
(
xml_menu
,
"invalid-sound"
);
/* if the attr doesn't exist, return NULL */
const
char
*
exit_sound
=
switch_xml_attr
(
xml_menu
,
"exit-sound"
);
// if the attr doesn't exist, return NULL
const
char
*
exit_sound
=
switch_xml_attr
(
xml_menu
,
"exit-sound"
);
/* if the attr doesn't exist, return NULL */
const
char
*
timeout
=
switch_xml_attr_soft
(
xml_menu
,
"timeout"
);
// if the attr doesn't exist, return ""
const
char
*
timeout
=
switch_xml_attr_soft
(
xml_menu
,
"timeout"
);
/* if the attr doesn't exist, return "" */
const
char
*
max_failures
=
switch_xml_attr_soft
(
xml_menu
,
"max-failures"
);
/
/ if the attr doesn't exist, return ""
const
char
*
max_failures
=
switch_xml_attr_soft
(
xml_menu
,
"max-failures"
);
/
* if the attr doesn't exist, return "" */
const
char
*
confirm_macro
=
switch_xml_attr
(
xml_menu
,
"confirm-macro"
);
const
char
*
confirm_macro
=
switch_xml_attr
(
xml_menu
,
"confirm-macro"
);
const
char
*
confirm_key
=
switch_xml_attr
(
xml_menu
,
"confirm-key"
);
const
char
*
confirm_key
=
switch_xml_attr
(
xml_menu
,
"confirm-key"
);
const
char
*
confirm_attempts
=
switch_xml_attr_soft
(
xml_menu
,
"confirm-attempts"
);
const
char
*
confirm_attempts
=
switch_xml_attr_soft
(
xml_menu
,
"confirm-attempts"
);
...
@@ -716,7 +713,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
...
@@ -716,7 +713,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
atoi
(
timeout
),
atoi
(
timeout
),
atoi
(
max_failures
),
atoi
(
max_failures
),
xml_menu_ctx
->
pool
);
xml_menu_ctx
->
pool
);
/
/ set the menu_stack for the caller
/
* set the menu_stack for the caller */
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
*
menu_stack
==
NULL
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
*
menu_stack
==
NULL
)
{
*
menu_stack
=
menu
;
*
menu_stack
=
menu
;
}
}
...
@@ -724,7 +721,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
...
@@ -724,7 +721,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
menu
!=
NULL
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
&&
menu
!=
NULL
)
{
switch_xml_t
xml_kvp
;
switch_xml_t
xml_kvp
;
/
/ build menu entries
/
* build menu entries */
for
(
xml_kvp
=
switch_xml_child
(
xml_menu
,
"entry"
);
xml_kvp
!=
NULL
&&
status
==
SWITCH_STATUS_SUCCESS
;
xml_kvp
=
xml_kvp
->
next
)
{
for
(
xml_kvp
=
switch_xml_child
(
xml_menu
,
"entry"
);
xml_kvp
!=
NULL
&&
status
==
SWITCH_STATUS_SUCCESS
;
xml_kvp
=
xml_kvp
->
next
)
{
const
char
*
action
=
switch_xml_attr
(
xml_kvp
,
"action"
);
const
char
*
action
=
switch_xml_attr
(
xml_kvp
,
"action"
);
const
char
*
digits
=
switch_xml_attr
(
xml_kvp
,
"digits"
);
const
char
*
digits
=
switch_xml_attr
(
xml_kvp
,
"digits"
);
...
@@ -734,7 +731,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
...
@@ -734,7 +731,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
switch_ivr_menu_xml_map_t
*
xml_map
=
xml_menu_ctx
->
map
;
switch_ivr_menu_xml_map_t
*
xml_map
=
xml_menu_ctx
->
map
;
int
found
=
0
;
int
found
=
0
;
/
/ find and appropriate xml handler
/
* find and appropriate xml handler */
while
(
xml_map
!=
NULL
&&
!
found
)
{
while
(
xml_map
!=
NULL
&&
!
found
)
{
if
(
!
(
found
=
(
strcasecmp
(
xml_map
->
name
,
action
)
==
0
)))
{
if
(
!
(
found
=
(
strcasecmp
(
xml_map
->
name
,
action
)
==
0
)))
{
xml_map
=
xml_map
->
next
;
xml_map
=
xml_map
->
next
;
...
@@ -742,13 +739,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
...
@@ -742,13 +739,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
}
}
if
(
found
&&
xml_map
!=
NULL
)
{
if
(
found
&&
xml_map
!=
NULL
)
{
/
/ do we need to build a new sub-menu ?
/
* do we need to build a new sub-menu ? */
if
(
xml_map
->
action
==
SWITCH_IVR_ACTION_EXECMENU
&&
switch_ivr_menu_find
(
*
menu_stack
,
param
)
==
NULL
)
{
if
(
xml_map
->
action
==
SWITCH_IVR_ACTION_EXECMENU
&&
switch_ivr_menu_find
(
*
menu_stack
,
param
)
==
NULL
)
{
if
((
xml_menu
=
switch_xml_find_child
(
xml_menus
,
"menu"
,
"name"
,
param
))
!=
NULL
)
{
if
((
xml_menu
=
switch_xml_find_child
(
xml_menus
,
"menu"
,
"name"
,
param
))
!=
NULL
)
{
status
=
switch_ivr_menu_stack_xml_build
(
xml_menu_ctx
,
menu_stack
,
xml_menus
,
xml_menu
);
status
=
switch_ivr_menu_stack_xml_build
(
xml_menu_ctx
,
menu_stack
,
xml_menus
,
xml_menu
);
}
}
}
}
/
/ finally bind the menu entry
/
* finally bind the menu entry */
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
if
(
status
==
SWITCH_STATUS_SUCCESS
)
{
if
(
xml_map
->
function
!=
NULL
)
{
if
(
xml_map
->
function
!=
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论