Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
adb68d6b
提交
adb68d6b
authored
5月 03, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5085 adding this patch but still wondering what causes this issue
上级
21c5db87
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
38 行增加
和
27 行删除
+38
-27
mod_loopback.c
src/mod/endpoints/mod_loopback/mod_loopback.c
+38
-27
没有找到文件。
src/mod/endpoints/mod_loopback/mod_loopback.c
浏览文件 @
adb68d6b
...
...
@@ -60,14 +60,14 @@ typedef enum {
TFLAG_CLEAR
=
(
1
<<
10
)
}
TFLAGS
;
struct
private_object
{
struct
loopback_
private_object
{
unsigned
int
flags
;
switch_mutex_t
*
flag_mutex
;
switch_mutex_t
*
mutex
;
switch_core_session_t
*
session
;
switch_channel_t
*
channel
;
switch_core_session_t
*
other_session
;
struct
private_object
*
other_tech_pvt
;
struct
loopback_
private_object
*
other_tech_pvt
;
switch_channel_t
*
other_channel
;
switch_codec_t
read_codec
;
switch_codec_t
write_codec
;
...
...
@@ -89,7 +89,7 @@ struct private_object {
int
first_cng
;
};
typedef
struct
private_object
private_t
;
typedef
struct
loopback_private_object
loopback_
private_t
;
static
struct
{
int
debug
;
...
...
@@ -110,7 +110,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
static
switch_status_t
channel_kill_channel
(
switch_core_session_t
*
session
,
int
sig
);
static
void
clear_queue
(
private_t
*
tech_pvt
)
static
void
clear_queue
(
loopback_
private_t
*
tech_pvt
)
{
void
*
pop
;
...
...
@@ -121,7 +121,7 @@ static void clear_queue(private_t *tech_pvt)
}
static
switch_status_t
tech_init
(
private_t
*
tech_pvt
,
switch_core_session_t
*
session
,
switch_codec_t
*
codec
)
static
switch_status_t
tech_init
(
loopback_
private_t
*
tech_pvt
,
switch_core_session_t
*
session
,
switch_codec_t
*
codec
)
{
const
char
*
iananame
=
"L16"
;
uint32_t
rate
=
8000
;
...
...
@@ -224,7 +224,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
static
switch_status_t
channel_on_init
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
,
*
b_channel
;
private_t
*
tech_pvt
=
NULL
,
*
b_tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
,
*
b_tech_pvt
=
NULL
;
switch_core_session_t
*
b_session
;
char
name
[
128
];
switch_caller_profile_t
*
caller_profile
;
...
...
@@ -254,7 +254,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_core_session_add_stream
(
b_session
,
NULL
);
b_channel
=
switch_core_session_get_channel
(
b_session
);
b_tech_pvt
=
(
private_t
*
)
switch_core_session_alloc
(
b_session
,
sizeof
(
*
b_tech_pvt
));
b_tech_pvt
=
(
loopback_
private_t
*
)
switch_core_session_alloc
(
b_session
,
sizeof
(
*
b_tech_pvt
));
switch_snprintf
(
name
,
sizeof
(
name
),
"loopback/%s-b"
,
tech_pvt
->
caller_profile
->
destination_number
);
switch_channel_set_name
(
b_channel
,
name
);
...
...
@@ -270,9 +270,11 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
b_tech_pvt
->
caller_profile
=
caller_profile
;
switch_channel_set_state
(
b_channel
,
CS_INIT
);
switch_mutex_lock
(
tech_pvt
->
mutex
);
tech_pvt
->
other_session
=
b_session
;
tech_pvt
->
other_tech_pvt
=
b_tech_pvt
;
tech_pvt
->
other_channel
=
b_channel
;
switch_mutex_unlock
(
tech_pvt
->
mutex
);
//b_tech_pvt->other_session = session;
//b_tech_pvt->other_tech_pvt = tech_pvt;
...
...
@@ -335,10 +337,14 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
goto
end
;
}
}
else
if
((
tech_pvt
->
other_session
=
switch_core_session_locate
(
tech_pvt
->
other_uuid
)))
{
}
else
{
switch_mutex_lock
(
tech_pvt
->
mutex
);
if
((
tech_pvt
->
other_session
=
switch_core_session_locate
(
tech_pvt
->
other_uuid
)))
{
tech_pvt
->
other_tech_pvt
=
switch_core_session_get_private
(
tech_pvt
->
other_session
);
tech_pvt
->
other_channel
=
switch_core_session_get_channel
(
tech_pvt
->
other_session
);
}
switch_mutex_unlock
(
tech_pvt
->
mutex
);
}
if
(
!
tech_pvt
->
other_session
)
{
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_LINKED
);
...
...
@@ -354,7 +360,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
return
SWITCH_STATUS_SUCCESS
;
}
static
void
do_reset
(
private_t
*
tech_pvt
)
static
void
do_reset
(
loopback_
private_t
*
tech_pvt
)
{
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_WRITE
);
...
...
@@ -368,7 +374,7 @@ static void do_reset(private_t *tech_pvt)
static
switch_status_t
channel_on_routing
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
const
char
*
app
,
*
arg
;
channel
=
switch_core_session_get_channel
(
session
);
...
...
@@ -410,7 +416,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
static
switch_status_t
channel_on_execute
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
switch_caller_extension_t
*
exten
;
int
bow
=
0
;
...
...
@@ -459,7 +465,7 @@ static switch_status_t channel_on_execute(switch_core_session_t *session)
static
switch_status_t
channel_on_destroy
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
void
*
pop
;
switch_event_t
*
vars
;
...
...
@@ -502,7 +508,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
static
switch_status_t
channel_on_hangup
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
switch_assert
(
channel
!=
NULL
);
...
...
@@ -514,8 +520,13 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_LINKED
);
switch_mutex_lock
(
tech_pvt
->
mutex
);
if
(
tech_pvt
->
other_tech_pvt
)
{
switch_clear_flag_locked
(
tech_pvt
->
other_tech_pvt
,
TFLAG_LINKED
);
if
(
tech_pvt
->
other_tech_pvt
->
session
&&
tech_pvt
->
other_tech_pvt
->
session
!=
tech_pvt
->
other_session
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_CRIT
,
"OTHER SESSION MISMATCH????
\n
"
);
tech_pvt
->
other_session
=
tech_pvt
->
other_tech_pvt
->
session
;
}
tech_pvt
->
other_tech_pvt
=
NULL
;
}
...
...
@@ -533,7 +544,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
static
switch_status_t
channel_kill_channel
(
switch_core_session_t
*
session
,
int
sig
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
switch_assert
(
channel
!=
NULL
);
...
...
@@ -571,7 +582,7 @@ static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
static
switch_status_t
channel_on_exchange_media
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
...
...
@@ -586,7 +597,7 @@ static switch_status_t channel_on_exchange_media(switch_core_session_t *session)
static
switch_status_t
channel_on_reset
(
switch_core_session_t
*
session
)
{
private_t
*
tech_pvt
=
(
private_t
*
)
switch_core_session_get_private
(
session
);
loopback_private_t
*
tech_pvt
=
(
loopback_
private_t
*
)
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
do_reset
(
tech_pvt
);
...
...
@@ -609,7 +620,7 @@ static switch_status_t channel_on_hibernate(switch_core_session_t *session)
static
switch_status_t
channel_on_consume_media
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
...
...
@@ -624,7 +635,7 @@ static switch_status_t channel_on_consume_media(switch_core_session_t *session)
static
switch_status_t
channel_send_dtmf
(
switch_core_session_t
*
session
,
const
switch_dtmf_t
*
dtmf
)
{
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
tech_pvt
=
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
...
...
@@ -639,7 +650,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
static
switch_status_t
channel_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
switch_io_flag_t
flags
,
int
stream_id
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_mutex_t
*
mutex
=
NULL
;
void
*
pop
=
NULL
;
...
...
@@ -738,7 +749,7 @@ static switch_status_t find_non_loopback_bridge(switch_core_session_t *session,
while
(
a_uuid
&&
(
sp
=
switch_core_session_locate
(
a_uuid
)))
{
if
(
switch_core_session_check_interface
(
sp
,
loopback_endpoint_interface
))
{
private_t
*
tech_pvt
;
loopback_
private_t
*
tech_pvt
;
switch_channel_t
*
spchan
=
switch_core_session_get_channel
(
sp
);
switch_channel_wait_for_state_or_greater
(
spchan
,
channel
,
CS_ROUTING
);
...
...
@@ -769,7 +780,7 @@ static switch_status_t find_non_loopback_bridge(switch_core_session_t *session,
static
switch_status_t
channel_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
switch_io_flag_t
flags
,
int
stream_id
)
{
switch_channel_t
*
channel
=
NULL
;
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
channel
=
switch_core_session_get_channel
(
session
);
...
...
@@ -891,7 +902,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
static
switch_status_t
channel_receive_message
(
switch_core_session_t
*
session
,
switch_core_session_message_t
*
msg
)
{
switch_channel_t
*
channel
;
private_t
*
tech_pvt
;
loopback_
private_t
*
tech_pvt
;
int
done
=
1
,
pass
=
0
;
channel
=
switch_core_session_get_channel
(
session
);
...
...
@@ -1000,7 +1011,7 @@ static switch_status_t loopback_bowout_on_execute_state_handler(switch_core_sess
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_state_t
state
=
switch_channel_get_state
(
channel
);
private_t
*
tech_pvt
=
NULL
;
loopback_
private_t
*
tech_pvt
=
NULL
;
if
(
state
==
CS_EXECUTE
)
{
...
...
@@ -1069,14 +1080,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
if
((
*
new_session
=
switch_core_session_request
(
loopback_endpoint_interface
,
SWITCH_CALL_DIRECTION_OUTBOUND
,
flags
,
pool
))
!=
0
)
{
private_t
*
tech_pvt
;
loopback_
private_t
*
tech_pvt
;
switch_channel_t
*
channel
;
switch_caller_profile_t
*
caller_profile
;
switch_event_t
*
clone
=
NULL
;
switch_core_session_add_stream
(
*
new_session
,
NULL
);
if
((
tech_pvt
=
(
private_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
private_t
)))
!=
0
)
{
if
((
tech_pvt
=
(
loopback_private_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
loopback_
private_t
)))
!=
0
)
{
channel
=
switch_core_session_get_channel
(
*
new_session
);
switch_snprintf
(
name
,
sizeof
(
name
),
"loopback/%s-a"
,
outbound_profile
->
destination_number
);
switch_channel_set_name
(
channel
,
name
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论