Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
495deafd
提交
495deafd
authored
3月 11, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@7865
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
a3639154
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
127 行增加
和
2 行删除
+127
-2
switch_ivr.h
src/include/switch_ivr.h
+4
-0
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+21
-0
switch_channel.c
src/switch_channel.c
+4
-2
switch_ivr_async.c
src/switch_ivr_async.c
+98
-0
没有找到文件。
src/include/switch_ivr.h
浏览文件 @
495deafd
...
...
@@ -747,6 +747,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
uint32_t
timeout
,
const
char
*
valid_terminators
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_bind_dtmf_meta_session
(
switch_core_session_t
*
session
,
uint32_t
key
,
const
char
*
app
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_unbind_dtmf_meta_session
(
switch_core_session_t
*
session
);
/** @} */
SWITCH_END_EXTERN_C
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
495deafd
...
...
@@ -79,6 +79,26 @@ SWITCH_STANDARD_APP(exe_function)
}
}
#define BIND_SYNTAX "<key> <app>"
SWITCH_STANDARD_APP
(
dtmf_bind_function
)
{
char
*
argv
[
2
]
=
{
0
};
int
argc
;
char
*
lbuf
=
NULL
;
if
(
!
switch_strlen_zero
(
data
)
&&
(
lbuf
=
switch_core_session_strdup
(
session
,
data
))
&&
(
argc
=
switch_separate_string
(
lbuf
,
' '
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
]))))
==
2
)
{
int
kval
=
atoi
(
argv
[
0
]);
if
(
switch_ivr_bind_dtmf_meta_session
(
session
,
kval
,
argv
[
1
])
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Bound: %s %s
\n
"
,
argv
[
0
],
argv
[
1
]);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Bind Error!
\n
"
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Usage: %s
\n
"
,
BIND_SYNTAX
);
}
}
#define INTERCEPT_SYNTAX "<uuid>"
SWITCH_STANDARD_APP
(
intercept_function
)
{
...
...
@@ -1609,6 +1629,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP
(
app_interface
,
"sched_broadcast"
,
SCHED_BROADCAST_DESCR
,
SCHED_BROADCAST_DESCR
,
sched_broadcast_function
,
"[+]<time> <path> [aleg|bleg|both]"
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"sched_transfer"
,
SCHED_TRANSF_DESCR
,
SCHED_TRANSF_DESCR
,
sched_transfer_function
,
"[+]<time> <extension> <dialplan> <context>"
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"execute_extension"
,
"Execute an extension"
,
"Execute an extension"
,
exe_function
,
EXE_SYNTAX
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"bind_meta_app"
,
"Bind a key to an application"
,
"Bind a key to an application"
,
dtmf_bind_function
,
BIND_SYNTAX
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"intercept"
,
"intercept"
,
"intercept"
,
intercept_function
,
INTERCEPT_SYNTAX
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"eavesdrop"
,
"eavesdrop on a uuid"
,
"eavesdrop on a uuid"
,
eavesdrop_function
,
eavesdrop_SYNTAX
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"three_way"
,
"three way call with a uuid"
,
"three way call with a uuid"
,
three_way_function
,
eavesdrop_SYNTAX
,
SAF_NONE
);
...
...
src/switch_channel.c
浏览文件 @
495deafd
...
...
@@ -1913,15 +1913,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
switch_time_t
uduration
=
0
,
legbillusec
=
0
,
billusec
=
0
;
time_t
tt_created
=
0
,
tt_answered
=
0
,
tt_hungup
=
0
,
mtt_created
=
0
,
mtt_answered
=
0
,
mtt_hungup
=
0
,
tt_prof_created
,
mtt_prof_created
;
if
(
!
(
caller_profile
=
switch_channel_get_caller_profile
(
channel
)))
{
return
SWITCH_STATUS_FALSE
;
}
caller_profile
=
switch_channel_get_caller_profile
(
channel
);
if
(
!
(
ocp
=
switch_channel_get_originatee_caller_profile
(
channel
)))
{
ocp
=
switch_channel_get_originator_caller_profile
(
channel
);
}
if
(
!
switch_strlen_zero
(
caller_profile
->
caller_id_name
))
{
cid_buf
=
switch_core_session_sprintf
(
channel
->
session
,
"
\"
%s
\"
<%s>"
,
caller_profile
->
caller_id_name
,
switch_str_nil
(
caller_profile
->
caller_id_number
));
switch_str_nil
(
caller_profile
->
caller_id_number
));
}
else
{
cid_buf
=
caller_profile
->
caller_id_number
;
}
...
...
src/switch_ivr_async.c
浏览文件 @
495deafd
...
...
@@ -1258,6 +1258,104 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
return
SWITCH_STATUS_SUCCESS
;
}
typedef
struct
{
const
char
*
app
;
}
dtmf_meta_app_t
;
typedef
struct
{
dtmf_meta_app_t
map
[
10
];
time_t
last_digit
;
switch_bool_t
meta_on
;
}
dtmf_meta_data_t
;
#define SWITCH_META_VAR_KEY "__dtmf_meta"
static
switch_status_t
meta_on_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
dtmf_meta_data_t
*
md
=
switch_channel_get_private
(
channel
,
SWITCH_META_VAR_KEY
);
time_t
now
=
switch_timestamp
(
NULL
);
char
digit
[
2
]
=
""
;
int
dval
;
if
(
!
md
)
{
return
SWITCH_STATUS_SUCCESS
;
}
if
(
md
->
meta_on
&&
now
-
md
->
last_digit
>
5
)
{
md
->
meta_on
=
SWITCH_FALSE
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"%s Meta digit timeout parsing %c
\n
"
,
switch_channel_get_name
(
channel
),
dtmf
->
digit
);
return
SWITCH_STATUS_SUCCESS
;
}
md
->
last_digit
=
now
;
if
(
dtmf
->
digit
==
'*'
)
{
if
(
md
->
meta_on
)
{
md
->
meta_on
=
SWITCH_FALSE
;
return
SWITCH_STATUS_SUCCESS
;
}
else
{
md
->
meta_on
=
SWITCH_TRUE
;
return
SWITCH_STATUS_FALSE
;
}
}
if
(
md
->
meta_on
)
{
if
(
dtmf
->
digit
>=
'0'
&&
dtmf
->
digit
<=
'9'
)
{
*
digit
=
dtmf
->
digit
;
dval
=
atoi
(
digit
);
if
(
md
->
map
[
dval
].
app
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s Processing meta digit '%c' [%s]
\n
"
,
switch_channel_get_name
(
channel
),
dtmf
->
digit
,
md
->
map
[
dval
].
app
);
switch_ivr_broadcast
(
switch_core_session_get_uuid
(
session
),
md
->
map
[
dval
].
app
,
SMF_ECHO_ALEG
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"%s Ignoring meta digit '%c' not mapped
\n
"
,
switch_channel_get_name
(
channel
),
dtmf
->
digit
);
}
}
md
->
meta_on
=
SWITCH_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_unbind_dtmf_meta_session
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_set_private
(
channel
,
SWITCH_META_VAR_KEY
,
NULL
);
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_bind_dtmf_meta_session
(
switch_core_session_t
*
session
,
uint32_t
key
,
const
char
*
app
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
dtmf_meta_data_t
*
md
=
switch_channel_get_private
(
channel
,
SWITCH_META_VAR_KEY
);
if
(
key
>
9
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid key %u
\n
"
,
key
);
return
SWITCH_STATUS_FALSE
;
}
if
(
!
md
)
{
md
=
switch_core_session_alloc
(
session
,
sizeof
(
*
md
));
switch_channel_set_private
(
channel
,
SWITCH_META_VAR_KEY
,
md
);
switch_core_event_hook_add_recv_dtmf
(
session
,
meta_on_dtmf
);
}
if
(
!
switch_strlen_zero
(
app
))
{
md
->
map
[
key
].
app
=
switch_core_session_strdup
(
session
,
app
);
}
else
{
md
->
map
[
key
].
app
=
NULL
;
}
return
SWITCH_STATUS_SUCCESS
;
}
struct
speech_thread_handle
{
switch_core_session_t
*
session
;
switch_asr_handle_t
*
ah
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论