Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5f4279d5
提交
5f4279d5
authored
5月 25, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add t38_trace=true to trace audio to tmp
上级
596c0012
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
53 行增加
和
2 行删除
+53
-2
mod_fax.c
src/mod/applications/mod_fax/mod_fax.c
+53
-2
没有找到文件。
src/mod/applications/mod_fax/mod_fax.c
浏览文件 @
5f4279d5
...
@@ -33,6 +33,13 @@
...
@@ -33,6 +33,13 @@
*/
*/
#include <switch.h>
#include <switch.h>
#ifdef WIN32
#define FAX_INVALID_SOCKET INVALID_HANDLE_VALUE
typedef
HANDLE
fax_socket_t
;
#else
#define FAX_INVALID_SOCKET -1
typedef
int
zap_socket_t
;
#endif
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include <spandsp.h>
#include <spandsp.h>
...
@@ -1551,6 +1558,9 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
...
@@ -1551,6 +1558,9 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
int16_t
*
buf
=
NULL
;
int16_t
*
buf
=
NULL
;
switch_status_t
status
;
switch_status_t
status
;
switch_size_t
tx
;
switch_size_t
tx
;
const
char
*
t38_trace
=
switch_channel_get_variable
(
channel
,
"t38_trace"
);
char
*
trace_read
,
*
trace_write
;
zap_socket_t
read_fd
=
FAX_INVALID_SOCKET
,
write_fd
=
FAX_INVALID_SOCKET
;
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
...
@@ -1627,7 +1637,29 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
...
@@ -1627,7 +1637,29 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
goto
end_unlock
;
goto
end_unlock
;
}
}
switch_ivr_sleep
(
session
,
250
,
SWITCH_TRUE
,
NULL
);
switch_ivr_sleep
(
session
,
0
,
SWITCH_TRUE
,
NULL
);
if
(
switch_true
(
t38_trace
))
{
trace_read
=
switch_core_session_sprintf
(
session
,
"%s%s%s_read.raw"
,
SWITCH_GLOBAL_dirs
.
temp_dir
,
SWITCH_PATH_SEPARATOR
,
switch_core_session_get_uuid
(
session
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Tracing inbound audio to %s
\n
"
,
trace_read
);
switch_channel_set_variable
(
channel
,
"t38_trace_read"
,
trace_read
);
trace_write
=
switch_core_session_sprintf
(
session
,
"%s%s%s_write.raw"
,
SWITCH_GLOBAL_dirs
.
temp_dir
,
SWITCH_PATH_SEPARATOR
,
switch_core_session_get_uuid
(
session
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Tracing outbound audio to %s
\n
"
,
trace_write
);
switch_channel_set_variable
(
channel
,
"t38_trace_read"
,
trace_write
);
if
((
write_fd
=
open
(
trace_read
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
))
!=
FAX_INVALID_SOCKET
)
{
if
((
read_fd
=
open
(
trace_write
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRUSR
|
S_IWUSR
))
==
FAX_INVALID_SOCKET
)
{
close
(
write_fd
);
write_fd
=
FAX_INVALID_SOCKET
;
}
}
}
while
(
switch_channel_ready
(
channel
)
&&
switch_channel_up
(
other_channel
))
{
while
(
switch_channel_ready
(
channel
)
&&
switch_channel_up
(
other_channel
))
{
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
...
@@ -1640,6 +1672,10 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
...
@@ -1640,6 +1672,10 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
/* Skip CNG frames (auto-generated by FreeSWITCH, usually) */
/* Skip CNG frames (auto-generated by FreeSWITCH, usually) */
if
(
!
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
if
(
!
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
if
(
read_fd
!=
FAX_INVALID_SOCKET
)
{
write
(
read_fd
,
read_frame
->
data
,
read_frame
->
datalen
);
}
if
(
t38_gateway_rx
(
pvt
->
t38_gateway_state
,
(
int16_t
*
)
read_frame
->
data
,
read_frame
->
samples
))
{
if
(
t38_gateway_rx
(
pvt
->
t38_gateway_state
,
(
int16_t
*
)
read_frame
->
data
,
read_frame
->
samples
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"fax_rx reported an error
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"fax_rx reported an error
\n
"
);
goto
end_unlock
;
goto
end_unlock
;
...
@@ -1660,6 +1696,10 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
...
@@ -1660,6 +1696,10 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
write_frame
.
samples
=
tx
;
write_frame
.
samples
=
tx
;
}
}
if
(
write_fd
!=
FAX_INVALID_SOCKET
)
{
write
(
write_fd
,
write_frame
.
data
,
write_frame
.
datalen
);
}
if
(
switch_core_session_write_frame
(
session
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_session_write_frame
(
session
,
&
write_frame
,
SWITCH_IO_FLAG_NONE
,
0
)
!=
SWITCH_STATUS_SUCCESS
)
{
goto
end_unlock
;
goto
end_unlock
;
}
}
...
@@ -1667,6 +1707,17 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
...
@@ -1667,6 +1707,17 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
end_unlock:
end_unlock:
if
(
read_fd
!=
FAX_INVALID_SOCKET
)
{
close
(
read_fd
);
read_fd
=
FAX_INVALID_SOCKET
;
}
if
(
write_fd
!=
FAX_INVALID_SOCKET
)
{
close
(
write_fd
);
write_fd
=
FAX_INVALID_SOCKET
;
}
switch_channel_hangup
(
other_channel
,
SWITCH_CAUSE_NORMAL_CLEARING
);
switch_channel_hangup
(
other_channel
,
SWITCH_CAUSE_NORMAL_CLEARING
);
switch_core_session_rwunlock
(
other_session
);
switch_core_session_rwunlock
(
other_session
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论