Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a84fce3e
提交
a84fce3e
authored
4月 20, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1215
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
da448c26
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
19 行删除
+24
-19
mod_wanpipe.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
+15
-12
switch_ivr.c
src/switch_ivr.c
+9
-7
没有找到文件。
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
浏览文件 @
a84fce3e
...
@@ -440,14 +440,14 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
...
@@ -440,14 +440,14 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
*
frame
=
NULL
;
*
frame
=
NULL
;
memset
(
tech_pvt
->
databuf
,
0
,
sizeof
(
tech_pvt
->
databuf
));
memset
(
tech_pvt
->
databuf
,
0
,
sizeof
(
tech_pvt
->
databuf
));
while
(
bytes
<
globals
.
mtu
)
{
while
(
bytes
<
globals
.
mtu
)
{
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
}
if
((
res
=
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
timeout
,
POLLIN
|
POLLERR
))
<
0
)
{
if
(
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
1000
,
POLLIN
|
POLLERR
|
POLLHUP
)
<=
0
)
{
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
else
if
(
res
==
0
)
{
tech_pvt
->
read_frame
.
datalen
=
0
;
return
SWITCH_STATUS_SUCCESS
;
}
}
if
((
res
=
sangoma_readmsg_socket
(
tech_pvt
->
socket
,
if
((
res
=
sangoma_readmsg_socket
(
tech_pvt
->
socket
,
...
@@ -464,7 +464,7 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
...
@@ -464,7 +464,7 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
bp
+=
bytes
;
bp
+=
bytes
;
}
}
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
if
(
!
bytes
||
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
}
...
@@ -527,9 +527,9 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
...
@@ -527,9 +527,9 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
}
}
}
}
if
(
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
1000
,
POLLOUT
|
POLLERR
|
POLLHUP
)
<=
0
)
{
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
-
1
,
POLLOUT
|
POLLERR
|
POLLHUP
)
;
return
SWITCH_STATUS_GENERR
;
}
#ifdef DOTRACE
#ifdef DOTRACE
write
(
tech_pvt
->
fd
,
dtmf
,
(
int
)
bread
);
write
(
tech_pvt
->
fd
,
dtmf
,
(
int
)
bread
);
...
@@ -565,12 +565,13 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
...
@@ -565,12 +565,13 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
while
(
bytes
>
0
)
{
while
(
bytes
>
0
)
{
unsigned
int
towrite
;
unsigned
int
towrite
;
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
#if 0
if (sangoma_socket_waitfor(tech_pvt->socket, -1, POLLOUT | POLLERR | POLLHUP) <= 0) {
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_GENERR;
}
}
#endif
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
-
1
,
POLLOUT
|
POLLERR
|
POLLHUP
);
#ifdef DOTRACE
#ifdef DOTRACE
write
(
tech_pvt
->
fd
,
bp
,
(
int
)
globals
.
mtu
);
write
(
tech_pvt
->
fd
,
bp
,
(
int
)
globals
.
mtu
);
#endif
#endif
...
@@ -649,8 +650,10 @@ static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
...
@@ -649,8 +650,10 @@ static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
tech_pvt
=
switch_core_session_get_private
(
session
);
tech_pvt
=
switch_core_session_get_private
(
session
);
assert
(
tech_pvt
!=
NULL
);
assert
(
tech_pvt
!=
NULL
);
switch_set_flag
(
tech_pvt
,
TFLAG_BYE
);
switch_set_flag
(
tech_pvt
,
TFLAG_BYE
);
switch_clear_flag
(
tech_pvt
,
TFLAG_MEDIA
);
switch_clear_flag
(
tech_pvt
,
TFLAG_MEDIA
);
sangoma_socket_close
(
&
tech_pvt
->
socket
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
...
@@ -793,7 +796,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
...
@@ -793,7 +796,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
if
(
sangoma_span_chan_fromif
(
bchan
,
&
span
,
&
chan
))
{
if
(
sangoma_span_chan_fromif
(
bchan
,
&
span
,
&
chan
))
{
if
((
tech_pvt
->
socket
=
sangoma_open_tdmapi_span_chan
(
span
,
chan
))
<
0
)
{
if
((
tech_pvt
->
socket
=
sangoma_open_tdmapi_span_chan
(
span
,
chan
))
<
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd
!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd
for s%dc%d! [%s]
\n
"
,
span
,
chan
,
strerror
(
errno
)
);
switch_core_session_destroy
(
new_session
);
switch_core_session_destroy
(
new_session
);
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
}
...
...
src/switch_ivr.c
浏览文件 @
a84fce3e
...
@@ -688,6 +688,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
...
@@ -688,6 +688,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
int
*
stream_id_p
;
int
*
stream_id_p
;
int
stream_id
=
0
,
ans_a
=
0
,
ans_b
=
0
;
int
stream_id
=
0
,
ans_a
=
0
,
ans_b
=
0
;
switch_dtmf_callback_function
dtmf_callback
;
switch_dtmf_callback_function
dtmf_callback
;
switch_core_session_message
msg
=
{
0
};
void
*
user_data
;
void
*
user_data
;
switch_channel
*
chan_a
,
*
chan_b
;
switch_channel
*
chan_a
,
*
chan_b
;
...
@@ -760,17 +761,22 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
...
@@ -760,17 +761,22 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
/* read audio from 1 channel and write it to the other */
/* read audio from 1 channel and write it to the other */
if
(
switch_core_session_read_frame
(
session_a
,
&
read_frame
,
-
1
,
stream_id
)
==
SWITCH_STATUS_SUCCESS
&&
read_frame
->
datalen
)
{
if
(
switch_core_session_read_frame
(
session_a
,
&
read_frame
,
-
1
,
stream_id
)
==
SWITCH_STATUS_SUCCESS
&&
read_frame
->
datalen
)
{
if
(
switch_core_session_write_frame
(
session_b
,
read_frame
,
-
1
,
stream_id
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_session_write_frame
(
session_b
,
read_frame
,
-
1
,
stream_id
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNIN
G
,
"write: %s Bad Frame....[%u] Bubye!
\n
"
,
switch_channel_get_name
(
chan_b
),
read_frame
->
datalen
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBU
G
,
"write: %s Bad Frame....[%u] Bubye!
\n
"
,
switch_channel_get_name
(
chan_b
),
read_frame
->
datalen
);
data
->
running
=
-
1
;
data
->
running
=
-
1
;
}
}
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
WARNIN
G
,
"read: %s Bad Frame.... Bubye!
\n
"
,
switch_channel_get_name
(
chan_a
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBU
G
,
"read: %s Bad Frame.... Bubye!
\n
"
,
switch_channel_get_name
(
chan_a
));
data
->
running
=
-
1
;
data
->
running
=
-
1
;
}
}
//switch_yield(1000);
//switch_yield(1000);
}
}
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
msg
.
from
=
__FILE__
;
switch_core_session_receive_message
(
session_a
,
&
msg
);
data
->
running
=
0
;
data
->
running
=
0
;
if
(
his_thread
->
running
>
0
&&
switch_channel_test_flag
(
chan_a
,
CF_ORIGINATOR
))
{
if
(
his_thread
->
running
>
0
&&
switch_channel_test_flag
(
chan_a
,
CF_ORIGINATOR
))
{
...
@@ -936,6 +942,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
...
@@ -936,6 +942,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_BRIDGE
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_BRIDGE
;
msg
.
from
=
__FILE__
;
msg
.
from
=
__FILE__
;
msg
.
pointer_arg
=
session
;
msg
.
pointer_arg
=
session
;
switch_core_session_receive_message
(
peer_session
,
&
msg
);
switch_core_session_receive_message
(
peer_session
,
&
msg
);
msg
.
pointer_arg
=
peer_session
;
msg
.
pointer_arg
=
peer_session
;
switch_core_session_receive_message
(
session
,
&
msg
);
switch_core_session_receive_message
(
session
,
&
msg
);
...
@@ -944,11 +951,6 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
...
@@ -944,11 +951,6 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
switch_core_session_launch_thread
(
peer_session
,
audio_bridge_thread
,
(
void
*
)
&
other_audio_thread
);
switch_core_session_launch_thread
(
peer_session
,
audio_bridge_thread
,
(
void
*
)
&
other_audio_thread
);
audio_bridge_thread
(
NULL
,
(
void
*
)
&
this_audio_thread
);
audio_bridge_thread
(
NULL
,
(
void
*
)
&
this_audio_thread
);
msg
.
pointer_arg
=
NULL
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
switch_core_session_receive_message
(
peer_session
,
&
msg
);
switch_core_session_receive_message
(
session
,
&
msg
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_UNBRIDGE
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_UNBRIDGE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
caller_channel
,
event
);
switch_channel_event_set_data
(
caller_channel
,
event
);
switch_event_fire
(
&
event
);
switch_event_fire
(
&
event
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论