Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1dbb05b6
提交
1dbb05b6
authored
7月 19, 2012
作者:
Christopher Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more spacing fixes to mod_spandsp.
上级
ec412c07
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
111 行增加
和
78 行删除
+111
-78
mod_spandsp.c
src/mod/applications/mod_spandsp/mod_spandsp.c
+7
-7
mod_spandsp.h
src/mod/applications/mod_spandsp/mod_spandsp.h
+11
-0
mod_spandsp_fax.c
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
+51
-51
mod_spandsp_modem.c
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
+31
-20
mod_spandsp_modem.h
src/mod/applications/mod_spandsp/mod_spandsp_modem.h
+11
-0
没有找到文件。
src/mod/applications/mod_spandsp/mod_spandsp.c
浏览文件 @
1dbb05b6
...
@@ -227,12 +227,12 @@ SWITCH_STANDARD_APP(t38_gateway_function)
...
@@ -227,12 +227,12 @@ SWITCH_STANDARD_APP(t38_gateway_function)
}
else
{
}
else
{
if
((
var
=
switch_channel_get_variable
(
channel
,
"t38_gateway_detect_timeout"
)))
{
if
((
var
=
switch_channel_get_variable
(
channel
,
"t38_gateway_detect_timeout"
)))
{
long
to
=
atol
(
var
);
long
to
=
atol
(
var
);
if
(
to
>
-
1
)
{
if
(
to
>
-
1
)
{
timeout
=
(
time_t
)
(
switch_epoch_time_now
(
NULL
)
+
to
);
timeout
=
(
time_t
)
(
switch_epoch_time_now
(
NULL
)
+
to
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"%s invalid timeout value.
\n
"
,
switch_channel_get_name
(
channel
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"%s invalid timeout value.
\n
"
,
switch_channel_get_name
(
channel
));
}
}
}
}
//switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);
//switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);
spandsp_fax_detect_session
(
session
,
"rw"
,
timeout
,
MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE
,
1
,
direction
,
NULL
,
t38_gateway_start
);
spandsp_fax_detect_session
(
session
,
"rw"
,
timeout
,
MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE
,
1
,
direction
,
NULL
,
t38_gateway_start
);
...
@@ -461,8 +461,8 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel
...
@@ -461,8 +461,8 @@ void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t sel
switch_core_session_queue_message
(
target_session
,
msg
);
switch_core_session_queue_message
(
target_session
,
msg
);
if
(
locked
)
{
if
(
locked
)
{
switch_core_session_rwunlock
(
target_session
);
switch_core_session_rwunlock
(
target_session
);
locked
=
0
;
locked
=
0
;
}
}
}
}
}
}
...
...
src/mod/applications/mod_spandsp/mod_spandsp.h
浏览文件 @
1dbb05b6
...
@@ -151,3 +151,14 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
...
@@ -151,3 +151,14 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
switch_status_t
spandsp_stop_tdd_decode_session
(
switch_core_session_t
*
session
);
switch_status_t
spandsp_stop_tdd_decode_session
(
switch_core_session_t
*
session
);
switch_status_t
spandsp_tdd_decode_session
(
switch_core_session_t
*
session
);
switch_status_t
spandsp_tdd_decode_session
(
switch_core_session_t
*
session
);
switch_status_t
spandsp_tdd_send_session
(
switch_core_session_t
*
session
,
const
char
*
text
);
switch_status_t
spandsp_tdd_send_session
(
switch_core_session_t
*
session
,
const
char
*
text
);
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
浏览文件 @
1dbb05b6
...
@@ -685,11 +685,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
...
@@ -685,11 +685,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
switch_assert
(
channel
);
switch_assert
(
channel
);
if
((
tmp
=
switch_channel_get_variable
(
channel
,
"t38_gateway_redundancy"
)))
{
if
((
tmp
=
switch_channel_get_variable
(
channel
,
"t38_gateway_redundancy"
)))
{
int
tmp_value
;
int
tmp_value
;
tmp_value
=
atoi
(
tmp
);
tmp_value
=
atoi
(
tmp
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"FAX changing redundancy from %d:%d to %d:%d
\n
"
,
fec_span
,
fec_entries
,
tmp_value
,
tmp_value
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"FAX changing redundancy from %d:%d to %d:%d
\n
"
,
fec_span
,
fec_entries
,
tmp_value
,
tmp_value
);
fec_entries
=
tmp_value
;
fec_entries
=
tmp_value
;
fec_span
=
tmp_value
;
fec_span
=
tmp_value
;
}
}
switch
(
trans_mode
)
{
switch
(
trans_mode
)
{
...
@@ -721,62 +721,62 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
...
@@ -721,62 +721,62 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
}
}
break
;
break
;
case
T38_MODE
:
case
T38_MODE
:
{
{
switch_core_session_message_t
msg
=
{
0
};
switch_core_session_message_t
msg
=
{
0
};
if
(
pvt
->
t38_state
==
NULL
)
{
if
(
pvt
->
t38_state
==
NULL
)
{
pvt
->
t38_state
=
(
t38_terminal_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
t38_terminal_state_t
));
pvt
->
t38_state
=
(
t38_terminal_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
t38_terminal_state_t
));
}
}
if
(
pvt
->
t38_state
==
NULL
)
{
if
(
pvt
->
t38_state
==
NULL
)
{
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
if
(
pvt
->
udptl_state
==
NULL
)
{
if
(
pvt
->
udptl_state
==
NULL
)
{
pvt
->
udptl_state
=
(
udptl_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
udptl_state_t
));
pvt
->
udptl_state
=
(
udptl_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
udptl_state_t
));
}
}
if
(
pvt
->
udptl_state
==
NULL
)
{
if
(
pvt
->
udptl_state
==
NULL
)
{
t38_terminal_free
(
pvt
->
t38_state
);
t38_terminal_free
(
pvt
->
t38_state
);
pvt
->
t38_state
=
NULL
;
pvt
->
t38_state
=
NULL
;
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
t38
=
pvt
->
t38_state
;
t38
=
pvt
->
t38_state
;
t30
=
t38_terminal_get_t30_state
(
t38
);
t30
=
t38_terminal_get_t30_state
(
t38
);
memset
(
t38
,
0
,
sizeof
(
t38_terminal_state_t
));
memset
(
t38
,
0
,
sizeof
(
t38_terminal_state_t
));
if
(
t38_terminal_init
(
t38
,
pvt
->
caller
,
t38_tx_packet_handler
,
pvt
)
==
NULL
)
{
if
(
t38_terminal_init
(
t38
,
pvt
->
caller
,
t38_tx_packet_handler
,
pvt
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Cannot initialize my T.38 structs
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Cannot initialize my T.38 structs
\n
"
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
pvt
->
t38_core
=
t38_terminal_get_t38_core_state
(
pvt
->
t38_state
);
pvt
->
t38_core
=
t38_terminal_get_t38_core_state
(
pvt
->
t38_state
);
if
(
udptl_init
(
pvt
->
udptl_state
,
UDPTL_ERROR_CORRECTION_REDUNDANCY
,
fec_span
,
fec_entries
,
if
(
udptl_init
(
pvt
->
udptl_state
,
UDPTL_ERROR_CORRECTION_REDUNDANCY
,
fec_span
,
fec_entries
,
(
udptl_rx_packet_handler_t
*
)
t38_core_rx_ifp_packet
,
(
void
*
)
pvt
->
t38_core
)
==
NULL
)
{
(
udptl_rx_packet_handler_t
*
)
t38_core_rx_ifp_packet
,
(
void
*
)
pvt
->
t38_core
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Cannot initialize my UDPTL structs
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Cannot initialize my UDPTL structs
\n
"
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
msg
.
from
=
__FILE__
;
msg
.
from
=
__FILE__
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UDPTL_MODE
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UDPTL_MODE
;
switch_core_session_receive_message
(
pvt
->
session
,
&
msg
);
switch_core_session_receive_message
(
pvt
->
session
,
&
msg
);
/* add to timer thread processing */
/* add to timer thread processing */
if
(
!
add_pvt
(
pvt
))
{
if
(
!
add_pvt
(
pvt
))
{
if
(
channel
)
{
if
(
channel
)
{
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
}
}
}
}
span_log_set_message_handler
(
&
t38
->
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
t38
->
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
t30
->
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
t30
->
logging
,
spanfax_log_message
,
NULL
);
if
(
pvt
->
verbose
)
{
if
(
pvt
->
verbose
)
{
span_log_set_level
(
&
t38
->
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
span_log_set_level
(
&
t38
->
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
span_log_set_level
(
&
t30
->
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
span_log_set_level
(
&
t30
->
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
}
}
}
}
break
;
break
;
case
T38_GATEWAY_MODE
:
case
T38_GATEWAY_MODE
:
if
(
pvt
->
t38_gateway_state
==
NULL
)
{
if
(
pvt
->
t38_gateway_state
==
NULL
)
{
pvt
->
t38_gateway_state
=
(
t38_gateway_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
t38_gateway_state_t
));
pvt
->
t38_gateway_state
=
(
t38_gateway_state_t
*
)
switch_core_session_alloc
(
pvt
->
session
,
sizeof
(
t38_gateway_state_t
));
...
@@ -959,9 +959,9 @@ static t38_mode_t configure_t38(pvt_t *pvt)
...
@@ -959,9 +959,9 @@ static t38_mode_t configure_t38(pvt_t *pvt)
if
(
t38_options
->
T38FaxRateManagement
)
{
if
(
t38_options
->
T38FaxRateManagement
)
{
if
(
!
strcasecmp
(
t38_options
->
T38FaxRateManagement
,
"transferredTCF"
))
{
if
(
!
strcasecmp
(
t38_options
->
T38FaxRateManagement
,
"transferredTCF"
))
{
method
=
2
;
method
=
2
;
}
else
{
}
else
{
method
=
1
;
method
=
1
;
}
}
}
}
...
...
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
浏览文件 @
1dbb05b6
...
@@ -79,20 +79,20 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf,
...
@@ -79,20 +79,20 @@ static int t31_at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf,
switch_size_t
wrote
;
switch_size_t
wrote
;
wrote
=
write
(
modem
->
master
,
buf
,
len
);
wrote
=
write
(
modem
->
master
,
buf
,
len
);
#else
#else
DWORD
wrote
;
DWORD
wrote
;
OVERLAPPED
o
;
OVERLAPPED
o
;
o
.
hEvent
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
o
.
hEvent
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
/* Initialize the rest of the OVERLAPPED structure to zero. */
/* Initialize the rest of the OVERLAPPED structure to zero. */
o
.
Internal
=
0
;
o
.
Internal
=
0
;
o
.
InternalHigh
=
0
;
o
.
InternalHigh
=
0
;
o
.
Offset
=
0
;
o
.
Offset
=
0
;
o
.
OffsetHigh
=
0
;
o
.
OffsetHigh
=
0
;
assert
(
o
.
hEvent
);
assert
(
o
.
hEvent
);
if
(
!
WriteFile
(
modem
->
master
,
buf
,
(
DWORD
)
len
,
&
wrote
,
&
o
))
{
if
(
!
WriteFile
(
modem
->
master
,
buf
,
(
DWORD
)
len
,
&
wrote
,
&
o
))
{
GetOverlappedResult
(
modem
->
master
,
&
o
,
&
wrote
,
TRUE
);
GetOverlappedResult
(
modem
->
master
,
&
o
,
&
wrote
,
TRUE
);
}
}
CloseHandle
(
o
.
hEvent
);
CloseHandle
(
o
.
hEvent
);
#endif
#endif
if
(
wrote
!=
len
)
{
if
(
wrote
!=
len
)
{
...
@@ -244,12 +244,12 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
...
@@ -244,12 +244,12 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
snprintf
(
modem
->
devlink
,
sizeof
(
modem
->
devlink
),
"COM%d"
,
modem
->
slot
);
snprintf
(
modem
->
devlink
,
sizeof
(
modem
->
devlink
),
"COM%d"
,
modem
->
slot
);
modem
->
master
=
CreateFile
(
modem
->
devlink
,
modem
->
master
=
CreateFile
(
modem
->
devlink
,
GENERIC_READ
|
GENERIC_WRITE
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
0
,
0
,
0
,
OPEN_EXISTING
,
OPEN_EXISTING
,
FILE_FLAG_OVERLAPPED
,
FILE_FLAG_OVERLAPPED
,
0
);
0
);
if
(
modem
->
master
==
INVALID_HANDLE_VALUE
)
{
if
(
modem
->
master
==
INVALID_HANDLE_VALUE
)
{
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
if
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
{
if
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
{
...
@@ -1463,3 +1463,14 @@ void modem_global_shutdown(void)
...
@@ -1463,3 +1463,14 @@ void modem_global_shutdown(void)
}
}
#endif
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
src/mod/applications/mod_spandsp/mod_spandsp_modem.h
浏览文件 @
1dbb05b6
...
@@ -155,3 +155,14 @@ switch_status_t modem_global_init(switch_loadable_module_interface_t **module_in
...
@@ -155,3 +155,14 @@ switch_status_t modem_global_init(switch_loadable_module_interface_t **module_in
void
modem_global_shutdown
(
void
);
void
modem_global_shutdown
(
void
);
#endif //_MOD_SPANDSP_MODEM_H
#endif //_MOD_SPANDSP_MODEM_H
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:nil
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论