Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
200a76b2
提交
200a76b2
authored
4月 30, 2019
作者:
Sergey Khripchenko
提交者:
Andrey Volk
7月 25, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9264 Add more logging to wait_for_silence, detect_audio and detect_silence api calls
上级
655c8a1a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
24 行增加
和
3 行删除
+24
-3
switch_ivr_play_say.c
src/switch_ivr_play_say.c
+24
-3
没有找到文件。
src/switch_ivr_play_say.c
浏览文件 @
200a76b2
...
...
@@ -2032,6 +2032,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
file
,
read_impl
.
number_of_channels
,
read_impl
.
actual_samples_per_second
,
SWITCH_FILE_FLAG_READ
|
SWITCH_FILE_DATA_SHORT
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failure opening playback file %s.
\n
"
,
file
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_FALSE
);
return
SWITCH_STATUS_NOTFOUND
;
}
...
...
@@ -2050,6 +2051,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to initialize L16 codec.
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
end
;
}
...
...
@@ -2066,6 +2068,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read frame.
\n
"
);
break
;
}
...
...
@@ -2075,7 +2078,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
switch_channel_set_variable
(
channel
,
"wait_for_silence_timeout"
,
"true"
);
switch_channel_set_variable_printf
(
channel
,
"wait_for_silence_listenhits"
,
"%d"
,
listening
);
switch_channel_set_variable_printf
(
channel
,
"wait_for_silence_silence_hits"
,
"%d"
,
silence_hits
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_wait_for_silence: TIMEOUT %d
\n
"
,
countdown
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_wait_for_silence: TIMEOUT after %d ms at %d listen hits, %d silence hits, %d countdown
\n
"
,
timeout_ms
,
listening
,
(
org_silence_hits
-
silence_hits
),
countdown
);
break
;
}
}
...
...
@@ -2084,12 +2089,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
switch_size_t
olen
=
raw_codec
.
implementation
->
samples_per_packet
;
if
(
switch_core_file_read
(
&
fh
,
abuf
,
&
olen
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read file %s.
\n
"
,
file
);
break
;
}
write_frame
.
samples
=
(
uint32_t
)
olen
;
write_frame
.
datalen
=
(
uint32_t
)
(
olen
*
sizeof
(
int16_t
)
*
fh
.
channels
);
if
((
status
=
switch_core_session_write_frame
(
session
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to write frame from file %s.
\n
"
,
file
);
break
;
}
}
...
...
@@ -2169,6 +2176,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
file
,
read_impl
.
number_of_channels
,
read_impl
.
actual_samples_per_second
,
SWITCH_FILE_FLAG_READ
|
SWITCH_FILE_DATA_SHORT
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failure opening playback file %s.
\n
"
,
file
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_FALSE
);
return
SWITCH_STATUS_NOTFOUND
;
}
...
...
@@ -2187,6 +2195,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to initialize L16 codec.
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
end
;
}
...
...
@@ -2203,6 +2212,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read frame.
\n
"
);
break
;
}
...
...
@@ -2211,7 +2221,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
if
(
sample_count
<=
0
)
{
switch_channel_set_variable
(
channel
,
"detect_audio_timeout"
,
"true"
);
switch_channel_set_variable_printf
(
channel
,
"detect_audio_hits"
,
"%d"
,
hits
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_detect_audio: TIMEOUT %d hits
\n
"
,
hits
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_detect_audio: TIMEOUT after %d ms at %d hits
\n
"
,
timeout_ms
,
hits
);
break
;
}
}
...
...
@@ -2220,12 +2232,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_audio(switch_core_session_t *s
switch_size_t
olen
=
raw_codec
.
implementation
->
samples_per_packet
;
if
(
switch_core_file_read
(
&
fh
,
abuf
,
&
olen
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read file %s.
\n
"
,
file
);
break
;
}
write_frame
.
samples
=
(
uint32_t
)
olen
;
write_frame
.
datalen
=
(
uint32_t
)
(
olen
*
sizeof
(
int16_t
)
*
fh
.
channels
);
if
((
status
=
switch_core_session_write_frame
(
session
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to write frame from file %s.
\n
"
,
file
);
break
;
}
}
...
...
@@ -2296,6 +2310,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
file
,
read_impl
.
number_of_channels
,
read_impl
.
actual_samples_per_second
,
SWITCH_FILE_FLAG_READ
|
SWITCH_FILE_DATA_SHORT
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failure opening playback file %s.
\n
"
,
file
);
switch_core_session_reset
(
session
,
SWITCH_TRUE
,
SWITCH_FALSE
);
return
SWITCH_STATUS_NOTFOUND
;
}
...
...
@@ -2314,6 +2329,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to initialize L16 codec.
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
end
;
}
...
...
@@ -2330,6 +2346,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read frame.
\n
"
);
break
;
}
...
...
@@ -2338,7 +2355,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
if
(
sample_count
<=
0
)
{
switch_channel_set_variable
(
channel
,
"detect_silence_timeout"
,
"true"
);
switch_channel_set_variable_printf
(
channel
,
"detect_silence_hits"
,
"%d"
,
hits
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_detect_silence: TIMEOUT %d hits
\n
"
,
hits
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"switch_ivr_detect_silence: TIMEOUT after %d ms at %d hits
\n
"
,
timeout_ms
,
hits
);
break
;
}
}
...
...
@@ -2347,12 +2366,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_silence(switch_core_session_t
switch_size_t
olen
=
raw_codec
.
implementation
->
samples_per_packet
;
if
(
switch_core_file_read
(
&
fh
,
abuf
,
&
olen
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to read file %s.
\n
"
,
file
);
break
;
}
write_frame
.
samples
=
(
uint32_t
)
olen
;
write_frame
.
datalen
=
(
uint32_t
)
(
olen
*
sizeof
(
int16_t
)
*
fh
.
channels
);
if
((
status
=
switch_core_session_write_frame
(
session
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Failed to write frame from file %s.
\n
"
,
file
);
break
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论