Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2572621b
提交
2572621b
authored
11月 29, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-2368
上级
8825b6ea
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
60 行增加
和
44 行删除
+60
-44
switch_core_session.c
src/switch_core_session.c
+10
-4
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+50
-40
没有找到文件。
src/switch_core_session.c
浏览文件 @
2572621b
...
@@ -1831,10 +1831,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
...
@@ -1831,10 +1831,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Application %s Requires media on channel %s!
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Application %s Requires media on channel %s!
\n
"
,
app
,
switch_channel_get_name
(
session
->
channel
));
app
,
switch_channel_get_name
(
session
->
channel
));
}
else
if
(
!
switch_test_flag
(
application_interface
,
SAF_SUPPORT_NOMEDIA
)
&&
!
switch_channel_media_ready
(
session
->
channel
))
{
}
else
if
(
!
switch_test_flag
(
application_interface
,
SAF_SUPPORT_NOMEDIA
)
&&
!
switch_channel_media_ready
(
session
->
channel
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Application %s Requires media! pre_answering channel %s
\n
"
,
if
(
switch_channel_direction
(
session
->
channel
)
==
SWITCH_CALL_DIRECTION_INBOUND
)
{
app
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Application %s Requires media! pre_answering channel %s
\n
"
,
if
(
switch_channel_pre_answer
(
session
->
channel
)
!=
SWITCH_STATUS_SUCCESS
)
{
app
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Well, that didn't work very well did it? ...
\n
"
);
if
(
switch_channel_pre_answer
(
session
->
channel
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Well, that didn't work very well did it? ...
\n
"
);
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
);
}
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_WARNING
,
"Cannot execute app '%s' media required on an outbound channel that does not have media established
\n
"
,
app
);
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
);
switch_goto_status
(
SWITCH_STATUS_FALSE
,
done
);
}
}
}
}
...
...
src/switch_ivr_bridge.c
浏览文件 @
2572621b
...
@@ -155,7 +155,6 @@ struct switch_ivr_bridge_data {
...
@@ -155,7 +155,6 @@ struct switch_ivr_bridge_data {
switch_input_callback_function_t
input_callback
;
switch_input_callback_function_t
input_callback
;
void
*
session_data
;
void
*
session_data
;
int
clean_exit
;
int
clean_exit
;
uint32_t
skip_frames
;
};
};
typedef
struct
switch_ivr_bridge_data
switch_ivr_bridge_data_t
;
typedef
struct
switch_ivr_bridge_data
switch_ivr_bridge_data_t
;
...
@@ -169,7 +168,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -169,7 +168,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_channel_t
*
chan_a
,
*
chan_b
;
switch_channel_t
*
chan_a
,
*
chan_b
;
switch_frame_t
*
read_frame
;
switch_frame_t
*
read_frame
;
switch_core_session_t
*
session_a
,
*
session_b
;
switch_core_session_t
*
session_a
,
*
session_b
;
uint32_t
loop
_count
=
0
;
uint32_t
read_frame
_count
=
0
;
const
char
*
app_name
=
NULL
,
*
app_arg
=
NULL
;
const
char
*
app_name
=
NULL
,
*
app_arg
=
NULL
;
const
char
*
hook_var
=
NULL
;
const
char
*
hook_var
=
NULL
;
int
inner_bridge
=
0
;
int
inner_bridge
=
0
;
...
@@ -181,6 +180,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -181,6 +180,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
const
char
*
bridge_answer_timeout
=
NULL
;
const
char
*
bridge_answer_timeout
=
NULL
;
int
answer_timeout
,
sent_update
=
0
;
int
answer_timeout
,
sent_update
=
0
;
time_t
answer_limit
=
0
;
time_t
answer_limit
=
0
;
const
char
*
exec_app
=
NULL
;
const
char
*
exec_data
=
NULL
;
#ifdef SWITCH_VIDEO_IN_THREADS
#ifdef SWITCH_VIDEO_IN_THREADS
switch_thread_t
*
vid_thread
=
NULL
;
switch_thread_t
*
vid_thread
=
NULL
;
...
@@ -201,6 +202,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -201,6 +202,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
chan_a
=
switch_core_session_get_channel
(
session_a
);
chan_a
=
switch_core_session_get_channel
(
session_a
);
chan_b
=
switch_core_session_get_channel
(
session_b
);
chan_b
=
switch_core_session_get_channel
(
session_b
);
if
((
exec_app
=
switch_channel_get_variable
(
chan_a
,
"bridge_pre_execute_app"
)))
{
exec_data
=
switch_channel_get_variable
(
chan_a
,
"bridge_pre_execute_data"
);
}
bypass_media_after_bridge
=
switch_channel_test_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
bypass_media_after_bridge
=
switch_channel_test_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
switch_channel_clear_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
switch_channel_clear_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
...
@@ -212,7 +217,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -212,7 +217,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
}
}
inner_bridge
=
switch_channel_test_flag
(
chan_a
,
CF_INNER_BRIDGE
);
inner_bridge
=
switch_channel_test_flag
(
chan_a
,
CF_INNER_BRIDGE
);
if
(
!
switch_channel_test_flag
(
chan_a
,
CF_ANSWERED
)
&&
(
bridge_answer_timeout
=
switch_channel_get_variable
(
chan_a
,
"bridge_answer_timeout"
)))
{
if
(
!
switch_channel_test_flag
(
chan_a
,
CF_ANSWERED
)
&&
(
bridge_answer_timeout
=
switch_channel_get_variable
(
chan_a
,
"bridge_answer_timeout"
)))
{
if
((
answer_timeout
=
atoi
(
bridge_answer_timeout
))
<
0
)
{
if
((
answer_timeout
=
atoi
(
bridge_answer_timeout
))
<
0
)
{
answer_timeout
=
0
;
answer_timeout
=
0
;
...
@@ -285,7 +290,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -285,7 +290,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_channel_state_t
b_state
;
switch_channel_state_t
b_state
;
switch_status_t
status
;
switch_status_t
status
;
switch_event_t
*
event
;
switch_event_t
*
event
;
loop_count
++
;
if
(
switch_channel_test_flag
(
chan_a
,
CF_TRANSFER
))
{
if
(
switch_channel_test_flag
(
chan_a
,
CF_TRANSFER
))
{
data
->
clean_exit
=
1
;
data
->
clean_exit
=
1
;
...
@@ -309,7 +313,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -309,7 +313,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
goto
end_of_bridge_loop
;
goto
end_of_bridge_loop
;
}
}
if
(
loop
_count
>
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
)
&&
switch_core_session_private_event_count
(
session_a
))
{
if
(
read_frame
_count
>
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
)
&&
switch_core_session_private_event_count
(
session_a
))
{
switch_channel_set_flag
(
chan_b
,
CF_SUSPEND
);
switch_channel_set_flag
(
chan_b
,
CF_SUSPEND
);
msg
.
string_arg
=
data
->
b_uuid
;
msg
.
string_arg
=
data
->
b_uuid
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
...
@@ -341,13 +345,34 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -341,13 +345,34 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
}
}
#endif
#endif
if
(
loop_count
>
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
)
&&
if
(
read_frame_count
>
DEFAULT_LEAD_FRAMES
&&
switch_channel_media_ack
(
chan_a
))
{
(
bypass_media_after_bridge
||
switch_channel_test_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
))
&&
switch_channel_test_flag
(
chan_a
,
CF_ANSWERED
)
&&
switch_channel_test_flag
(
chan_b
,
CF_ANSWERED
))
{
if
(
exec_app
)
{
switch_ivr_nomedia
(
switch_core_session_get_uuid
(
session_a
),
SMF_REBRIDGE
);
switch_event_t
*
execute_event
;
bypass_media_after_bridge
=
0
;
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session_a
),
SWITCH_LOG_CRIT
,
"%s Bridge execute app %s(%s)
\n
"
,
switch_channel_clear_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
switch_channel_get_name
(
chan_a
),
exec_app
,
exec_data
);
goto
end_of_bridge_loop
;
if
(
switch_event_create
(
&
execute_event
,
SWITCH_EVENT_COMMAND
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"call-command"
,
"execute"
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-name"
,
exec_app
);
if
(
exec_data
)
{
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-arg"
,
exec_data
);
}
//switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"event-lock"
,
"true"
);
switch_core_session_queue_private_event
(
session_a
,
&
execute_event
,
SWITCH_FALSE
);
}
exec_app
=
exec_data
=
NULL
;
}
if
((
bypass_media_after_bridge
||
switch_channel_test_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
))
&&
switch_channel_test_flag
(
chan_a
,
CF_ANSWERED
)
&&
switch_channel_test_flag
(
chan_b
,
CF_ANSWERED
))
{
switch_ivr_nomedia
(
switch_core_session_get_uuid
(
session_a
),
SMF_REBRIDGE
);
bypass_media_after_bridge
=
0
;
switch_channel_clear_flag
(
chan_a
,
CF_BYPASS_MEDIA_AFTER_BRIDGE
);
goto
end_of_bridge_loop
;
}
}
}
/* if 1 channel has DTMF pass it to the other */
/* if 1 channel has DTMF pass it to the other */
...
@@ -454,6 +479,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -454,6 +479,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
status
=
switch_core_session_read_frame
(
session_a
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
stream_id
);
status
=
switch_core_session_read_frame
(
session_a
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
stream_id
);
if
(
SWITCH_READ_ACCEPTABLE
(
status
))
{
if
(
SWITCH_READ_ACCEPTABLE
(
status
))
{
read_frame_count
++
;
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
if
(
switch_test_flag
(
read_frame
,
SFF_CNG
))
{
if
(
silence_val
)
{
if
(
silence_val
)
{
switch_generate_sln_silence
((
int16_t
*
)
silence_frame
.
data
,
silence_frame
.
samples
,
silence_val
);
switch_generate_sln_silence
((
int16_t
*
)
silence_frame
.
data
,
silence_frame
.
samples
,
silence_val
);
...
@@ -463,11 +489,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
...
@@ -463,11 +489,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
}
}
}
}
if
(
data
->
skip_frames
)
{
data
->
skip_frames
--
;
continue
;
}
if
(
switch_channel_test_flag
(
chan_a
,
CF_BRIDGE_NOWRITE
))
{
if
(
switch_channel_test_flag
(
chan_a
,
CF_BRIDGE_NOWRITE
))
{
continue
;
continue
;
}
}
...
@@ -1193,35 +1214,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
...
@@ -1193,35 +1214,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
switch_channel_set_variable
(
peer_channel
,
SWITCH_SIGNAL_BOND_VARIABLE
,
switch_core_session_get_uuid
(
session
));
switch_channel_set_variable
(
peer_channel
,
SWITCH_SIGNAL_BOND_VARIABLE
,
switch_core_session_get_uuid
(
session
));
if
((
app
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_aleg_app"
)))
{
if
((
app
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_aleg_app"
)))
{
switch_event_t
*
execute_event
;
switch_channel_set_variable
(
caller_channel
,
"bridge_pre_execute_app"
,
app
);
data
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_aleg_data"
);
if
((
data
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_aleg_data"
)))
{
if
(
switch_event_create
(
&
execute_event
,
SWITCH_EVENT_COMMAND
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_set_variable
(
caller_channel
,
"bridge_pre_execute_data"
,
data
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"call-command"
,
"execute"
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-name"
,
app
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-arg"
,
data
);
switch_event_add_header
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"lead-frames"
,
"%d"
,
5
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"event-lock"
,
"true"
);
switch_core_session_queue_private_event
(
session
,
&
execute_event
,
SWITCH_FALSE
);
a_leg
->
skip_frames
=
DEFAULT_LEAD_FRAMES
;
}
}
}
}
if
((
app
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_bleg_app"
)))
{
if
((
app
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_bleg_app"
)))
{
switch_event_t
*
execute_event
;
switch_channel_set_variable
(
peer_channel
,
"bridge_pre_execute_app"
,
app
);
data
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_bleg_data"
);
if
(
switch_event_create
(
&
execute_event
,
SWITCH_EVENT_COMMAND
)
==
SWITCH_STATUS_SUCCESS
)
{
if
((
data
=
switch_channel_get_variable
(
caller_channel
,
"bridge_pre_execute_bleg_data"
)))
{
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"call-command"
,
"execute"
);
switch_channel_set_variable
(
peer_channel
,
"bridge_pre_execute_data"
,
data
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-name"
,
app
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"execute-app-arg"
,
data
);
switch_event_add_header
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"lead-frames"
,
"%d"
,
5
);
switch_event_add_header_string
(
execute_event
,
SWITCH_STACK_BOTTOM
,
"event-lock"
,
"true"
);
switch_core_session_queue_private_event
(
peer_session
,
&
execute_event
,
SWITCH_FALSE
);
b_leg
->
skip_frames
=
DEFAULT_LEAD_FRAMES
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"APP [%s][%s]
\n
"
,
app
,
switch_str_nil
(
data
));
}
}
switch_channel_set_private
(
peer_channel
,
"_bridge_"
,
b_leg
);
switch_channel_set_private
(
peer_channel
,
"_bridge_"
,
b_leg
);
switch_channel_set_state
(
peer_channel
,
CS_EXCHANGE_MEDIA
);
switch_channel_set_state
(
peer_channel
,
CS_EXCHANGE_MEDIA
);
audio_bridge_thread
(
NULL
,
(
void
*
)
a_leg
);
audio_bridge_thread
(
NULL
,
(
void
*
)
a_leg
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论