Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
614177ac
提交
614177ac
authored
5月 14, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@5181
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
3db8dd0e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
81 行增加
和
45 行删除
+81
-45
switch_ivr.h
src/include/switch_ivr.h
+9
-2
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+10
-0
switch_core_session.c
src/switch_core_session.c
+1
-0
switch_ivr.c
src/switch_ivr.c
+37
-29
switch_ivr_async.c
src/switch_ivr_async.c
+11
-1
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+5
-4
switch_ivr_play_say.c
src/switch_ivr_play_say.c
+8
-9
没有找到文件。
src/include/switch_ivr.h
浏览文件 @
614177ac
...
...
@@ -92,12 +92,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
/*!
\brief Parse command from an event
\param session the session
to send the message to
\param event the event to
send
\param session the session
on which to parse the event
\param event the event to
parse
\return SWITCH_STATUS_SUCCESS if successful
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_parse_event
(
switch_core_session_t
*
session
,
switch_event_t
*
event
);
/*!
\brief Parse all commands from an event
\param session the session on which to parse the events
\return SWITCH_STATUS_SUCCESS if successful
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_parse_all_events
(
switch_core_session_t
*
session
);
/*!
\brief Wait for time to pass for a specified number of milliseconds
\param session the session to wait for.
...
...
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
614177ac
...
...
@@ -690,6 +690,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_core_session_t
*
other_session
;
switch_channel_t
*
other_channel
;
char
*
ip
=
NULL
,
*
port
=
NULL
;
if
(
switch_channel_get_state
(
channel
)
>=
CS_HANGUP
)
{
return
SWITCH_STATUS_FALSE
;
}
switch_channel_set_flag
(
channel
,
CF_BYPASS_MEDIA
);
tech_pvt
->
local_sdp_str
=
NULL
;
if
((
uuid
=
switch_channel_get_variable
(
channel
,
SWITCH_SIGNAL_BOND_VARIABLE
))
...
...
@@ -710,6 +715,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
break
;
case
SWITCH_MESSAGE_INDICATE_MEDIA
:{
uint32_t
count
=
0
;
if
(
switch_channel_get_state
(
channel
)
>=
CS_HANGUP
)
{
return
SWITCH_STATUS_FALSE
;
}
switch_channel_clear_flag
(
channel
,
CF_BYPASS_MEDIA
);
tech_pvt
->
local_sdp_str
=
NULL
;
if
(
!
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
...
...
src/switch_core_session.c
浏览文件 @
614177ac
...
...
@@ -581,6 +581,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
return
status
;
}
SWITCH_DECLARE
(
void
)
switch_core_session_reset
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
;
...
...
src/switch_ivr.c
浏览文件 @
614177ac
...
...
@@ -374,6 +374,23 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_parse_all_events
(
switch_core_session_t
*
session
)
{
switch_event_t
*
event
;
switch_channel_t
*
channel
;
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
while
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_fire
(
&
event
);
}
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_park
(
switch_core_session_t
*
session
,
switch_input_args_t
*
args
)
{
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
...
...
@@ -383,6 +400,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
switch_event_t
*
event
;
switch_unicast_conninfo_t
*
conninfo
=
NULL
;
switch_codec_t
*
read_codec
=
switch_core_session_get_read_codec
(
session
);
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
...
...
@@ -467,10 +485,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
}
}
if
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_channel_event_set_data
(
switch_core_session_get_channel
(
session
),
event
);
switch_event_fire
(
&
event
);
if
(
switch_core_session_private_event_count
(
session
))
{
switch_ivr_parse_all_events
(
session
);
}
if
(
switch_channel_has_dtmf
(
channel
))
{
...
...
@@ -540,10 +556,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
}
}
if
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_destroy
(
&
event
);
}
if
(
switch_core_session_private_event_count
(
session
))
{
switch_ivr_parse_all_events
(
session
);
}
if
(
switch_channel_has_dtmf
(
channel
))
{
switch_channel_dequeue_dtmf
(
channel
,
dtmf
,
sizeof
(
dtmf
));
...
...
@@ -606,8 +621,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
while
(
switch_channel_ready
(
channel
))
{
switch_frame_t
*
read_frame
;
switch_event_t
*
event
;
if
(
timeout
)
{
elapsed
=
(
uint32_t
)
((
switch_time_now
()
-
started
)
/
1000
);
if
(
elapsed
>=
timeout
)
{
...
...
@@ -615,10 +629,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
}
}
if
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_destroy
(
&
event
);
}
if
(
switch_core_session_private_event_count
(
session
))
{
switch_ivr_parse_all_events
(
session
);
}
if
(
switch_channel_has_dtmf
(
channel
))
{
char
dtmf
[
128
];
...
...
@@ -776,8 +789,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag
switch_core_session_message_t
msg
=
{
0
};
switch_status_t
status
=
SWITCH_STATUS_GENERR
;
uint8_t
swap
=
0
;
switch_event_t
*
event
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_NOMEDIA
;
msg
.
from
=
__FILE__
;
...
...
@@ -791,27 +803,23 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag
}
if
((
flags
&
SMF_FORCE
)
||
!
switch_channel_test_flag
(
channel
,
CF_BYPASS_MEDIA
))
{
while
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_destroy
(
&
event
);
}
switch_channel_set_flag
(
channel
,
CF_BYPASS_MEDIA
);
switch_core_session_receive_message
(
session
,
&
msg
);
switch_ivr_parse_all_events
(
session
);
if
((
flags
&
SMF_REBRIDGE
)
&&
(
other_uuid
=
switch_channel_get_variable
(
channel
,
SWITCH_BRIDGE_VARIABLE
))
&&
(
other_session
=
switch_core_session_locate
(
other_uuid
)))
{
other_channel
=
switch_core_session_get_channel
(
other_session
);
assert
(
other_channel
!=
NULL
);
while
(
switch_core_session_dequeue_private_event
(
other_session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
other_session
,
event
);
switch_event_destroy
(
&
event
);
}
switch_ivr_parse_all_events
(
other_session
);
switch_core_session_receive_message
(
other_session
,
&
msg
);
switch_channel_clear_state_handler
(
other_channel
,
NULL
);
}
switch_channel_set_flag
(
channel
,
CF_BYPASS_MEDIA
);
switch_core_session_receive_message
(
session
,
&
msg
);
if
(
other_channel
)
{
switch_channel_clear_state_handler
(
channel
,
NULL
);
if
(
swap
)
{
...
...
src/switch_ivr_async.c
浏览文件 @
614177ac
...
...
@@ -771,7 +771,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, swi
if
((
session
=
switch_core_session_locate
(
uuid
)))
{
char
*
cause
=
NULL
;
char
*
mypath
=
strdup
(
path
)
;
char
*
mypath
;
char
*
p
;
master
=
session
;
...
...
@@ -779,6 +779,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, swi
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
if
((
switch_channel_test_flag
(
channel
,
CF_EVENT_PARSE
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Channel [%s] already broadcasting...broadcast aborted
\n
"
,
switch_channel_get_name
(
channel
));
switch_core_session_rwunlock
(
session
);
return
SWITCH_STATUS_FALSE
;
}
mypath
=
strdup
(
path
);
if
((
nomedia
=
switch_channel_test_flag
(
channel
,
CF_BYPASS_MEDIA
)))
{
switch_ivr_media
(
uuid
,
SMF_REBRIDGE
);
}
...
...
src/switch_ivr_bridge.c
浏览文件 @
614177ac
...
...
@@ -55,6 +55,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_channel_t
*
chan_a
,
*
chan_b
;
switch_frame_t
*
read_frame
;
switch_core_session_t
*
session_a
,
*
session_b
;
uint32_t
loop_count
=
0
;
session_a
=
data
->
session
;
if
(
!
(
session_b
=
switch_core_session_locate
(
data
->
b_uuid
)))
{
...
...
@@ -80,6 +81,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_channel_state_t
b_state
;
switch_status_t
status
;
switch_event_t
*
event
;
loop_count
++
;
/* if you really want to make sure it's not ready, test it twice because it might be just a break */
if
(
!
switch_channel_ready
(
chan_a
)
&&
!
switch_channel_ready
(
chan_a
))
{
...
...
@@ -96,21 +98,20 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
break
;
}
if
(
switch_core_session_dequeue_private_event
(
session_a
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
loop_count
>
10
&&
switch_core_session_private_event_count
(
session_a
)
)
{
switch_channel_set_flag
(
chan_b
,
CF_SUSPEND
);
msg
.
string_arg
=
data
->
b_uuid
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
msg
.
from
=
__FILE__
;
switch_core_session_receive_message
(
session_a
,
&
msg
);
switch_ivr_parse_
event
(
session_a
,
event
);
switch_ivr_parse_
all_events
(
session_a
);
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_BRIDGE
;
switch_core_session_receive_message
(
session_a
,
&
msg
);
switch_channel_clear_flag
(
chan_b
,
CF_SUSPEND
);
switch_event_destroy
(
&
event
);
}
if
(
switch_channel_test_flag
(
chan_a
,
CF_SUSPEND
)
||
switch_channel_test_flag
(
chan_b
,
CF_SUSPEND
))
{
switch_yield
(
1000
00
);
switch_yield
(
1000
);
continue
;
}
...
...
src/switch_ivr_play_say.c
浏览文件 @
614177ac
...
...
@@ -394,11 +394,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
while
(
switch_channel_ready
(
channel
))
{
switch_size_t
len
;
switch_event_t
*
event
;
if
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_destroy
(
&
event
);
if
(
switch_core_session_private_event_count
(
session
))
{
switch_ivr_parse_all_events
(
session
);
}
if
(
start
&&
(
time
(
NULL
)
-
start
)
>
limit
)
{
...
...
@@ -425,6 +423,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
if
(
args
->
input_callback
)
{
switch_event_t
*
event
=
NULL
;
if
(
switch_core_session_dequeue_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
status
=
args
->
input_callback
(
session
,
event
,
SWITCH_INPUT_TYPE_EVENT
,
args
->
buf
,
args
->
buflen
);
switch_event_destroy
(
&
event
);
...
...
@@ -682,12 +682,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
int
done
=
0
;
int
do_speed
=
1
;
int
last_speed
=
-
1
;
switch_event_t
*
event
;
if
(
switch_core_session_dequeue_private_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_ivr_parse_event
(
session
,
event
);
switch_event_destroy
(
&
event
);
if
(
switch_core_session_private_event_count
(
session
))
{
switch_ivr_parse_all_events
(
session
);
}
if
(
args
&&
(
args
->
input_callback
||
args
->
buf
||
args
->
buflen
))
{
...
...
@@ -711,6 +708,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
}
if
(
args
->
input_callback
)
{
switch_event_t
*
event
;
if
(
switch_core_session_dequeue_event
(
session
,
&
event
)
==
SWITCH_STATUS_SUCCESS
)
{
status
=
args
->
input_callback
(
session
,
event
,
SWITCH_INPUT_TYPE_EVENT
,
args
->
buf
,
args
->
buflen
);
switch_event_destroy
(
&
event
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论