Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a035ec59
提交
a035ec59
authored
6月 12, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doh
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@5317
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
90a5504d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
92 行增加
和
0 行删除
+92
-0
mod_bridgecall.c
src/mod/applications/mod_bridgecall/mod_bridgecall.c
+90
-0
mod_spidermonkey.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
+2
-0
没有找到文件。
src/mod/applications/mod_bridgecall/mod_bridgecall.c
浏览文件 @
a035ec59
...
...
@@ -36,8 +36,98 @@
static
const
char
modname
[]
=
"mod_bridgecall"
;
static
void
audio_bridge_function
(
switch_core_session_t
*
session
,
char
*
data
)
{
switch_channel_t
*
caller_channel
;
switch_core_session_t
*
peer_session
=
NULL
;
unsigned
int
timelimit
=
60
;
char
*
var
;
uint8_t
no_media_bridge
=
0
;
switch_call_cause_t
cause
=
SWITCH_CAUSE_NORMAL_CLEARING
;
uint8_t
do_continue
=
0
;
if
(
switch_strlen_zero
(
data
))
{
return
;
}
caller_channel
=
switch_core_session_get_channel
(
session
);
assert
(
caller_channel
!=
NULL
);
if
((
var
=
switch_channel_get_variable
(
caller_channel
,
"call_timeout"
)))
{
timelimit
=
atoi
(
var
);
}
if
((
var
=
switch_channel_get_variable
(
caller_channel
,
"continue_on_fail"
)))
{
do_continue
=
switch_true
(
var
);
}
if
(
switch_channel_test_flag
(
caller_channel
,
CF_BYPASS_MEDIA
)
||
((
var
=
switch_channel_get_variable
(
caller_channel
,
SWITCH_BYPASS_MEDIA_VARIABLE
))
&&
switch_true
(
var
)))
{
if
(
!
switch_channel_test_flag
(
caller_channel
,
CF_ANSWERED
)
&&
!
switch_channel_test_flag
(
caller_channel
,
CF_EARLY_MEDIA
))
{
switch_channel_set_flag
(
caller_channel
,
CF_BYPASS_MEDIA
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Channel is already up, delaying point-to-point mode 'till both legs are up.
\n
"
);
no_media_bridge
=
1
;
}
}
if
(
switch_ivr_originate
(
session
,
&
peer_session
,
&
cause
,
data
,
timelimit
,
NULL
,
NULL
,
NULL
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Originate Failed. Cause: %s
\n
"
,
switch_channel_cause2str
(
cause
));
if
(
!
do_continue
&&
cause
!=
SWITCH_CAUSE_NO_ANSWER
)
{
/* All Causes besides NO_ANSWER terminate the originating session unless continue_on_fail is set.
We will pass the fail cause on when we hangup. */
switch_channel_hangup
(
caller_channel
,
cause
);
}
/* Otherwise.. nobody answered. Go back to the dialplan instructions in case there was more to do. */
return
;
}
else
{
if
(
no_media_bridge
)
{
switch_channel_t
*
peer_channel
=
switch_core_session_get_channel
(
peer_session
);
switch_frame_t
*
read_frame
;
/* SIP won't let us redir media until the call has been answered #$^#%& so we will proxy any early media until they do */
while
(
switch_channel_ready
(
caller_channel
)
&&
switch_channel_ready
(
peer_channel
)
&&
!
switch_channel_test_flag
(
peer_channel
,
CF_ANSWERED
))
{
switch_status_t
status
=
switch_core_session_read_frame
(
peer_session
,
&
read_frame
,
-
1
,
0
);
uint8_t
bad
=
1
;
if
(
SWITCH_READ_ACCEPTABLE
(
status
)
&&
switch_core_session_write_frame
(
session
,
read_frame
,
-
1
,
0
)
==
SWITCH_STATUS_SUCCESS
)
{
bad
=
0
;
}
if
(
bad
)
{
switch_channel_hangup
(
caller_channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_channel_hangup
(
peer_channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
goto
end
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Redirecting media to point-to-point mode.
\n
"
);
switch_ivr_nomedia
(
switch_core_session_get_uuid
(
session
),
SMF_FORCE
);
switch_ivr_nomedia
(
switch_core_session_get_uuid
(
peer_session
),
SMF_FORCE
);
switch_ivr_signal_bridge
(
session
,
peer_session
);
}
else
{
if
(
switch_channel_test_flag
(
caller_channel
,
CF_BYPASS_MEDIA
))
{
switch_ivr_signal_bridge
(
session
,
peer_session
);
}
else
{
switch_ivr_multi_threaded_bridge
(
session
,
peer_session
,
NULL
,
NULL
,
NULL
);
}
}
end:
if
(
peer_session
)
{
switch_core_session_rwunlock
(
peer_session
);
}
}
}
static
const
switch_application_interface_t
bridge_application_interface
=
{
/*.interface_name */
"bridge"
,
/*.application_function */
audio_bridge_function
,
/* long_desc */
"Bridge the audio between two sessions"
,
/* short_desc */
"Bridge Audio"
,
/* syntax */
"<channel_url>"
,
/* flags */
SAF_SUPPORT_NOMEDIA
};
static
const
switch_loadable_module_interface_t
mod_bridgecall_module_interface
=
{
/*.module_name = */
modname
,
...
...
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
浏览文件 @
a035ec59
...
...
@@ -2392,6 +2392,8 @@ static void session_destroy(JSContext * cx, JSObject * obj)
switch_channel_set_private
(
channel
,
"jss"
,
NULL
);
}
switch_core_event_hook_remove_state_change
(
jss
->
session
,
hanguphook
);
if
(
channel
&&
switch_test_flag
(
jss
,
S_HUP
))
{
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_NORMAL_CLEARING
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论