Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bfc3c17b
提交
bfc3c17b
authored
12月 09, 2012
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweaks to the T.31 modem
上级
8aecffef
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
31 行增加
和
24 行删除
+31
-24
mod_spandsp_modem.c
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
+31
-24
没有找到文件。
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
浏览文件 @
bfc3c17b
...
...
@@ -56,8 +56,8 @@ struct modem_state {
static
struct
modem_state
MODEM_STATE
[]
=
{
{
MODEM_STATE_INIT
,
"INIT"
},
{
MODEM_STATE_ONHOOK
,
"ONHOOK"
},
{
MODEM_STATE_OFFHOOK
,
"OFFHOOK"
},
{
MODEM_STATE_ONHOOK
,
"ONHOOK"
},
{
MODEM_STATE_OFFHOOK
,
"OFFHOOK"
},
{
MODEM_STATE_ACQUIRED
,
"ACQUIRED"
},
{
MODEM_STATE_RINGING
,
"RINGING"
},
{
MODEM_STATE_ANSWERED
,
"ANSWERED"
},
...
...
@@ -214,9 +214,10 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
{
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
#ifdef WIN32
COMMTIMEOUTS
timeouts
=
{
0
};
COMMTIMEOUTS
timeouts
=
{
0
};
#endif
logging_state_t
*
logging
;
memset
(
modem
,
0
,
sizeof
(
*
modem
));
modem
->
master
=
-
1
;
...
...
@@ -239,7 +240,7 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
modem
->
stty
=
ttyname
(
modem
->
slave
);
}
#else
#if WIN32
#if
def
WIN32
modem
->
slot
=
4
+
globals
.
NEXT_ID
++
;
/* need work here we start at COM4 for now*/
snprintf
(
modem
->
devlink
,
sizeof
(
modem
->
devlink
),
"COM%d"
,
modem
->
slot
);
...
...
@@ -250,9 +251,9 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
OPEN_EXISTING
,
FILE_FLAG_OVERLAPPED
,
0
);
if
(
modem
->
master
==
INVALID_HANDLE_VALUE
)
{
if
(
modem
->
master
==
INVALID_HANDLE_VALUE
)
{
status
=
SWITCH_STATUS_FALSE
;
if
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
{
if
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Fatal error: Serial port does not exist
\n
"
);
goto
end
;
}
...
...
@@ -321,16 +322,16 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
goto
end
;
}
#else
timeouts
.
ReadIntervalTimeout
=
50
;
timeouts
.
ReadTotalTimeoutConstant
=
50
;
timeouts
.
ReadTotalTimeoutMultiplier
=
10
;
timeouts
.
ReadIntervalTimeout
=
50
;
timeouts
.
ReadTotalTimeoutConstant
=
50
;
timeouts
.
ReadTotalTimeoutMultiplier
=
10
;
timeouts
.
WriteTotalTimeoutConstant
=
50
;
timeouts
.
WriteTotalTimeoutMultiplier
=
10
;
timeouts
.
WriteTotalTimeoutConstant
=
50
;
timeouts
.
WriteTotalTimeoutMultiplier
=
10
;
SetCommMask
(
modem
->
master
,
EV_RXCHAR
);
if
(
!
SetCommTimeouts
(
modem
->
master
,
&
timeouts
)){
if
(
!
SetCommTimeouts
(
modem
->
master
,
&
timeouts
)){
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot set up non-blocking read on %s
\n
"
,
modem
->
devlink
);
modem_close
(
modem
);
status
=
SWITCH_STATUS_FALSE
;
...
...
@@ -347,15 +348,21 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
}
if
(
spandsp_globals
.
modem_verbose
)
{
span_log_set_message_handler
(
&
modem
->
t31_state
->
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v17_rx
.
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v29_rx
.
logging
,
spanfax_log_message
,
NULL
);
span_log_set_message_handler
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v27ter_rx
.
logging
,
spanfax_log_message
,
NULL
);
modem
->
t31_state
->
logging
.
level
=
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
;
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v17_rx
.
logging
.
level
=
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
;
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v29_rx
.
logging
.
level
=
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
;
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v27ter_rx
.
logging
.
level
=
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
;
logging
=
t31_get_logging_state
(
modem
->
t31_state
);
span_log_set_message_handler
(
logging
,
spanfax_log_message
,
NULL
);
span_log_set_level
(
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
logging
=
v17_rx_get_logging_state
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v17_rx
);
span_log_set_message_handler
(
logging
,
spanfax_log_message
,
NULL
);
span_log_set_level
(
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
logging
=
v29_rx_get_logging_state
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v29_rx
);
span_log_set_message_handler
(
logging
,
spanfax_log_message
,
NULL
);
span_log_set_level
(
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
logging
=
v27ter_rx_get_logging_state
(
&
modem
->
t31_state
->
audio
.
modems
.
fast_modems
.
v27ter_rx
);
span_log_set_message_handler
(
logging
,
spanfax_log_message
,
NULL
);
span_log_set_level
(
logging
,
SPAN_LOG_SHOW_SEVERITY
|
SPAN_LOG_SHOW_PROTOCOL
|
SPAN_LOG_FLOW
);
}
modem
->
control_handler
=
control_handler
;
...
...
@@ -1311,8 +1318,8 @@ static void *SWITCH_THREAD_FUNC modem_thread(switch_thread_t *thread, void *obj)
if
(
!
strncasecmp
(
buf
,
"AT"
,
2
))
{
int
x
;
strncpy
(
tmp
,
buf
,
r
);
for
(
x
=
0
;
x
<
r
;
x
++
)
{
if
(
tmp
[
x
]
==
'\r'
||
tmp
[
x
]
==
'\n'
)
{
for
(
x
=
0
;
x
<
r
;
x
++
)
{
if
(
tmp
[
x
]
==
'\r'
||
tmp
[
x
]
==
'\n'
)
{
tmp
[
x
]
=
'\0'
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论